- Final round reworked to support map display.

- Removed Final Round host card, since it's a duplicate anyway.
This commit is contained in:
2025-07-10 16:38:24 -04:00
parent 45ed829373
commit 1bb921d8ed
15 changed files with 249 additions and 2481 deletions
@@ -1,13 +1,7 @@
using System.Collections.Generic;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDK3.StringLoading;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
using VRC.Udon.Serialization.OdinSerializer.Utilities;
public enum RoundType
@@ -5,7 +5,6 @@ using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
using VRC.SDKBase;
using VRC.SDK3.Video.Components;
public enum PresentationMedium
@@ -134,7 +133,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void MultipleChoiceInitialisePresentation()
private void InitialiseCluePresentation()
{
HostCardBetweenRoundsInterface Interface;
if (!_CurrentQuestion.ContainsKey("Presentation") ||
@@ -160,13 +159,13 @@ public class GameManagerRound1 : GameManagerBase
DataDictionary Presentation = _CurrentQuestion["Presentation"].DataDictionary;
switch ((PresentationMedium)(int)Presentation["Medium"].Number)
{
case PresentationMedium.VideoClue: MultipleChoiceInitialiseVideoClue(Presentation); break;
case PresentationMedium.VideoMusicClue: MultipleChoiceInitialiseVideoMusicClue(Presentation); break;
case PresentationMedium.ACMECrimenetComputer: MultipleChoiceInitialiseACMECrimenetComputer(Presentation); break;
case PresentationMedium.VideoClue: InitialiseVideoClue(Presentation); break;
case PresentationMedium.VideoMusicClue: InitialiseVideoMusicClue(Presentation); break;
case PresentationMedium.ACMECrimenetComputer: InitialiseACMECrimenetComputer(Presentation); break;
}
}
private void MultipleChoiceInitialiseVideoClue(DataDictionary Presentation)
private void InitialiseVideoClue(DataDictionary Presentation)
{
DataList Videos = Presentation["Videos"].DataList;
if (_QuestionSubstage < Videos.Count)
@@ -186,14 +185,14 @@ public class GameManagerRound1 : GameManagerBase
}
}
private void MultipleChoiceInitialiseVideoMusicClue(DataDictionary Presentation)
private void InitialiseVideoMusicClue(DataDictionary Presentation)
{
// The full presentation is not ready yet, so temporarily treat it as
// a regular video clue.
MultipleChoiceInitialiseVideoClue(Presentation);
InitialiseVideoClue(Presentation);
}
private void MultipleChoiceInitialiseACMECrimenetComputer(DataDictionary Presentation)
private void InitialiseACMECrimenetComputer(DataDictionary Presentation)
{
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
@@ -206,7 +205,7 @@ public class GameManagerRound1 : GameManagerBase
private void MultipleChoiceRevealQuestion()
{
_QuestionSubstage = 0;
_VideoPlayer.InitialiseMapScreen();
_VideoPlayer.ShowSubMap(SubMap.NoLabels);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -241,7 +240,7 @@ public class GameManagerRound1 : GameManagerBase
private void MultipleChoiceRevealChoice1()
{
_VideoPlayer.IncrementMap();
_VideoPlayer.ShowSubMap(SubMap.OneLabel);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -255,7 +254,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void MultipleChoiceRevealChoice2()
{
_VideoPlayer.IncrementMap();
_VideoPlayer.ShowSubMap(SubMap.TwoLabels);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -269,7 +268,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void MultipleChoiceRevealChoice3()
{
_VideoPlayer.IncrementMap();
_VideoPlayer.ShowSubMap(SubMap.ThreeLabels);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -560,13 +559,55 @@ public class GameManagerRound1 : GameManagerBase
private void BeginFinalRound()
{
HostCardFinalRoundInterface Interface =
(HostCardFinalRoundInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = RoundSegmentTypeToString((RoundSegmentType)((int)_CurrentQuestion["Type"].Number)) + " | Showing Map Preview";
Interface.HeaderUI.text = "Introduce the round here.";
// Preload the maps for this section.
if (_CurrentQuestion.ContainsKey("Maps") && _CurrentQuestion["Maps"].TokenType == TokenType.DataList)
{
DataList Maps = _CurrentQuestion["Maps"].DataList;
for (int i = 0; i < Maps.Count; i++)
{
_VideoPlayer.LoadMap((int)Maps[i].Number);
}
}
EnableInteraction("Show Map Preview");
}
private void FinalRoundShowMapPreview()
{
_VideoPlayer.ShowSubMap(SubMap.ThreeLabels);
EnableRiskCards();
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = "Introduce the round here.";
EnableInteraction("Think About It");
}
private void FinalRoundPlayThinkingMusic()
{
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = "Think about it...";
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
"PlayMusic", MusicEventType.ThinkAboutIt);
SendCustomEventDelayedSeconds(nameof(ThinkAboutItCountdownFinished), 15.0f);
}
public void ThinkAboutItCountdownFinished()
{
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
Interface.HeaderUI.text = RoundSegmentTypeToString((RoundSegmentType)((int)_CurrentQuestion["Type"].Number));
DataList ClueStrings = _CurrentQuestion["Clues"].DataList;
for (int i = 0; i < Interface.CluesUI.Length && i < ClueStrings.Count; i++)
{
@@ -581,29 +622,12 @@ public class GameManagerRound1 : GameManagerBase
_QuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Number;
EnableInteraction("Think About It");
}
private void PlayThinkingMusic()
{
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = "Think about it...";
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
"PlayMusic", MusicEventType.ThinkAboutIt);
SendCustomEventDelayedSeconds(nameof(ThinkAboutItCountdownFinished), 15.0f);
}
public void ThinkAboutItCountdownFinished()
{
GetHostCardInterface(RoundSegmentType.FinalRound);
for (int i = 0; i < _PlayerPodiums.Length; i++)
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_PlayerPodiums[i], NetworkEventTarget.All, "LockInRisk");
}
EnableInteraction("Reveal Choice 1");
EnableInteraction("Present Clues");
}
private void FinalRoundRevealChoices()
@@ -614,8 +638,10 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice1()
{
HostCardFinalRoundInterface Interface =
(HostCardFinalRoundInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
_VideoPlayer.ShowSubMap(SubMap.OneLabel);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
Interface.ChoiceButtonImages[0].color = (_QuestionCorrectResponse == 1) ? Color.green : Color.red;
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
@@ -625,8 +651,10 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice2()
{
HostCardFinalRoundInterface Interface =
(HostCardFinalRoundInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
_VideoPlayer.ShowSubMap(SubMap.TwoLabels);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
Interface.ChoiceButtonImages[1].color = (_QuestionCorrectResponse == 2) ? Color.green : Color.red;
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
@@ -636,8 +664,10 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice3()
{
HostCardFinalRoundInterface Interface =
(HostCardFinalRoundInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
_VideoPlayer.ShowSubMap(SubMap.ThreeLabels);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
Interface.ChoiceButtonImages[2].color = (_QuestionCorrectResponse == 3) ? Color.green : Color.red;
DataList Choices = _CurrentQuestion["Choices"].DataList;
@@ -681,8 +711,8 @@ public class GameManagerRound1 : GameManagerBase
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_PlayerPodiums[i], NetworkEventTarget.All, "LockInChoice");
}
HostCardFinalRoundInterface Interface =
(HostCardFinalRoundInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
Interface.HeaderUI.text = "LOCKED IN";
for (int i = 0; i < Interface.CluesUI.Length; i++)
@@ -1031,7 +1061,7 @@ public class GameManagerRound1 : GameManagerBase
{
switch (_QuestionStage)
{
case 1: MultipleChoiceInitialisePresentation(); break;
case 1: InitialiseCluePresentation(); break;
case 2: MultipleChoiceRevealChoice1(); break;
case 3: MultipleChoiceRevealChoice2(); break;
case 4: MultipleChoiceRevealChoice3(); break;
@@ -1076,18 +1106,20 @@ public class GameManagerRound1 : GameManagerBase
switch (_QuestionStage)
{
case 1: BeginFinalRound(); break;
case 2: PlayThinkingMusic(); break;
case 3: FinalRoundRevealChoice1(); break;
case 4: FinalRoundRevealChoice2(); break;
case 5: FinalRoundRevealChoice3(); break;
case 6: FinalRoundLockAnswers(); break;
case 7: FinalRoundRevealPlayerPlace(3); break;
case 8: FinalRoundAssignPointsToPlayerPlace(3); break;
case 9: FinalRoundRevealPlayerPlace(2); break;
case 10: FinalRoundAssignPointsToPlayerPlace(2); break;
case 11: FinalRoundRevealPlayerPlace(1); break;
case 12: FinalRoundAssignPointsToPlayerPlace(1); break;
case 13: AdvanceToNextQuestion(); break;
case 2: FinalRoundShowMapPreview(); break;
case 3: FinalRoundPlayThinkingMusic(); break;
case 4: InitialiseCluePresentation(); break;
case 5: FinalRoundRevealChoice1(); break;
case 6: FinalRoundRevealChoice2(); break;
case 7: FinalRoundRevealChoice3(); break;
case 8: FinalRoundLockAnswers(); break;
case 9: FinalRoundRevealPlayerPlace(3); break;
case 10: FinalRoundAssignPointsToPlayerPlace(3); break;
case 11: FinalRoundRevealPlayerPlace(2); break;
case 12: FinalRoundAssignPointsToPlayerPlace(2); break;
case 13: FinalRoundRevealPlayerPlace(1); break;
case 14: FinalRoundAssignPointsToPlayerPlace(1); break;
case 15: AdvanceToNextQuestion(); break;
default: break;
}
}