adapted tour and controls
This commit is contained in:
parent
c20d747921
commit
b99f018891
@ -5,7 +5,7 @@ do
|
||||
local internal = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
-- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended
|
||||
-- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended
|
||||
local CARD_ID = "tourCard"
|
||||
local LEFT_NARRATOR_ID = "tourNarratorImageLeft"
|
||||
local RIGHT_NARRATOR_ID = "tourNarratorImageRight"
|
||||
@ -14,7 +14,7 @@ do
|
||||
local NEXT_BUTTON_ID = "tourNext"
|
||||
local STOP_BUTTON_ID = "tourStop"
|
||||
|
||||
-- Table centerpoint for the camera hook object. Camera handling is a bit erratic so it doesn't
|
||||
-- Table centerpoint for the camera hook object. Camera handling is a bit erratic so it doesn't
|
||||
-- always land right where you think it's going to, but it's close
|
||||
local HOOK_CAMERA_HOME = {
|
||||
x = -30.2,
|
||||
@ -22,7 +22,7 @@ do
|
||||
z = 0,
|
||||
}
|
||||
|
||||
-- Default (0) position for the camera, as defined in the mod. If we don't recreate this position
|
||||
-- Default (0) position for the camera, as defined in the mod. If we don't recreate this position
|
||||
-- EXACTLY when exiting the tour then camera controls get weird
|
||||
local DEFAULT_CAMERA_POS = {
|
||||
position = { x = -22.26, y = -2.5, z = 5.26 },
|
||||
@ -45,16 +45,15 @@ do
|
||||
northeast = "600 300 0",
|
||||
southwest = "-600 -300 0",
|
||||
|
||||
-- Used by the Diana and Wini cards referencing the bottom-right global controls, moved a little
|
||||
-- closer to them
|
||||
southeast = "730 -365 0"
|
||||
-- Used by the cards referencing the bottom-right panel, moved a little closer to them
|
||||
southeast = "675 -365 0"
|
||||
}
|
||||
|
||||
-- Tracks the current state of the tours. Keyed by player color to keep each player's tour
|
||||
-- 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 = {}
|
||||
|
||||
-- Kicks off the tour by initializing the card and camera hook. A callback on the hook creation
|
||||
-- Kicks off the tour by initializing the card and camera hook. A callback on the hook creation
|
||||
-- will then show the first card.
|
||||
---@param playerColor string Player color to start the tour for
|
||||
TourManager.startTour = function(playerColor)
|
||||
@ -62,12 +61,12 @@ do
|
||||
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
|
||||
-- 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
|
||||
Player[playerColor].setCameraMode("ThirdPerson")
|
||||
Player[playerColor].lookAt(DEFAULT_CAMERA_POS)
|
||||
|
||||
-- Initial camera rotation is painfully slow. White and Orange players are likely oriented
|
||||
-- Initial camera rotation is painfully slow. White and Orange players are likely oriented
|
||||
-- correctly, but need a longer start delay for Green and Red
|
||||
local delay = 0.5
|
||||
if playerColor ~= "White" and playerColor ~= "Orange" then
|
||||
@ -81,7 +80,7 @@ do
|
||||
end, delay)
|
||||
end
|
||||
|
||||
-- Shows the next card in the tour script. This method is exposed (rather than being part of
|
||||
-- Shows the next card in the tour script. This method is exposed (rather than being part of
|
||||
-- internal) because the XMLUI callbacks expect the method to be on the object directly.
|
||||
---@param player tts__Player object to show the next card for, provided by XMLUI callback
|
||||
function nextCard(player)
|
||||
@ -96,7 +95,7 @@ do
|
||||
end, 0.3)
|
||||
end
|
||||
|
||||
-- Ends the tour and cleans up the camera. This method is exposed (rather than being part of
|
||||
-- Ends the tour and cleans up the camera. This method is exposed (rather than being part of
|
||||
-- internal) because the XMLUI callbacks expect the method to be on the object directly.
|
||||
---@param player tts__Player object to end the tour for, provided by XMLUI callback
|
||||
function stopTour(player)
|
||||
@ -133,7 +132,7 @@ do
|
||||
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
|
||||
-- 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
|
||||
@ -148,7 +147,7 @@ do
|
||||
Wait.time(function() Global.UI.show(internal.getUiId(CARD_ID, playerColor)) end, delay)
|
||||
end
|
||||
|
||||
-- Hides the current card being shown to a player. This can be in preparation for showing the
|
||||
-- Hides the current card being shown to a player. This can be in preparation for showing the
|
||||
-- next card, or ending the tour.
|
||||
---@param playerColor string Player color to hide the current card for
|
||||
internal.hideCard = function(playerColor)
|
||||
@ -156,7 +155,7 @@ do
|
||||
end
|
||||
|
||||
-- Cleans up all the various resources associated with the tour, and (hopefully) resets the
|
||||
-- camera to the default position. Camera handling is erratic, the final card in the script
|
||||
-- camera to the default position. Camera handling is erratic, the final card in the script
|
||||
-- should include instructions for the player to fix it.
|
||||
---@param playerColor string Player color to clean up
|
||||
internal.finalizeTour = function(playerColor)
|
||||
@ -198,10 +197,9 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- Creates a small, transparent object which the camera will be attached to in order to move the
|
||||
-- user's view around the table. This should be called only at the beginning of the tour. Once
|
||||
-- creation is complete the user's camera will be attached to the hook and the first card will be
|
||||
-- shown.
|
||||
-- Creates a small, transparent object which the camera will be attached to in order to move the user's view
|
||||
-- around the table. This should be called only at the beginning of the tour. Once creation is complete
|
||||
-- the user's camera will be attached to the hook and the first card will be shown.
|
||||
---@param playerColor string Player color to create the hook for
|
||||
internal.createCameraHook = function(playerColor)
|
||||
local hookData = {
|
||||
@ -230,7 +228,7 @@ do
|
||||
spawnObjectData({ data = hookData, callback_function = internal.onHookCreated })
|
||||
end
|
||||
|
||||
-- Callback for creation of the camera hook object. Will attach the camera and show the current
|
||||
-- Callback for creation of the camera hook object. Will attach the camera and show the current
|
||||
-- (presumably first) card.
|
||||
---@param hook tts__Object Created object
|
||||
internal.onHookCreated = function(hook)
|
||||
@ -243,7 +241,7 @@ do
|
||||
internal.showCurrentCard(playerColor)
|
||||
end
|
||||
|
||||
-- Creates an XMLUI entry in Global for a player-specific tour card. Dynamically creating this
|
||||
-- Creates an XMLUI entry in Global for a player-specific tour card. Dynamically creating this
|
||||
-- is somewhat complex, but ensures we can properly handle any player color.
|
||||
---@param playerColor string Player color to create the card for
|
||||
internal.createTourCard = function(playerColor)
|
||||
|
@ -5,15 +5,15 @@
|
||||
color="clear"/>
|
||||
</Defaults>
|
||||
|
||||
<!-- Buttons at the bottom right (height: n * 37 - 2) -->
|
||||
<!-- Buttons at the bottom right (height: n * width + spacing) -->
|
||||
<VerticalLayout visibility="Admin"
|
||||
color="#000000"
|
||||
outlineSize="1 1"
|
||||
outline="#303030"
|
||||
rectAlignment="LowerRight"
|
||||
width="35"
|
||||
height="72"
|
||||
offsetXY="-1 120"
|
||||
width="38"
|
||||
height="78"
|
||||
offsetXY="-1 123"
|
||||
spacing="2">
|
||||
<Button class="navbar"
|
||||
icon="devourer"
|
||||
@ -31,8 +31,8 @@
|
||||
outlineSize="1 1"
|
||||
outline="#303030"
|
||||
rectAlignment="LowerRight"
|
||||
width="35"
|
||||
height="35"
|
||||
width="38"
|
||||
height="38"
|
||||
offsetXY="-1 85">
|
||||
<Button class="navbar"
|
||||
icon="NavigationOverlayIcon"
|
||||
|
Loading…
Reference in New Issue
Block a user