- Finished animations for the location board.

- Reorganised a bunch of source files.
This commit is contained in:
Jamie Greunbaum
2025-06-13 20:41:36 -04:00
parent a7adf219f6
commit 00c171b7e5
117 changed files with 8550 additions and 959 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e5be3a71023e8f44905b1b6068bf819
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,4 +1,5 @@

using System.Collections.Generic;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
@@ -6,6 +7,7 @@ using VRC.SDK3.StringLoading;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
using VRC.Udon.Serialization.OdinSerializer.Utilities;
public enum QuestionType
@@ -38,6 +40,8 @@ public enum SFXEventType
public class GameManagerBase : UdonSharpBehaviour
{
[UdonSynced] protected bool _GameHasBegun = false;
[SerializeField] protected HostCardManager _HostCard = null;
[SerializeField] protected VRCUrl _QuestionURL;
@@ -92,21 +96,73 @@ public class GameManagerBase : UdonSharpBehaviour
public override void OnStringLoadSuccess(IVRCStringDownload DownloadedString)
{
string ErrorString = "";
string JSONString = DownloadedString.Result;
if (VRCJson.TryDeserializeFromJson(JSONString, out DataToken JSONResult))
{
if (JSONResult.TokenType == TokenType.DataList)
if (JSONResult.TokenType == TokenType.DataDictionary)
{
// For the moment, we're assuming that only Round 1 exists, so just pass
// the data over under that assumption. This will need to be fixed once
// we start expecting more game modes.
LoadQuestionData(JSONResult.DataList);
DataDictionary Dict = JSONResult.DataDictionary;
if (!Dict.ContainsKey("Round 1") || !Dict.ContainsKey("Round 2") || !Dict.ContainsKey("Round 3"))
{
ErrorString = "Could not find all the necessary keys for game rounds.";
}
else
{
// Attempt to load Round 1 data
if (Dict["Round 1"].TokenType == TokenType.DataList)
{
LoadQuestionData(Dict["Round 1"].DataList);
}
else
{
ErrorString = "Ensure the 'Round 1' entry is an array of dictionaries.";
}
// Attempt to load Round 2 data
if (Dict["Round 2"].TokenType == TokenType.DataList)
{
// LoadQuestionData(Dict["Round 2"].DataList);
}
else
{
ErrorString = "Ensure the 'Round 2' entry is a dictionary with a location name and landmarks.";
}
// Attempt to load Round 2 data
if (Dict["Round 3"].TokenType == TokenType.DataList)
{
// LoadQuestionData(Dict["Round 3"].DataList);
}
else
{
// ErrorString = "Ensure the 'Round 3' dictionary entry is a list of dictionaries.";
}
}
if (Dict.ContainsKey("Round 1"))
{
}
else
{
ErrorString = "Ensure the first element is a dictionary, containing 'Round 1', 'Round 2', and 'Round 3' entries.";
}
if (Dict.ContainsKey("Round 2"))
{
}
}
else
{
Debug.LogError("Malformed case file. Ensure the first element is an array of objects.");
ErrorString = "Ensure the first element is a dictionary";
}
}
if (ErrorString != "")
{
Debug.LogError("Malformed case file. " + ErrorString);
}
}
protected virtual void LoadQuestionData(DataList Data) {}
@@ -10,7 +10,6 @@ using VRC.SDKBase;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class GameManagerRound1 : GameManagerBase
{
[UdonSynced] private bool _GameHasBegun = false;
[UdonSynced] private int _QuestionIndex = 0;
[UdonSynced] private int _QuestionStage = 0;
[UdonSynced] private int _QuestionCorrectResponse = 0;
@@ -0,0 +1,87 @@
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
{
protected override void InitialiseGameMode()
{
base.InitialiseGameMode();
}
protected override void LoadQuestionData(DataList Data)
{
_QuestionsList.Clear();
_QuestionIndex = 0;
HostCardBetweenRoundsInterface Interface =
(HostCardBetweenRoundsInterface)GetHostCardInterface(QuestionType.BetweenRounds);
for (int i = 0; i < Data.Count; i++)
{
if (Data[i].TokenType == TokenType.DataDictionary)
{
_QuestionsList.Add(Data[i]);
}
}
if (_QuestionsList.Count == 0)
{
Interface.HeaderUI.text =
"Unable to find any questions. Ensure the root array elements are all objects.";
return;
}
_CurrentQuestion = _QuestionsList[_QuestionIndex].DataDictionary;
Interface.HeaderUI.text =
"Found " + _QuestionsList.Count + " questions in this case file. Press 'Use' button to show scores.";
// Reset podiums on a successful case load
for (int i = 0; i < _PlayerPodiums.Length; i++)
{
NetworkCalling.SendCustomNetworkEvent(
(IUdonEventReceiver)_PlayerPodiums[i],
NetworkEventTarget.All,
"ResetPodium");
}
_GameHasBegun = false;
EnableInteraction("Start Game");
}
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();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aff7dcb877dc27a4ab2fd77cf366a3b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
using UdonSharp;
using UnityEngine;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common.Interfaces;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class LocationBoard : UdonSharpBehaviour
{
private Animator _Animator;
private void Start()
{
_Animator = GetComponent<Animator>();
}
[NetworkCallable]
public void RevealPanel(int Panel)
{
_Animator.SetBool("Flip " + Panel, true);
}
[NetworkCallable]
public void ResetPanelBoard()
{
for (int i = 1; i <= 15; i++)
{
_Animator.SetBool("Flip " + i, false);
}
}
public void Button_RevealPanel1() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 1); }
public void Button_RevealPanel2() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 2); }
public void Button_RevealPanel3() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 3); }
public void Button_RevealPanel4() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 4); }
public void Button_RevealPanel5() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 5); }
public void Button_RevealPanel6() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 6); }
public void Button_RevealPanel7() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 7); }
public void Button_RevealPanel8() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 8); }
public void Button_RevealPanel9() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 9); }
public void Button_RevealPanel10() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 10); }
public void Button_RevealPanel11() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 11); }
public void Button_RevealPanel12() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 12); }
public void Button_RevealPanel13() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 13); }
public void Button_RevealPanel14() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 14); }
public void Button_RevealPanel15() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "RevealPanel", 15); }
public void Button_ResetPanelBoard() { NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.All, "ResetPanelBoard"); }
}
@@ -22,6 +22,6 @@ public class LocationBoardPanel : UdonSharpBehaviour
public override void Interact()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_LocationBoard, NetworkEventTarget.All, "PanelInteraction", PanelNumber);
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_LocationBoard, NetworkEventTarget.All, "RevealPanel", PanelNumber);
}
}
@@ -1,24 +0,0 @@
using UdonSharp;
using UnityEngine;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class LocationBoard : UdonSharpBehaviour
{
private Animator _Animator;
private void Start()
{
_Animator = GetComponent<Animator>();
}
[NetworkCallable]
public void PanelInteraction(int Panel)
{
_Animator.SetBool("Flip " + Panel, true);
}
}
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: BoneFollower
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: ccbda9bf23e2f714c9226283c77a92e5,
serializedUdonProgramAsset: {fileID: 11400000, guid: 52ecc8a73071e8e40928c3609699fcf4,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: InteractToggle
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 405e38d3dfb2f514daeed0e28fbb4864,
serializedUdonProgramAsset: {fileID: 11400000, guid: 873dfce61b1514e429c92e0d2fded7de,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: PlayerModSetter
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: f938e6c4ff027a74da405a1f9353fd2b,
serializedUdonProgramAsset: {fileID: 11400000, guid: e81558796a212ab4d88e305e2010f24b,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: GlobalToggleObject
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: c49c9265a3ef24642a6a4465d0a78872,
serializedUdonProgramAsset: {fileID: 11400000, guid: 2fe8ced6184000f49bca526cd2c5891c,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: MasterToggleObject
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 04024a76ab1924042ba521e11cb76d91,
serializedUdonProgramAsset: {fileID: 11400000, guid: a2d01d9f36ac6df49831be249e48ecc4,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: TrackingDataFollower
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 17f8fbbe6cc186d4f8dbb057b01a4ec2,
serializedUdonProgramAsset: {fileID: 11400000, guid: 1b89d4552983c0448a7389decec3b555,
type: 2}
udonAssembly:
assemblyError:
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: WorldAudioSettings
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 128d924a3066b7546b2d1c73e61006ab,
serializedUdonProgramAsset: {fileID: 11400000, guid: 994b559b0f158b4499f8937980ed8694,
type: 2}
udonAssembly:
assemblyError: