From 56483aefd7230fbf6a87fed06ac6619d2a0f1b04 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Tue, 19 Nov 2024 23:01:16 +0100 Subject: [PATCH] updated token stack size display --- src/playercards/CardsThatSealTokens.ttslua | 8 +++++++- src/playermat/Playermat.ttslua | 17 +++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index 74eaf35b..4dd1bb9b 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -383,6 +383,12 @@ function updateStackSize() local topToken = getObjectFromGUID(sealedTokens[#sealedTokens]) if topToken == nil then return end + -- handling for two-digit numbers + local fontsize = 380 + if #sealedTokens > 9 then + fontsize = 360 + end + topToken.UI.setXmlTable({ { tag = "Panel", @@ -397,7 +403,7 @@ function updateStackSize() children = { tag = "Text", attributes = { - fontSize = "380", + fontSize = fontsize, font = "font_teutonic-arkham", color = "#ffffff", outline = "#000000", diff --git a/src/playermat/Playermat.ttslua b/src/playermat/Playermat.ttslua index e7619a1e..b5145252 100644 --- a/src/playermat/Playermat.ttslua +++ b/src/playermat/Playermat.ttslua @@ -46,7 +46,7 @@ local collisionEnabled = false local currentlyEditingSlots = false -- for stopping multiple collisions of the same object -local collisionTable = {} +local collisionTable = {} -- x-Values for discard buttons local DISCARD_BUTTON_X_START = -1.365 @@ -308,11 +308,11 @@ end ---@param id number Index of the discard button (from left to right, must be unique) function makeDiscardButton(id) local xValue = DISCARD_BUTTON_X_START + (id - 1) * DISCARD_BUTTON_X_OFFSET - local position = { xValue, 0.1, -0.94 } - local searchPosition = { -position[1], position[2], position[3] + 0.32 } + local position = Vector(xValue, 0.1, -0.94) + local searchPosition = Vector(-position[1], 1, position[3] + 0.32) local handlerName = 'handler' .. id self.setVar(handlerName, function() - local cardSizeSearch = { 2, 1, 3.2 } + local cardSizeSearch = Vector(2, 2, 3.2) local globalSearchPosition = self.positionToWorld(searchPosition) local searchResult = searchArea(globalSearchPosition, cardSizeSearch) 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 function makeDrawAreaButton() - local position = { -1.365, 0.1, -0.94 } self.createButton({ label = "Discard / ➜", click_function = "discardOrMove", tooltip = "Right-click to move to threat area", function_owner = self, - position = position, + position = { -1.365, 0.1, -0.94 }, scale = { 0.12, 0.12, 0.12 }, width = 1190, height = 350, @@ -346,8 +345,8 @@ function makeDrawAreaButton() end function discardOrMove(_, playerColor, isRightClick) - local searchPosition = { 1.365, 0.1, -0.62 } - local cardSizeSearch = { 2, 1, 3.2 } + local searchPosition = Vector(1.365, 1, -0.62) + local cardSizeSearch = Vector(2, 2, 3.2) local globalSearchPosition = self.positionToWorld(searchPosition) local searchResult = searchArea(globalSearchPosition, cardSizeSearch) @@ -1296,12 +1295,10 @@ function onCollisionEnter(collisionInfo) -- this is mostly for helpers like Stella and Kohaku spawnTokensOrShowHelper(object) end - elseif inArea(localCardPos, DECK_DISCARD_AREA) then GlobalApi.handleTokenDetaching(object) tokenSpawnTrackerApi.resetTokensSpawned(object) GlobalApi.removeTokensFromObject(object, matColor) - elseif object.is_face_down == false then -- main uses spawning if inArea(localCardPos, MAIN_PLAY_AREA) and (md.type == "Asset" or md.type == "Event") then