removing loop from button creation

This commit is contained in:
Chr1Z93 2023-01-06 10:36:57 +01:00
parent 9bf8f00399
commit 9b6722aff3

View File

@ -8,7 +8,7 @@ local drawDeckPosition
local quickParameters = {} local quickParameters = {}
quickParameters.function_owner = self quickParameters.function_owner = self
quickParameters.font_size = 150 quickParameters.font_size = 165
quickParameters.width = 275 quickParameters.width = 275
quickParameters.height = 275 quickParameters.height = 275
quickParameters.color = "White" quickParameters.color = "White"
@ -51,23 +51,26 @@ function normalView()
self.createButton(buttonParameters) self.createButton(buttonParameters)
-- create buttons to search 3, 6 or 9 cards -- create buttons to search 3, 6 or 9 cards
for i = 3, 9, 3 do quickParameters.click_function = "search3"
_G["search" .. i] = function(_, playerColor) quickParameters.label = "3"
_G["startSearch"](playerColor, i) quickParameters.position = { -0.65, 0.11, -0.65 }
self.createButton(quickParameters)
quickParameters.click_function = "search6"
quickParameters.label = "6"
quickParameters.position = { 0, 0.11, -0.65 }
self.createButton(quickParameters)
quickParameters.click_function = "search9"
quickParameters.label = "9"
quickParameters.position = { 0.65, 0.11, -0.65 }
self.createButton(quickParameters)
end end
self.createButton({ -- click functions
function_owner = self, function search3(_, playerColor) startSearch(playerColor, 3) end
click_function = "search" .. i, function search6(_, playerColor) startSearch(playerColor, 6) end
label = i, function search9(_, playerColor) startSearch(playerColor, 9) end
font_size = 165,
width = 275,
height = 275,
color = "White",
position = { (i - 6) / 4.5, 0.11, -0.65 }
})
end
end
-- view during a search with "done" buttons -- view during a search with "done" buttons
function searchView() function searchView()