Updates slot editing
This commit is contained in:
parent
d898676b6a
commit
c76be365c4
@ -1098,9 +1098,8 @@ end
|
||||
-- instruct Global to update this mat's hand visibility
|
||||
function onClick_visibilitySelect(player)
|
||||
if player.color == playerColor then
|
||||
printToColor(
|
||||
"This is meant to be clicked by other players to be able to see your hand (primarily for multi-handed gameplay). It won't do anything for you.",
|
||||
playerColor)
|
||||
printToColor("This is meant to be clicked by other players to be able to see your hand " ..
|
||||
"(primarily for multi-handed gameplay). It won't do anything for you.", playerColor)
|
||||
return
|
||||
end
|
||||
|
||||
@ -1108,19 +1107,26 @@ function onClick_visibilitySelect(player)
|
||||
end
|
||||
|
||||
-- changes the UI state and the internal variable for the togglebuttons
|
||||
function onClick_toggleOption(player, _, id)
|
||||
function onClick_toggleOption(player, clickType, id)
|
||||
updateMessageColor(player.color)
|
||||
|
||||
local state = optionPanelData[id]
|
||||
local newState = not state
|
||||
applyOptionPanelChange(id, newState, player.color)
|
||||
applyOptionPanelChange(id, newState, clickType)
|
||||
self.UI.setAttribute(id, "image", newState and "option_on" or "option_off")
|
||||
end
|
||||
|
||||
function applyOptionPanelChange(id, state, clickedByColor)
|
||||
function applyOptionPanelChange(id, state, clickType)
|
||||
optionPanelData[id] = state
|
||||
updateSave()
|
||||
|
||||
if id == "slotEditing" then
|
||||
toggleSlotEditing(_, clickedByColor)
|
||||
if clickType == "-2" then -- right-clicked
|
||||
resetSlotSymbols()
|
||||
elseif clickType == "-3" then -- middle-clicked
|
||||
resetSlotSymbols(true)
|
||||
else
|
||||
toggleSlotEditing()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1139,15 +1145,7 @@ function updateSlotSymbols()
|
||||
end
|
||||
|
||||
-- toggle the "slot editing mode"
|
||||
function toggleSlotEditing(_, clickedByColor, isRightClick)
|
||||
if isRightClick then
|
||||
resetSlotSymbols()
|
||||
return
|
||||
end
|
||||
|
||||
updateMessageColor(clickedByColor)
|
||||
|
||||
-- toggle internal variable
|
||||
function toggleSlotEditing()
|
||||
currentlyEditingSlots = not currentlyEditingSlots
|
||||
updateSlotSymbols()
|
||||
|
||||
@ -1188,11 +1186,16 @@ function getSlotRotation(slotName)
|
||||
end
|
||||
|
||||
-- reset the slot symbols by making a deep copy of the default data and redrawing
|
||||
function resetSlotSymbols()
|
||||
---@param empty? boolean If true, will set the slot symbols to "any" (empty) instead of the defaults
|
||||
function resetSlotSymbols(empty)
|
||||
slotData = {}
|
||||
for _, slotName in ipairs(defaultSlotData) do
|
||||
if empty then
|
||||
table.insert(slotData, "any")
|
||||
else
|
||||
table.insert(slotData, slotName)
|
||||
end
|
||||
end
|
||||
updateSave()
|
||||
updateSlotSymbols()
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user