updated tour positioning

This commit is contained in:
Chr1Z93 2024-09-19 18:15:04 +02:00
parent b99f018891
commit e7db256d46
2 changed files with 20 additions and 18 deletions

View File

@ -1,4 +1,4 @@
-- Table definition for the tour card layout. This is functionally XMLUI in Lua form, but using
-- Table definition for the tour card layout. This is functionally XMLUI in Lua form, but using
-- this for dynamic creation ensures we can handle any player color without needing 10
-- near-duplicate definitions in Global.xml
@ -8,8 +8,8 @@ tourCardTemplate = {
id = "tourCard",
height = 215,
width = 330,
rotation = "0 0 0",
position = "0 300 30",
anchorMin = "0.3 0.75",
anchorMax = "0.3 0.75",
showAnimation = "FadeIn",
hideAnimation = "FadeOut",
active = false

View File

@ -31,22 +31,23 @@ do
distance = 104
}
-- Global XML coordinates where we can present a card
-- relative XML coordinates where we can present a card
local SCREEN_POSITIONS = {
center = "0 0 0",
north = "0 300 0",
east = "600 0 0",
west = "-600 0 0",
south = "0 -300 0",
-- Center is intentionally slightly above the center
center = "0.5 0.6",
north = "0.5 0.75",
east = "0.75 0.5",
west = "0.25 0.5",
south = "0.5 0.25",
-- Northwest is only used by the Mandy card, move it a little right than standard so it's
-- closer to the importer
northwest = "-500 300 0",
northeast = "600 300 0",
southwest = "-600 -300 0",
northwest = "0.3 0.75",
northeast = "0.75 0.75",
southwest = "0.25 0.25",
-- Used by the cards referencing the bottom-right panel, moved a little closer to them
southeast = "675 -365 0"
southeast = "0.875 0.175"
}
-- Tracks the current state of the tours. Keyed by player color to keep each player's tour
@ -57,9 +58,8 @@ do
-- will then show the first card.
---@param playerColor string Player color to start the tour for
TourManager.startTour = function(playerColor)
tourState[playerColor] = {
currentCardIndex = 1
}
tourState[playerColor] = { currentCardIndex = 1 }
-- Camera gets really screwy when we finalize if we don't start settled in ThirdPerson at the
-- default position before attaching to the hook. Unfortunately there are no callbacks for when
-- the movement is done, but the delay seems to handle it
@ -175,8 +175,10 @@ do
Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), "image", "Inv-" .. TOUR_SCRIPT[index].narrator)
Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), "image", "Inv-" .. TOUR_SCRIPT[index].narrator)
Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), "text", "\"" .. TOUR_SCRIPT[index].text .. "\"")
local cardPos = TOUR_SCRIPT[index].position or "north"
Global.UI.setAttribute(internal.getUiId(CARD_ID, playerColor), "position", SCREEN_POSITIONS[cardPos])
Global.UI.setAttribute(internal.getUiId(CARD_ID, playerColor), "anchorMin", SCREEN_POSITIONS[cardPos])
Global.UI.setAttribute(internal.getUiId(CARD_ID, playerColor), "anchorMax", SCREEN_POSITIONS[cardPos])
Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), "active", index < #TOUR_SCRIPT)
-- Adjust images so the narrator is on the left or right, as defined by the card
@ -247,7 +249,7 @@ do
internal.createTourCard = function(playerColor)
-- Make sure the card doesn't exist before we create a new one
if Global.UI.getAttributes(internal.getUiId(CARD_ID, playerColor)) ~= nil then return end
tourCardTemplate.attributes.id = internal.getUiId(CARD_ID, playerColor)
tourCardTemplate.children[1].attributes.id = internal.getUiId(LEFT_NARRATOR_ID, playerColor)
tourCardTemplate.children[2].attributes.id = internal.getUiId(RIGHT_NARRATOR_ID, playerColor)