update color change handling
This commit is contained in:
parent
bad6cf8f95
commit
7ac947e737
@ -1566,6 +1566,12 @@ end
|
|||||||
-- removes a playermat and all related objects from play
|
-- removes a playermat and all related objects from play
|
||||||
---@param matColor string Color of the playermat to remove
|
---@param matColor string Color of the playermat to remove
|
||||||
function removePlayermat(matColor)
|
function removePlayermat(matColor)
|
||||||
|
-- if there's a seated player, move them to grey
|
||||||
|
local handColor = playermatApi.getPlayerColor(matColor)
|
||||||
|
if Player[handColor].seated then
|
||||||
|
Player[handColor].changeColor("Grey")
|
||||||
|
end
|
||||||
|
|
||||||
local matObjects = guidReferenceApi.getObjectsByOwner(matColor)
|
local matObjects = guidReferenceApi.getObjectsByOwner(matColor)
|
||||||
if not matObjects.Playermat then return end
|
if not matObjects.Playermat then return end
|
||||||
|
|
||||||
|
@ -944,33 +944,33 @@ function onClick_handColorSelect(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- show the option dialog for color selection to the player that triggered this
|
-- show the option dialog for color selection to the player that triggered this
|
||||||
player.showOptionsDialog("Select a new color:", colorList, _, function(color)
|
player.showOptionsDialog("Select a new color:", colorList, _, function(newColor)
|
||||||
-- update the color of the hand zone
|
-- update the color of the hand zone
|
||||||
local handZone = ownedObjects.HandZone
|
local handZone = ownedObjects.HandZone
|
||||||
handZone.setValue(color)
|
handZone.setValue(newColor)
|
||||||
|
|
||||||
-- if the seated player clicked this, reseat him to the new color
|
-- update visibility for old and new color
|
||||||
if player.color == playerColor then
|
Global.call("changeWindowVisibilityForColorWrapper", {
|
||||||
navigationOverlayApi.copyVisibility(playerColor, color)
|
color = playerColor,
|
||||||
Player[playerColor].changeColor(color)
|
windowId = "optionPanelMain",
|
||||||
|
owner = self
|
||||||
|
})
|
||||||
|
Global.call("changeWindowVisibilityForColorWrapper", {
|
||||||
|
color = newColor,
|
||||||
|
windowId = "optionPanelMain",
|
||||||
|
owner = self
|
||||||
|
})
|
||||||
|
navigationOverlayApi.copyVisibility(playerColor, newColor)
|
||||||
|
|
||||||
-- update visibility for old and new color
|
-- if there was a seated player, reseat to the new color
|
||||||
Global.call("changeWindowVisibilityForColorWrapper", {
|
if Player[playerColor].seated then
|
||||||
color = playerColor,
|
Player[playerColor].changeColor(newColor)
|
||||||
windowId = "optionPanelMain",
|
|
||||||
owner = self
|
|
||||||
})
|
|
||||||
Global.call("changeWindowVisibilityForColorWrapper", {
|
|
||||||
color = color,
|
|
||||||
windowId = "optionPanelMain",
|
|
||||||
owner = self
|
|
||||||
})
|
|
||||||
else
|
else
|
||||||
printToColor("Updated handcolor for this playermat to " .. color .. ".", player.color)
|
printToColor("Updated handcolor for this playermat to " .. newColor .. ".", player.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update the internal variable
|
-- update the internal variable
|
||||||
playerColor = color
|
playerColor = newColor
|
||||||
updateSave()
|
updateSave()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user