-
Notifications
You must be signed in to change notification settings - Fork 0
/
Custom Tile.848878.ttslua
167 lines (162 loc) · 4.54 KB
/
Custom Tile.848878.ttslua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
allPlayersList = {
"Blue",
"Teal",
"Green",
"Yellow",
"Orange",
"Red",
"Brown",
"White",
"Pink",
"Purple"
}
defaultControls = {
{
handler = "noop",
label = "Scenarios",
position = {0.0,0.2,-0.5},
scale = {0.25,1.0, 0.25},
width = 3000,
height = 300,
font_size = 250,
bgColor = { 0.3, 0.3, 0.3 },
fgColor = { 0.4, 0.7, 0.4 },
tooltip = ""
},
{
handler = "noop",
label = "Select a scenario...",
position = {0.0,0.2,-0.375},
scale = {0.25,1.0, 0.25},
width = 3000,
height = 200,
font_size = 150,
bgColor = { 0.3, 0.3, 0.3 },
fgColor = { 0.3, 0.5, 0.3 },
tooltip = "Choose a scenario below for setup"
},
{
handler = "closeScenarioScreen",
label = "Close Setup",
position = {0.0,0.2,0.9},
scale = {0.25,1.0, 0.25},
width = 900,
height = 300,
font_size = 150,
bgColor = { 0.3, 0.3, 0.3 },
fgColor = { 0.8, 0.3, 0.3 },
tooltip = "Close setup options"
}
}
-- don't do anything
function noop()
end
function onScenario_1()
chooseScenario(1)
end
function onScenario_2()
chooseScenario(2)
end
function onScenario_3()
chooseScenario(3)
end
function onScenario_4()
chooseScenario(4)
end
function onScenario_5()
chooseScenario(5)
end
function onScenario_6()
chooseScenario(6)
end
function chooseScenario(num)
print("Choosing scenario:"..tostring(num))
Global.call("SelectScenario",num)
closeScenarioScreen()
end
function closeScenarioScreen()
self.setInvisibleTo(allPlayersList)
end
-- create buttons
function createControls()
for i, data in ipairs(defaultControls) do
self.createButton({
click_function = data.handler,
function_owner = self,
label = data.label,
position = data.position,
scale = data.scale,
width = data.width,
height = data.height,
font_size = data.font_size,
color = data.bgColor,
font_color = data.fgColor,
tooltip = data.tooltip,
})
end
local inx = 1
local basepos = {0.0, 0.2, 0.0 }
local bgColor = { 0.3, 0.3, 0.3 }
local fgColor = { 0.4, 0.7, 0.4 }
local startZ = -0.45
scenTable = Global.getTable("g_ScenarioData")
for i,scen in ipairs(scenTable) do
local fct = "onScenario_"..tostring(inx)
local pos = basepos
pos[1] = -0.4
pos[3] = startZ + (inx * 0.2)
self.createButton({
click_function = fct,
function_owner = self,
label = scen.Name,
position = pos,
scale = {0.25, 1, 0.25},
width = 1500,
height = 300,
font_size = 100,
color = bgColor,
font_color = fgColor,
tooltip = scen.Name
})
pos[1] = 0.25
yearRange = "From "..tostring(scen.StartYear).." to "..tostring(scen.EndYear)
self.createButton({
click_function = fct,
function_owner = self,
label = yearRange,
position = pos,
scale = {0.25, 1, 0.25},
width = 900,
height = 300,
font_size = 100,
color = bgColor,
font_color = fgColor,
tooltip = scen.Name
})
pos[1] = 0.65
optFolks = scen.OptPlayers
self.createButton({
click_function = fct,
function_owner = self,
label = optFolks,
position = pos,
scale = {0.25, 1, 0.25},
width = 500,
height = 300,
font_size = 100,
color = bgColor,
font_color = fgColor,
tooltip = "Optimum # of players"
})
inx = inx + 1
end
end
-- onLoad
function onLoad(save_state)
-- build the choices for scenarios
createControls()
-- glob = getAllObjects()
-- for i,obj in ipairs(glob) do
-- print(tostring(obj))
-- end
end