commit
77cff5e30c
@ -7,7 +7,7 @@ tourCardTemplate = {
|
||||
attributes = {
|
||||
id = "tourCard",
|
||||
height = 195,
|
||||
width = 310,
|
||||
width = 270,
|
||||
rotation = "0 0 0",
|
||||
position = "0 300 30",
|
||||
showAnimation = "FadeIn",
|
||||
@ -18,10 +18,23 @@ tourCardTemplate = {
|
||||
{
|
||||
tag = "Image",
|
||||
attributes = {
|
||||
id = "tourNarratorImage",
|
||||
id = "tourNarratorImageLeft",
|
||||
height=75,
|
||||
width=50,
|
||||
rectAlignment="UpperLeft"
|
||||
rectAlignment="UpperLeft",
|
||||
offsetXY = "-65 0",
|
||||
-- Image will be set when the card is updated
|
||||
}
|
||||
},
|
||||
{
|
||||
tag = "Image",
|
||||
attributes = {
|
||||
id = "tourNarratorImageRight",
|
||||
active = false,
|
||||
height=75,
|
||||
width=50,
|
||||
rectAlignment="UpperRight",
|
||||
offsetXY = "65 0"
|
||||
-- Image will be set when the card is updated
|
||||
}
|
||||
},
|
||||
@ -30,8 +43,8 @@ tourCardTemplate = {
|
||||
attributes = {
|
||||
color = "#F5F5DC",
|
||||
height = 195,
|
||||
width = 250,
|
||||
rectAlignment = "UpperRight"
|
||||
width = 270,
|
||||
rectAlignment = "MiddleCenter"
|
||||
},
|
||||
children = {
|
||||
{
|
||||
@ -70,9 +83,9 @@ tourCardTemplate = {
|
||||
height = 30,
|
||||
width = 50,
|
||||
color = "#FF0000",
|
||||
rectAlignment = "LowerRight",
|
||||
offsetXY = "-195 5",
|
||||
rectAlignment = "LowerLeft",
|
||||
offsetXY = "5 5",
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ do
|
||||
|
||||
-- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended
|
||||
local CARD_ID = "tourCard"
|
||||
local NARRATOR_ID = "tourNarratorImage"
|
||||
local LEFT_NARRATOR_ID = "tourNarratorImageLeft"
|
||||
local RIGHT_NARRATOR_ID = "tourNarratorImageRight"
|
||||
local TEXT_ID = "tourText"
|
||||
local NEXT_BUTTON_ID = "tourNext"
|
||||
local STOP_BUTTON_ID = "tourStop"
|
||||
@ -19,6 +20,19 @@ do
|
||||
z = 0,
|
||||
}
|
||||
|
||||
-- Global 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",
|
||||
northwest = "-600 300 0",
|
||||
northeast = "600 300 0",
|
||||
southwest = "-600 -300 0",
|
||||
southeast = "600 -300 0"
|
||||
}
|
||||
|
||||
-- Tracks the current state of the tours. Keyed by player color to keep each player's tour
|
||||
-- separate, will hold the camera hook and current card.
|
||||
local tourState = { }
|
||||
@ -84,10 +98,21 @@ do
|
||||
hook.setPositionSmooth(CAMERA_HOME, false, false)
|
||||
local delay = 0.5
|
||||
local cardIndex = tourState[playerColor].currentCardIndex
|
||||
local lookPos
|
||||
if TOUR_SCRIPT[cardIndex].showObj ~= nil then
|
||||
local lookAtObj = getObjectFromGUID(TOUR_SCRIPT[cardIndex].showObj)
|
||||
lookPos = lookAtObj.getPosition()
|
||||
lookPos.y = TOUR_SCRIPT[cardIndex].distanceFromObj or 0
|
||||
-- Since camera isn't directly above the hook, changing the Y affects the visual position of
|
||||
-- whatever object we're trying to look at. This is an approximation, but close enough to
|
||||
-- keep the object more centered
|
||||
lookPos.x = lookPos.x - lookPos.y / 2
|
||||
elseif TOUR_SCRIPT[cardIndex].showPos ~= nil then
|
||||
lookPos = TOUR_SCRIPT[cardIndex].showPos
|
||||
end
|
||||
if lookPos ~= nil then
|
||||
Wait.time(function()
|
||||
local lookAtObj = getObjectFromGUID(TOUR_SCRIPT[cardIndex].showObj)
|
||||
hook.setPositionSmooth(lookAtObj.getPosition(), false, false)
|
||||
hook.setPositionSmooth(lookPos, false, false)
|
||||
end, delay)
|
||||
delay = delay + 0.5
|
||||
end
|
||||
@ -121,8 +146,22 @@ do
|
||||
---@param playerColor Player color to update card for
|
||||
internal.updateCardDisplay = function(playerColor)
|
||||
local index = tourState[playerColor].currentCardIndex
|
||||
Global.UI.setAttribute(internal.getUiId(NARRATOR_ID, playerColor), "image", TOUR_SCRIPT[index].narrator)
|
||||
Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), "image", TOUR_SCRIPT[index].narrator)
|
||||
Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), "image", 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])
|
||||
|
||||
-- Adjust images so the narrator is on the left or right, as defined by the card
|
||||
if TOUR_SCRIPT[index].speakerSide == "right" then
|
||||
Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), "active", false)
|
||||
Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), "active", true)
|
||||
Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), "rotation", "0 180 0")
|
||||
else
|
||||
Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), "active", true)
|
||||
Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), "active", false)
|
||||
Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), "rotation", "0 0 0")
|
||||
end
|
||||
end
|
||||
|
||||
-- Creates a small, transparent object which the camera will be attached to in order to move the
|
||||
@ -179,19 +218,34 @@ do
|
||||
return
|
||||
end
|
||||
tourCardTemplate.attributes.id = internal.getUiId(CARD_ID, playerColor)
|
||||
tourCardTemplate.attributes.visibility = playerColor
|
||||
tourCardTemplate.children[1].attributes.id = internal.getUiId(NARRATOR_ID, playerColor)
|
||||
tourCardTemplate.children[2].children[1].attributes.id = internal.getUiId(TEXT_ID, playerColor)
|
||||
tourCardTemplate.children[3].attributes.id = internal.getUiId(NEXT_BUTTON_ID, playerColor)
|
||||
tourCardTemplate.children[4].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor)
|
||||
tourCardTemplate.children[3].attributes.onClick = self.getGUID().."/nextCard"
|
||||
tourCardTemplate.children[4].attributes.onClick = self.getGUID().."/stopTour"
|
||||
tourCardTemplate.children[1].attributes.id = internal.getUiId(LEFT_NARRATOR_ID, playerColor)
|
||||
tourCardTemplate.children[2].attributes.id = internal.getUiId(RIGHT_NARRATOR_ID, playerColor)
|
||||
tourCardTemplate.children[3].children[1].attributes.id = internal.getUiId(TEXT_ID, playerColor)
|
||||
tourCardTemplate.children[4].attributes.id = internal.getUiId(NEXT_BUTTON_ID, playerColor)
|
||||
tourCardTemplate.children[4].attributes.onClick = self.getGUID().."/nextCard"
|
||||
tourCardTemplate.children[5].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor)
|
||||
tourCardTemplate.children[5].attributes.onClick = self.getGUID().."/stopTour"
|
||||
internal.setDeepVisibility(tourCardTemplate, playerColor)
|
||||
|
||||
local globalXml = Global.UI.getXmlTable()
|
||||
table.insert(globalXml, tourCardTemplate)
|
||||
Global.UI.setXmlTable(globalXml)
|
||||
end
|
||||
|
||||
-- Panels don't cause their children to inherit their visibility value, so this recurses down the
|
||||
-- XML table to set all children to the same visibility.
|
||||
---@param xmlUi Table. Lua table describing the XML
|
||||
---@param playerColor String. String color of the player to make this visible for
|
||||
internal.setDeepVisibility = function(xmlUi, playerColor)
|
||||
xmlUi.attributes.visibility = "" .. playerColor
|
||||
log(xmlUi.attributes.id)
|
||||
if xmlUi.children ~= nil then
|
||||
for _, child in ipairs(xmlUi.children) do
|
||||
internal.setDeepVisibility(child, playerColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
internal.getUiId = function(baseId, playerColor)
|
||||
return baseId .. "_" .. playerColor
|
||||
end
|
||||
|
@ -3,18 +3,28 @@
|
||||
TOUR_SCRIPT = {
|
||||
{
|
||||
narrator = "Roland",
|
||||
text = "Despite my best efforts, looks like you found us. You may live to regret that.\n\nAs long as you're here though we might as well show you around. Ready to get started?",
|
||||
text = "Despite my best efforts, looks like you found us. You may live to regret that. As long as you're here though we might as well show you around.\n\nUse the arrow to move forrward, and if the horrors get to be too much you can quit whenever you like. Ready to get started?",
|
||||
position = "center"
|
||||
},
|
||||
{
|
||||
narrator = "Mandy",
|
||||
text = "If you're going to survive this, you'll need a deck. If it's safely hidden away on ArkhamDB you can load it here.",
|
||||
text = "To survive this, you'll need a deck. If it's safely hidden away on ArkhamDB I can look it up for you, and even find the newest version from the ID.",
|
||||
showObj = "a28140",
|
||||
showDist = 30
|
||||
distanceFromObj = -10,
|
||||
position = "west",
|
||||
speakerSide = "right"
|
||||
},
|
||||
{
|
||||
narrator = "Daniela",
|
||||
text = "If you're like me and prefer the hands-on approach, you can build a deck yourself.\n\nThese containers have all the Level 0 cards for each class. Once you've had a run-in with the horrors lurking out there, you can find higher level cards to the right.",
|
||||
showObj = "7e47e1",
|
||||
showDist = 40
|
||||
distanceFromObj = -10,
|
||||
position = "center",
|
||||
},
|
||||
{
|
||||
narrator = "Daniela",
|
||||
text = "This is a position test.",
|
||||
showPos = { x = -40.14, y = -10, z = 4.19 },
|
||||
position = "south",
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user