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,24 +51,27 @@ 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 }
end self.createButton(quickParameters)
self.createButton({ quickParameters.click_function = "search6"
function_owner = self, quickParameters.label = "6"
click_function = "search" .. i, quickParameters.position = { 0, 0.11, -0.65 }
label = i, self.createButton(quickParameters)
font_size = 165,
width = 275, quickParameters.click_function = "search9"
height = 275, quickParameters.label = "9"
color = "White", quickParameters.position = { 0.65, 0.11, -0.65 }
position = { (i - 6) / 4.5, 0.11, -0.65 } self.createButton(quickParameters)
})
end
end 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 -- view during a search with "done" buttons
function searchView() function searchView()
self.clearButtons() self.clearButtons()