Map loading code reworked to queue and auto-download multiple atlases.

This commit is contained in:
2025-07-27 04:06:39 -04:00
parent 4e2819771f
commit 8ea69143d9
8 changed files with 468 additions and 137 deletions
@@ -112,7 +112,7 @@ public class CaseManager : UdonSharpBehaviour
ErrorString = "Ensure the 'Round 3' dictionary entry is a dictionary with a key called 'Continent' and an integer value.";
}
ContinueToRound3();
ContinueToRound1();
}
else
{
@@ -185,6 +185,10 @@ public class CaseManager : UdonSharpBehaviour
{
return _CaseFileMaps[MapIndex];
}
public int GetMapCount()
{
return _CaseFileMaps.Length;
}
public VRCUrl GetLootImage()
{
@@ -60,9 +60,6 @@ public class GameManagerRound1 : GameManagerBase
_PlayerBuzzInAllowed = new bool[_PlayerPodiums.Length];
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopMusic");
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopSFX");
RequestSerialization();
base.InitialiseGameMode();
}
@@ -92,7 +89,7 @@ public class GameManagerRound1 : GameManagerBase
}
Interface.HeaderUI.text =
"Found " + _QuestionsList.Count + " questions in this case file. Press 'Use' button to show scores.";
"Case has been loaded. ";
_GameHasBegun = false;
EnableInteraction("Start Game");
@@ -116,6 +113,19 @@ public class GameManagerRound1 : GameManagerBase
// Again, why does this work, but not just casting to an enum?
_CurrentQuestionType = (RoundSegmentType)(int)_CurrentQuestion["Type"].Number;
_QuestionStage = 0;
if (_CurrentQuestion.ContainsKey("Maps") && _CurrentQuestion["Maps"].TokenType == TokenType.DataList)
{
DataList Maps = _CurrentQuestion["Maps"].DataList;
int[] MapIndices = new int[Maps.Count];
for (int i = 0; i < MapIndices.Length; i++)
{
MapIndices[i] = (int)Maps[i].Number;
}
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_VideoPlayer, NetworkEventTarget.All,
"QueueMapDownloads", MapIndices);
}
}
private void AssignStarterPoints()
@@ -159,16 +169,6 @@ public class GameManagerRound1 : GameManagerBase
return;
}
if (_CurrentQuestion.ContainsKey("Maps") && _CurrentQuestion["Maps"].TokenType == TokenType.DataList)
{
DataList Maps = _CurrentQuestion["Maps"].DataList;
for (int i = 0; i < Maps.Count; i++)
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_VideoPlayer, NetworkEventTarget.All,
"LoadMap", (int)Maps[i].Number);
}
}
DataDictionary Presentation = _CurrentQuestion["Presentation"].DataDictionary;
switch ((PresentationMedium)(int)Presentation["Medium"].Number)
{
@@ -190,7 +190,14 @@ public class GameManagerRound1 : GameManagerBase
_VideoPlayer.VideoURL = _CaseManager.GetVideo((int)Videos[_QuestionSubstage].Number);
_QuestionSubstage++;
EnableInteraction("Play Video");
if (_QuestionSubstage < Videos.Count)
{
EnableInteraction("Play Video");
}
else
{
EnableInteraction("Reveal Question");
}
}
else
{
@@ -207,18 +214,25 @@ public class GameManagerRound1 : GameManagerBase
private void InitialiseACMECrimenetComputer(DataDictionary Presentation)
{
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = "This part isn't done yet. This will eventually have a really cool computer give you the clue.";
if (_QuestionSubstage < 1)
{
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
Interface.HeaderUI.text = "This part isn't done yet. This will eventually have a really cool computer give you the clue.";
_QuestionSubstage = 0;
MultipleChoiceRevealQuestion();
_QuestionSubstage++;
EnableInteraction("Reveal Question");
}
else
{
MultipleChoiceRevealQuestion();
}
}
private void MultipleChoiceRevealQuestion()
{
_QuestionSubstage = 0;
_VideoPlayer.SubMapIndex = SubMap.NoLabels;
_VideoPlayer.SubMapIndex = 0;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -253,7 +267,7 @@ public class GameManagerRound1 : GameManagerBase
private void MultipleChoiceRevealChoice1()
{
_VideoPlayer.SubMapIndex = SubMap.OneLabel;
_VideoPlayer.SubMapIndex = 1;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -267,7 +281,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void MultipleChoiceRevealChoice2()
{
_VideoPlayer.SubMapIndex = SubMap.TwoLabels;
_VideoPlayer.SubMapIndex = 2;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -281,7 +295,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void MultipleChoiceRevealChoice3()
{
_VideoPlayer.SubMapIndex = SubMap.ThreeLabels;
_VideoPlayer.SubMapIndex = 3;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice);
@@ -597,7 +611,7 @@ public class GameManagerRound1 : GameManagerBase
private void FinalRoundShowMapPreview()
{
_VideoPlayer.SubMapIndex = SubMap.ThreeLabels;
_VideoPlayer.SubMapIndex = 3;
EnableRiskCards();
@@ -656,7 +670,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice1()
{
_VideoPlayer.SubMapIndex = SubMap.OneLabel;
_VideoPlayer.SubMapIndex = 1;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
@@ -669,7 +683,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice2()
{
_VideoPlayer.SubMapIndex = SubMap.TwoLabels;
_VideoPlayer.SubMapIndex = 2;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
@@ -682,7 +696,7 @@ public class GameManagerRound1 : GameManagerBase
}
private void FinalRoundRevealChoice3()
{
_VideoPlayer.SubMapIndex = SubMap.ThreeLabels;
_VideoPlayer.SubMapIndex = 3;
HostCardMultipleChoiceInterface Interface =
(HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound);
@@ -1327,6 +1341,10 @@ public class GameManagerRound1 : GameManagerBase
{
return _CaseManager.GetMap(MapIndex);
}
public int GetMapCount()
{
return _CaseManager.GetMapCount();
}
protected override void _HostCardUseButtonDown_Internal()