Modulo:TeamBracket: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
remake meccanismo addpath e bye intermedi vuoit |
||
Riga 17:
header_third_place = "text-align:center;border:1px solid #aaa;background-color:#f2f2f2",
header_cell = "text-align:center;border:1px solid #aaa;background-color:#f2f2f2",
path_top = "border:0 solid black;border-top-width:2px;",
group = "text-align:center",
winner = {'font-weight' , 'bold'},
Line 35 ⟶ 36:
if debug then
style.group = style.group .. ";background-color:green"
style.
style.
style.path_rigth_top= style.path_rigth_top .. ";background-color:#F08080"
style.path_right_bottom= style.path_right_bottom .. ";background-color:#F08080"
end
Line 208 ⟶ 211:
nulli la funzione non disegna niente.
===============================================================================]]
function TeamBracket:addPath(row1, row2, row_gap
local col = self.current_col + self.current_width + 1
local half_gap = row_gap / 2
if not (row1 or row2) then return end
-- first half
if row1 then
self.rows[row1+1]:tag('td'):cssText(style.path_bottom)
for r = row1+1, row1+3 do self.last_element[r] = col end
for r = row1+4, row1+4+half_gap-1 do self:addGap(r, col, 0, 'ap1') end
self.rows[row1+2]:tag('td')
:attr('rowspan', half_gap + 2)
:cssText(style.path_rigth_top)
end
--second half
if row2 then
self.rows[row2+2]:tag('td'):cssText(style.path_top)
for r = row2, row2+2 do self.last_element[r] = col end
for r = row2-half_gap, row2-1 do self:addGap(r, col, 0, 'ap2') end
self.rows[row2-half_gap]:tag('td')
:attr('rowspan', half_gap+2)
:cssText(style.path_right_bottom)
end
local middle_row
middle_row = (row1 and (row1 + 3 + half_gap)) or (row2 - half_gap - 1)
self:addGap(middle_row, col+1, 0, 'ap3')
self:addGap(middle_row+1, col+1, 0, 'ap3')
self.rows[middle_row]:tag('td'):cssText(style.path_bottom)
self.rows[middle_row+1]:tag('td'):cssText(style.path_top)
end
Line 293 ⟶ 285:
-- score_results: risultato degli scores individuali (1: vinto dal primo team, 2 vinto dal secondo, 3 pari)
===============================================================================]]
function TeamBracket:renderTeam(team_name, team_number, row, show_seed, top, winner, score_results, is_bye)
self:addGap(row, self.current_col, self.current_width, 'rt')
self:addGap(row+1, self.current_col, self.current_width, 'rt')
-- seed cell
local pos = (top and 1) or 2
local seedArg = self:getTeamArg(self.current_round, 'seed', team_number)
Line 342 ⟶ 333:
if score_results[i] == pos then scoreCell:css(style.winner[1], style.winner[2]) end
end
end
Line 351 ⟶ 342:
function TeamBracket:renderMatch(match_number, row_base)
local function getTeams(team_number1, team_number2)
local team_name1 = self:getTeamArg(self.current_round, 'team', team_number1)
local team_name2 = self:getTeamArg(self.current_round, 'team', team_number2)
if team_name1 == 'bye' or team_name2 == 'bye' or not (team_name1 and team_name2) then
self.not_draw_top = false
return '', '', true
end
return team_name1, team_name2, false
end
local team_number2 = match_number * 2
local team_number1 = team_number2 - 1
local team_name1, team_name2, is_bye =
if is_bye then
if self.render_match[self.current_round][match_number] then
self:addGap(
end
self.rows[row_base]:tag('td')
:attr('rowspan', '2')
:attr('colspan',
:cssText(style.path_bottom)
--:
:css('background-color', '#ADD8E6')
self.rows[row_base+2]:tag('td')
:attr('rowspan', '2')
:attr('colspan', self.current_width +1)
:cssText(style.path_top)
--:wikitext(match_number)
:css('background-color', '#ADD8E6')
return row_base
end
return nil
end
local showSeed = false
local winner, score_results = 0, {}
if
local seedArg2 = self:getTeamArg(self.current_round, 'seed', team_number2)
local showSeed = self.showSeeds
or (seedArg1 and seedArg1 == '-')
or (seedArg2 and seedArg2 == '-')
if self.bold_winner then
winner, score_results = self:getWinner(team_number1)
end
end
self:renderTeam(team_name1, team_number1, row_base, showSeed, true, winner, score_results, is_bye)
self:renderTeam(team_name2, team_number2, row_base+2, showSeed, false, winner, score_results, is_bye)
return row_base
end
Line 461 ⟶ 472:
group_number = group_number + 1
end
self:addPath(match1, match2, gap
row_base = row_base + 2 * gap + 8
end
|