Merge pull request #1008 from argonui/discard-buttons
Updated token stack size display and discard button search size
This commit is contained in:
commit
d364767626
@ -390,6 +390,12 @@ function updateStackSize()
|
|||||||
local topToken = getObjectFromGUID(sealedTokens[#sealedTokens])
|
local topToken = getObjectFromGUID(sealedTokens[#sealedTokens])
|
||||||
if topToken == nil then return end
|
if topToken == nil then return end
|
||||||
|
|
||||||
|
-- handling for two-digit numbers
|
||||||
|
local fontsize = 380
|
||||||
|
if #sealedTokens > 9 then
|
||||||
|
fontsize = 360
|
||||||
|
end
|
||||||
|
|
||||||
topToken.UI.setXmlTable({
|
topToken.UI.setXmlTable({
|
||||||
{
|
{
|
||||||
tag = "Panel",
|
tag = "Panel",
|
||||||
@ -404,7 +410,7 @@ function updateStackSize()
|
|||||||
children = {
|
children = {
|
||||||
tag = "Text",
|
tag = "Text",
|
||||||
attributes = {
|
attributes = {
|
||||||
fontSize = "380",
|
fontSize = fontsize,
|
||||||
font = "font_teutonic-arkham",
|
font = "font_teutonic-arkham",
|
||||||
color = "#ffffff",
|
color = "#ffffff",
|
||||||
outline = "#000000",
|
outline = "#000000",
|
||||||
|
@ -308,11 +308,11 @@ end
|
|||||||
---@param id number Index of the discard button (from left to right, must be unique)
|
---@param id number Index of the discard button (from left to right, must be unique)
|
||||||
function makeDiscardButton(id)
|
function makeDiscardButton(id)
|
||||||
local xValue = DISCARD_BUTTON_X_START + (id - 1) * DISCARD_BUTTON_X_OFFSET
|
local xValue = DISCARD_BUTTON_X_START + (id - 1) * DISCARD_BUTTON_X_OFFSET
|
||||||
local position = { xValue, 0.1, -0.94 }
|
local position = Vector(xValue, 0.1, -0.94)
|
||||||
local searchPosition = { -position[1], position[2], position[3] + 0.32 }
|
local searchPosition = Vector(-position[1], 1, position[3] + 0.32)
|
||||||
local handlerName = 'handler' .. id
|
local handlerName = 'handler' .. id
|
||||||
self.setVar(handlerName, function()
|
self.setVar(handlerName, function()
|
||||||
local cardSizeSearch = { 2, 1, 3.2 }
|
local cardSizeSearch = Vector(2, 2, 3.2)
|
||||||
local globalSearchPosition = self.positionToWorld(searchPosition)
|
local globalSearchPosition = self.positionToWorld(searchPosition)
|
||||||
local searchResult = searchArea(globalSearchPosition, cardSizeSearch)
|
local searchResult = searchArea(globalSearchPosition, cardSizeSearch)
|
||||||
return discardListOfObjects(searchResult)
|
return discardListOfObjects(searchResult)
|
||||||
@ -331,13 +331,12 @@ end
|
|||||||
|
|
||||||
-- build a hybrid button to discard from searchPosition or move a card/deck to empty threat area on right click
|
-- build a hybrid button to discard from searchPosition or move a card/deck to empty threat area on right click
|
||||||
function makeDrawAreaButton()
|
function makeDrawAreaButton()
|
||||||
local position = { -1.365, 0.1, -0.94 }
|
|
||||||
self.createButton({
|
self.createButton({
|
||||||
label = "Discard / ➜",
|
label = "Discard / ➜",
|
||||||
click_function = "discardOrMove",
|
click_function = "discardOrMove",
|
||||||
tooltip = "Right-click to move to threat area",
|
tooltip = "Right-click to move to threat area",
|
||||||
function_owner = self,
|
function_owner = self,
|
||||||
position = position,
|
position = { -1.365, 0.1, -0.94 },
|
||||||
scale = { 0.12, 0.12, 0.12 },
|
scale = { 0.12, 0.12, 0.12 },
|
||||||
width = 1190,
|
width = 1190,
|
||||||
height = 350,
|
height = 350,
|
||||||
@ -346,8 +345,8 @@ function makeDrawAreaButton()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function discardOrMove(_, playerColor, isRightClick)
|
function discardOrMove(_, playerColor, isRightClick)
|
||||||
local searchPosition = { 1.365, 0.1, -0.62 }
|
local searchPosition = Vector(1.365, 1, -0.62)
|
||||||
local cardSizeSearch = { 2, 1, 3.2 }
|
local cardSizeSearch = Vector(2, 2, 3.2)
|
||||||
local globalSearchPosition = self.positionToWorld(searchPosition)
|
local globalSearchPosition = self.positionToWorld(searchPosition)
|
||||||
local searchResult = searchArea(globalSearchPosition, cardSizeSearch)
|
local searchResult = searchArea(globalSearchPosition, cardSizeSearch)
|
||||||
|
|
||||||
@ -1297,12 +1296,10 @@ function onCollisionEnter(collisionInfo)
|
|||||||
-- this is mostly for helpers like Stella and Kohaku
|
-- this is mostly for helpers like Stella and Kohaku
|
||||||
spawnTokensOrShowHelper(object)
|
spawnTokensOrShowHelper(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif inArea(localCardPos, DECK_DISCARD_AREA) then
|
elseif inArea(localCardPos, DECK_DISCARD_AREA) then
|
||||||
GlobalApi.handleTokenDetaching(object)
|
GlobalApi.handleTokenDetaching(object)
|
||||||
tokenSpawnTrackerApi.resetTokensSpawned(object)
|
tokenSpawnTrackerApi.resetTokensSpawned(object)
|
||||||
GlobalApi.removeTokensFromObject(object, matColor)
|
GlobalApi.removeTokensFromObject(object, matColor)
|
||||||
|
|
||||||
elseif object.is_face_down == false then
|
elseif object.is_face_down == false then
|
||||||
-- main uses spawning
|
-- main uses spawning
|
||||||
if inArea(localCardPos, MAIN_PLAY_AREA) and (md.type == "Asset" or md.type == "Event") then
|
if inArea(localCardPos, MAIN_PLAY_AREA) and (md.type == "Asset" or md.type == "Event") then
|
||||||
|
Loading…
Reference in New Issue
Block a user