61
61
-- stand alone dialog since it has (2) sprites in another sprite file?
63
63
self.default_button_sound = "selectx.wav"
65
65
-- Close button, in the future different behaviours for different screens though
66
66
--self.first_close = self:addPanel(0, 609, 449):makeButton(0, 0, 26, 26, 1, self.changePage)
67
67
self.second_close = self:addPanel(0, 608, 449):makeButton(0, 0, 26, 26, 1, self.close)
68
68
self:setActive(self.second_close, true)
70
70
-- Change page buttons for the second and third pages
71
71
local --[[persistable:annual_report_change_page]] function change() self:changePage(3) end
72
72
self.second_change = self:addPanel(0, 274, 435):makeButton(0, 0, 91, 42, 3, change)
73
73
self:setActive(self.second_change, true)
75
75
self.third_change = self:addPanel(0, 272, 367):makeButton(0, 0, 91, 42, 3, self.changePage)
76
76
self:setActive(self.third_change, false)
78
78
-- The plaque showed after the player has clicked on a trophy
80
80
plaque[1] = self:addPanel(19, 206, 87)
502
502
function UIAnnualReport:draw(canvas, x, y)
503
503
self.background:draw(canvas, self.x + x, self.y + y)
504
504
UIFullscreen.draw(self, canvas, x, y)
506
506
x, y = self.x + x, self.y + y
507
507
local font = self.stat_font
508
508
local world = self.ui.app.world
510
510
if self.state == 1 then -- Fame screen
511
511
-- Title and column names
512
512
font:draw(canvas, _S.high_score.best_scores, x + 220, y + 104, 200, 0)
513
513
font:draw(canvas, _S.high_score.pos, x + 218, y + 132)
514
514
font:draw(canvas, _S.high_score.player, x + 260, y + 132)
515
515
font:draw(canvas, _S.high_score.score, x + 360, y + 132)
517
517
-- Players and their score
603
603
local dup_value = 0
604
604
for _, player in ipairs(world.hospitals) do
605
605
local name = player.name
608
608
local index, dup_m = getindex(self.money_sort, self.money[name])
609
609
-- index is the returned value of the sorted place for this player.
610
610
-- However there might be many players with the same value, so each iteration a
611
611
-- duplicate has been found, one additional row lower is the right place to be.
612
font:draw(canvas, name:upper(), x + 140,
612
font:draw(canvas, name:upper(), x + 140,
613
613
y + row_y + row_dy*(index-1) + row_dy*(dup_money))
614
font:draw(canvas, self.money[name], x + 240,
614
font:draw(canvas, self.money[name], x + 240,
615
615
y + row_y + row_dy*(index-1) + row_dy*(dup_money), 70, 0, "right")
617
617
-- Highest Salary
618
618
local index, dup_s = getindex(self.salary_sort, self.salary[name])
619
font:draw(canvas, name:upper(), x + 140 + col_x,
619
font:draw(canvas, name:upper(), x + 140 + col_x,
620
620
y + row_y + row_dy*(index-1) + row_dy*(dup_salary))
621
font:draw(canvas, self.salary[name], x + 240 + col_x,
621
font:draw(canvas, self.salary[name], x + 240 + col_x,
622
622
y + row_y + row_dy*(index-1) + row_dy*(dup_salary), 70, 0, "right")
625
625
local index, dup_c = getindex(self.cures_sort, self.cures[name])
626
font:draw(canvas, name:upper(), x + 140,
626
font:draw(canvas, name:upper(), x + 140,
627
627
y + row_y + row_no_y + row_dy*(index-1) + row_dy*(dup_cures))
628
font:draw(canvas, self.cures[name], x + 240,
628
font:draw(canvas, self.cures[name], x + 240,
629
629
y + row_y + row_no_y + row_dy*(index-1) + row_dy*(dup_cures), 70, 0, "right")
632
632
local index, dup_d = getindex(self.deaths_sort, self.deaths[name])
633
font:draw(canvas, name:upper(), x + 140 + col_x,
633
font:draw(canvas, name:upper(), x + 140 + col_x,
634
634
y + row_y + row_no_y + row_dy*(index-1) + row_dy*(dup_deaths))
635
font:draw(canvas, self.deaths[name], x + 240 + col_x,
635
font:draw(canvas, self.deaths[name], x + 240 + col_x,
636
636
y + row_y + row_no_y + row_dy*(index-1) + row_dy*(dup_deaths), 70, 0, "right")
639
639
local index, dup_v = getindex(self.visitors_sort, self.visitors[name])
640
font:draw(canvas, name:upper(), x + 140,
640
font:draw(canvas, name:upper(), x + 140,
641
641
y + row_y + row_no_y*2 + row_dy*(index-1) + row_dy*(dup_visitors))
642
font:draw(canvas, self.visitors[name], x + 240,
642
font:draw(canvas, self.visitors[name], x + 240,
643
643
y + row_y + row_no_y*2 + row_dy*(index-1) + row_dy*(dup_visitors), 70, 0, "right")
646
646
local index, dup_v2 = getindex(self.value_sort, self.value[name])
647
font:draw(canvas, name:upper(), x + 140 + col_x,
647
font:draw(canvas, name:upper(), x + 140 + col_x,
648
648
y + row_y + row_no_y*2 + row_dy*(index-1) + row_dy*(dup_value))
649
font:draw(canvas, self.value[name], x + 240 + col_x,
649
font:draw(canvas, self.value[name], x + 240 + col_x,
650
650
y + row_y + row_no_y*2 + row_dy*(index-1) + row_dy*(dup_value), 70, 0, "right")
652
652
if dup_m > 1 then dup_money = dup_money + 1 else dup_money = 0 end
653
653
if dup_s > 1 then dup_salary = dup_salary + 1 else dup_salary = 0 end
654
654
if dup_c > 1 then dup_cures = dup_cures + 1 else dup_cures = 0 end