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