100 lines
2.7 KiB
C#
100 lines
2.7 KiB
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDK3.Data;
|
|
using VRC.SDK3.UdonNetworkCalling;
|
|
using VRC.Udon.Common.Interfaces;
|
|
using VRC.SDKBase;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class GameManagerRound2 : GameManagerBase
|
|
{
|
|
[SerializeField] private LocationBoard _LocationBoard;
|
|
|
|
protected override void InitialiseGameMode()
|
|
{
|
|
|
|
|
|
base.InitialiseGameMode();
|
|
}
|
|
|
|
|
|
public override void LoadQuestionData(DataToken Data)
|
|
{
|
|
HostCardBetweenRoundsInterface Interface =
|
|
(HostCardBetweenRoundsInterface)GetHostCardInterface(QuestionType.BetweenRounds);
|
|
|
|
DataDictionary DataDict = Data.DataDictionary;
|
|
|
|
if (DataDict.ContainsKey("Location") && DataDict.ContainsKey("Landmarks"))
|
|
{
|
|
if (DataDict["Landmarks"].TokenType == TokenType.DataList && DataDict["Landmarks"].DataList.Count >= 15)
|
|
{
|
|
DataList Landmarks = DataDict["Landmarks"].DataList;
|
|
for (int i = 0; i < Landmarks.Count; i++)
|
|
{
|
|
if (Landmarks[i].TokenType == TokenType.DataDictionary)
|
|
{
|
|
DataDictionary LandmarkEntry = Landmarks[i].DataDictionary;
|
|
if (LandmarkEntry.ContainsKey("Landmark"))
|
|
{
|
|
_LocationBoard.LocationPanelText[i].text = LandmarkEntry["Landmark"].ToString();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Malformed landmark entry. Ensure the 'Landmark' key exists.");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Malformed landmark entry. Ensure each landmark is a dictionary containing a 'Landmark' key.");
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Malformed landmark data. Ensure there is a list of at least 15 landmarks.");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Malformed round data. Ensure Round 2 contains 'Location' and 'Landmark' keys.");
|
|
}
|
|
|
|
//_GameHasBegun = false;
|
|
//EnableInteraction("Start Game");
|
|
}
|
|
|
|
protected override HostCardInterfaceBase GetHostCardInterface(QuestionType Question)
|
|
{
|
|
return _HostCard.EnableHostCardDisplay(GameType.RecoverTheLoot, Question);
|
|
}
|
|
|
|
|
|
protected override void _HostCardUseButtonDown_Internal()
|
|
{
|
|
//if (!_GameHasBegun)
|
|
//{
|
|
// for (int i = 0; i < _PlayerPodiums.Length; i++)
|
|
// {
|
|
// NetworkCalling.SendCustomNetworkEvent(
|
|
// (IUdonEventReceiver)_PlayerPodiums[i],
|
|
// NetworkEventTarget.All,
|
|
// "DisplayScore");
|
|
// }
|
|
|
|
// SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlaySFXAtPitch), SFXEventType.Ding, D6);
|
|
|
|
// HostCardBetweenRoundsInterface Interface =
|
|
// (HostCardBetweenRoundsInterface)GetHostCardInterface(QuestionType.BetweenRounds);
|
|
// Interface.HeaderUI.text = "Upcoming Question: " + QuestionTypeToString((QuestionType)((int)_CurrentQuestion["Type"].Number));
|
|
|
|
// _GameHasBegun = true;
|
|
// return;
|
|
//}
|
|
|
|
//AdvanceQuestion();
|
|
}
|
|
}
|