- Choice cards are synced across the network, and receive data from the host.

- KNOWN ISSUE: Cards don't randomise correctly across the network.
This commit is contained in:
Jamie Greunbaum
2025-05-30 04:32:25 -04:00
parent 9114e6d99b
commit e042d089a5
51 changed files with 2119 additions and 1480 deletions
+116 -2
View File
@@ -20,7 +20,7 @@ MonoBehaviour:
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 4
hasInteractEvent: 0
hasInteractEvent: 1
scriptID: -4699376671505787403
serializationData:
SerializedFormat: 2
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 2
Data: 4
- Name:
Entry: 7
Data:
@@ -171,6 +171,120 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _SpawnPosition
- Name: $v
Entry: 7
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SpawnPosition
- Name: <UserType>k__BackingField
Entry: 7
Data: 12|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 12
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 14|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _HeldPosition
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _HeldPosition
- Name: <UserType>k__BackingField
Entry: 9
Data: 12
- Name: <SystemType>k__BackingField
Entry: 9
Data: 12
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 16|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 17|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
+25 -2
View File
@@ -1,5 +1,7 @@
using UdonSharp;
using UdonSharp.Examples.Utilities;
using UnityEditor;
using UnityEngine;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
@@ -11,19 +13,40 @@ public class ChoiceCard : UdonSharpBehaviour
[UdonSynced] public int ChoiceNumber = 0;
[SerializeField] private ChoiceCardGroup CardGroup = null;
[SerializeField] private Transform _SpawnPosition;
[SerializeField] private Transform _HeldPosition;
public override void OnPickup()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)CardGroup, NetworkEventTarget.All, "ChoiceCardPickedUp", ChoiceNumber);
}
public override void Interact()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)CardGroup, NetworkEventTarget.All, "ChoiceCardInteract", ChoiceNumber);
}
public void SetParent(ChoiceCardGroup ParentCardGroup)
public void SetCardGroup(ChoiceCardGroup ParentCardGroup)
{
CardGroup = ParentCardGroup;
}
[NetworkCallable]
public void SetToHeldPosition()
{
transform.SetParent(_HeldPosition, false);
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
InteractionText = "Reveal";
}
[NetworkCallable]
public void ResetPosition()
{
transform.SetParent(_SpawnPosition, false);
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localEulerAngles = Vector3.zero;
InteractionText = "Choose";
}
}
+214 -82
View File
@@ -44,82 +44,22 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 4
Data: 6
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: ChoiceCards
Data: _Podium
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ChoiceCards
Data: _Podium
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: ChoiceCard[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: Podium
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: Podium
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: PlayerPodium, Assembly-CSharp
@@ -128,7 +68,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
@@ -149,13 +89,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 10|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -176,25 +116,31 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _PCCardHeldPosition
Data: _ChoiceCards
- Name: $v
Entry: 7
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardHeldPosition
Data: _ChoiceCards
- Name: <UserType>k__BackingField
Entry: 7
Data: 12|System.RuntimeType, mscorlib
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
Data: ChoiceCard[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 12
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -209,13 +155,193 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 14|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 11|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _ChoiceCardText
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ChoiceCardText
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TMPro.TextMeshProUGUI[], Unity.TextMeshPro
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 15|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _PCCardHeldPosition
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardHeldPosition
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 19|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _PCCardAnimator
- Name: $v
Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardAnimator
- Name: <UserType>k__BackingField
Entry: 7
Data: 21|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 21
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 23|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -239,13 +365,13 @@ MonoBehaviour:
Data: _SelectedChoice
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SelectedChoice
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
Data: 25|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
@@ -254,13 +380,13 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -269,10 +395,16 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 27|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
+107 -25
View File
@@ -1,71 +1,115 @@
using TMPro;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class ChoiceCardGroup : UdonSharpBehaviour
{
public ChoiceCard[] ChoiceCards;
[SerializeField] private PlayerPodium _Podium;
[SerializeField] private ChoiceCard[] _ChoiceCards;
[SerializeField] private TextMeshProUGUI[] _ChoiceCardText;
[SerializeField] private PlayerPodium Podium = null;
[SerializeField] private Transform _PCCardHeldPosition;
[SerializeField] private GameObject _PCCardHeldPosition;
[SerializeField] private Animator _PCCardAnimator;
private int _SelectedChoice = -1;
[UdonSynced] private int _SelectedChoice = -1;
void Start()
{
for (int i = 0; i < ChoiceCards.Length; i++)
VRCPlayerApi Player = Networking.GetOwner(_Podium.gameObject);
Debug.Assert(Player != null);
for (int i = 0; i < _ChoiceCards.Length; i++)
{
ChoiceCards[i].SetParent(this);
ChoiceCards[i].ResetPosition();
ChoiceCard Card = _ChoiceCards[i];
Card.SetCardGroup(this);
bool IsInVR = Player.IsUserInVR();
Card.DisableInteractive = IsInVR;
VRCPickup Pickup = Card.GetComponent<VRCPickup>();
if (Pickup != null)
{
Pickup.pickupable = IsInVR;
}
}
}
public void ChoiceCardPickedUp(int ChoiceNumber)
{
_SelectedChoice = ChoiceNumber;
}
[NetworkCallable]
public void ChoiceCardInteract(int ChoiceNumber)
{
if (_SelectedChoice == ChoiceNumber)
{
RevealChoice();
return;
}
_SelectedChoice = ChoiceNumber;
for (int i = 0; i < ChoiceCards.Length; i++)
Debug.LogWarning("[[DEBUG]] Selected choice is " + _SelectedChoice);
VRCPlayerApi Player = Networking.GetOwner(_Podium.gameObject);
Debug.Assert(Player != null);
for (int i = 0; i < _ChoiceCards.Length; i++)
{
ChoiceCard Card = ChoiceCards[i];
ChoiceCard Card = _ChoiceCards[i];
Debug.LogWarning("[[DEBUG]] Card choice for index " + i + " is " + Card.ChoiceNumber);
_PCCardAnimator.SetBool("Turn Forward", false);
if (Card.ChoiceNumber == _SelectedChoice)
{
VRCPlayerApi Player = Networking.GetOwner(Podium.gameObject);
if (Player != null && !Player.IsUserInVR())
if (!Player.IsUserInVR())
{
VRCPickup Pickup = Card.GetComponent<VRCPickup>();
if (Pickup != null)
{
Pickup.Drop();
}
Card.transform.localPosition = _PCCardHeldPosition.localPosition;
Card.transform.localEulerAngles = _PCCardHeldPosition.localEulerAngles;
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)Card, NetworkEventTarget.All, "SetToHeldPosition");
}
}
else
{
Card.ResetPosition();
}
}
}
private void RevealChoice(int ChoiceNumber)
private void RevealChoice()
{
if (ChoiceNumber == _SelectedChoice)
VRCPlayerApi Player = Networking.GetOwner(_Podium.gameObject);
if (Player != null && !Player.IsUserInVR())
{
VRCPlayerApi Player = Networking.GetOwner(Podium.gameObject);
if (Player != null && !Player.IsUserInVR())
for (int i = 0; i < _ChoiceCards.Length; i++)
{
// Play the PC turn-around animation here.
ChoiceCard Card = _ChoiceCards[i];
if (Card.ChoiceNumber == _SelectedChoice)
{
VRCPickup Pickup = Card.GetComponent<VRCPickup>();
if (Pickup != null)
{
Pickup.Drop();
}
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)Card, NetworkEventTarget.All, "SetToHeldPosition");
_PCCardAnimator.SetBool("Turn Forward", true);
}
else
{
Card.ResetPosition();
}
}
}
}
@@ -75,4 +119,42 @@ public class ChoiceCardGroup : UdonSharpBehaviour
{
return _SelectedChoice;
}
public void SetChoices(string Choice1, string Choice2, string Choice3)
{
VRCPlayerApi Player = Networking.GetOwner(_Podium.gameObject);
float RandomSeed = (Player.GetPosition().x * 100) + (Player.GetPosition().z * 1000);
Random.InitState((int)RandomSeed);
int[] ChoiceIndices = { 0, 1, 2 };
int Choice1Index = ChoiceIndices[Random.Range(0, 3)];
_ChoiceCards[Choice1Index].ChoiceNumber = 1;
_ChoiceCardText[Choice1Index].text = Choice1;
ChoiceIndices[Choice1Index] = -1;
int Choice2Index = -1;
while(Choice2Index == -1) { Choice2Index = ChoiceIndices[Random.Range(0, 3)]; }
_ChoiceCards[Choice2Index].ChoiceNumber = 2;
_ChoiceCardText[Choice2Index].text = Choice2;
ChoiceIndices[Choice2Index] = -1;
int Choice3Index = -1;
while (Choice3Index == -1) { Choice3Index = ChoiceIndices[Random.Range(0, 3)]; }
_ChoiceCards[Choice3Index].ChoiceNumber = 3;
_ChoiceCardText[Choice3Index].text = Choice3;
ChoiceIndices[Choice3Index] = -1;
}
public void ResetCards()
{
_SelectedChoice = -1;
for (int i = 0; i < _ChoiceCards.Length; i++)
{
_ChoiceCards[i].ResetPosition();
_ChoiceCardText[i].text = "";
}
}
}
File diff suppressed because it is too large Load Diff
+120 -15
View File
@@ -1,6 +1,7 @@
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
@@ -10,6 +11,17 @@ using VRC.SDK3.StringLoading;
using System.Runtime.CompilerServices;
using TMPro;
public enum QuestionType
{
None,
MultipleChoice,
LightningRound,
TheChase,
FinalRound,
Tiebreaker
}
public enum MusicEventType
{
None,
@@ -23,23 +35,32 @@ public enum SFXEventType
Buzzer
}
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class GameManager : UdonSharpBehaviour
{
[UdonSynced] public VRCUrl QuestionURL;
[SerializeField] private TextMeshProUGUI _InfoHeader;
[SerializeField] private TextMeshProUGUI[] _InfoClues;
[SerializeField] private TextMeshProUGUI[] _InfoChoices;
[SerializeField] private GameObject _AdminPanel;
[UdonSynced] private bool BuzzInAllowed = false;
[UdonSynced] private bool[] PlayerBuzzInAllowed;
[UdonSynced] private int _BuzzedInPlayer = -1;
private DataDictionary _CurrentQuestion;
[UdonSynced] private QuestionType _CurrentQuestionType = QuestionType.MultipleChoice;
[UdonSynced] private int _CurrentQuestionStage = 0;
[UdonSynced] private int _CurrentQuestionCorrectResponse = -1;
public PlayerPodium[] PlayerPodiums;
[UdonSynced] public VRCUrl QuestionURL;
[Header("Multiple Choice Card UI")]
[SerializeField] private TextMeshProUGUI _InfoHeader;
[SerializeField] private TextMeshProUGUI[] _InfoClues;
[SerializeField] private TextMeshProUGUI[] _InfoChoices;
[SerializeField] private Image[] _InfoChoiceButtons;
[SerializeField] private TextMeshProUGUI _Answer;
[Header("Audio")]
[SerializeField] private AudioClip BuzzerSound = null;
@@ -77,12 +98,80 @@ public class GameManager : UdonSharpBehaviour
[NetworkCallable]
public void UpdateInfoCard(string Data)
{
DisableChoiceCards();
if (VRCJson.TryDeserializeFromJson(Data, out DataToken ResultToken))
{
DataDictionary Result = ResultToken.DataDictionary;
_InfoChoices[0].text = Result["Choices"].DataList[0].ToString();
_InfoChoices[1].text = Result["Choices"].DataList[1].ToString();
_InfoChoices[2].text = Result["Choices"].DataList[2].ToString();
_CurrentQuestion = ResultToken.DataDictionary;
string Type = _CurrentQuestion["Type"].ToString();
if (Type == "Multiple Choice")
{
NewMultipleChoiceQuestion();
}
}
}
private void NewMultipleChoiceQuestion()
{
_CurrentQuestionType = QuestionType.MultipleChoice;
_CurrentQuestionStage = 0;
_InfoHeader.text = _CurrentQuestion["Type"].ToString();
_InfoClues[0].text = _CurrentQuestion["Clues"].DataList[0].ToString();
_InfoClues[1].text = _CurrentQuestion["Clues"].DataList[1].ToString();
_InfoClues[2].text = _CurrentQuestion["Clues"].DataList[2].ToString();
DataList Choices = _CurrentQuestion["Choices"].DataList;
_InfoChoices[0].text = Choices[0].ToString();
_InfoChoices[1].text = Choices[1].ToString();
_InfoChoices[2].text = Choices[2].ToString();
_CurrentQuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Double;
_Answer.text = Choices[_CurrentQuestionCorrectResponse].ToString();
}
private void MultipleChoiceRevealChoices()
{
Debug.LogError("Advancing the current question stage now.");
SendCustomEvent(nameof(MultipleChoiceRevealChoice1));
SendCustomEventDelayedSeconds(nameof(MultipleChoiceRevealChoice2), 1.25f);
SendCustomEventDelayedSeconds(nameof(MultipleChoiceRevealChoice3), 2.5f);
}
public void MultipleChoiceRevealChoice1()
{
_InfoChoiceButtons[0].color = (_CurrentQuestionCorrectResponse == 0) ? Color.green : Color.red;
}
public void MultipleChoiceRevealChoice2()
{
_InfoChoiceButtons[1].color = (_CurrentQuestionCorrectResponse == 1) ? Color.green : Color.red;
}
public void MultipleChoiceRevealChoice3()
{
_InfoChoiceButtons[2].color = (_CurrentQuestionCorrectResponse == 2) ? Color.green : Color.red;
DataList Choices = _CurrentQuestion["Choices"].DataList;
EnableChoiceCards();
for (int i = 0; i < PlayerPodiums.Length; i++)
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.Owner, "SetCardChoices", Choices[0].ToString(), Choices[1].ToString(), Choices[2].ToString());
}
}
public void EnableChoiceCards()
{
for (int i = 0; i < PlayerPodiums.Length; i++)
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "EnableChoiceCards", true);
}
}
public void DisableChoiceCards()
{
for (int i = 0; i < PlayerPodiums.Length; i++)
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "EnableChoiceCards", false);
}
}
@@ -137,16 +226,32 @@ public class GameManager : UdonSharpBehaviour
}
public void PlayWhereInTheWorld()
private void AdvanceQuestionStage()
{
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlayMusic), MusicEventType.WhereInTheWorld);
_CurrentQuestionStage++;
switch(_CurrentQuestionType)
{
case QuestionType.MultipleChoice:
AdvanceMultipleChoiceStage();
break;
}
RequestSerialization();
}
public void PlayRockapellaIdent()
private void AdvanceMultipleChoiceStage()
{
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlayMusic), MusicEventType.RockapellaIdent);
switch(_CurrentQuestionStage)
{
case 1:
MultipleChoiceRevealChoices();
break;
default:
return;
}
}
[NetworkCallable]
public void PlayMusic(MusicEventType MusicEvent)
{
@@ -182,7 +287,7 @@ public class GameManager : UdonSharpBehaviour
public override void OnPickupUseDown()
{
_AdminPanel.SetActive(!_AdminPanel.activeSelf);
AdvanceQuestionStage();
base.OnPickupUseDown();
}
+91 -31
View File
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 8
Data: 9
- Name:
Entry: 7
Data:
@@ -344,25 +344,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _BuzzedInEffect
Data: _ChoiceCards
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _BuzzedInEffect
Data: _ChoiceCards
- Name: <UserType>k__BackingField
Entry: 7
Data: 22|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
Data: ChoiceCardGroup, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 22
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -380,19 +380,10 @@ MonoBehaviour:
Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
Data: 1
- Name:
Entry: 7
Data: 24|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Effects
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 25|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 24|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -413,25 +404,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _Nameplate
Data: _BuzzedInEffect
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Nameplate
Data: _BuzzedInEffect
- Name: <UserType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
Data: 26|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TMPro.TextMeshProUGUI, Unity.TextMeshPro
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -446,10 +437,19 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
Data: 2
- Name:
Entry: 7
Data: 28|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Effects
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 29|UnityEngine.SerializeField, UnityEngine.CoreModule
@@ -473,19 +473,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _Scorecard
Data: _Nameplate
- Name: $v
Entry: 7
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Scorecard
Data: _Nameplate
- Name: <UserType>k__BackingField
Entry: 9
Data: 27
Entry: 7
Data: 31|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TMPro.TextMeshProUGUI, Unity.TextMeshPro
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
Data: 31
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -500,13 +506,67 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 32|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 33|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _Scorecard
- Name: $v
Entry: 7
Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Scorecard
- Name: <UserType>k__BackingField
Entry: 9
Data: 31
- Name: <SystemType>k__BackingField
Entry: 9
Data: 31
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 36|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
+16
View File
@@ -16,6 +16,8 @@ public class PlayerPodium : UdonSharpBehaviour
[UdonSynced] private int _PlayerID = -1;
[UdonSynced, FieldChangeCallback(nameof(PlayerScore))] private int _PlayerScore = 50;
[SerializeField] private ChoiceCardGroup _ChoiceCards;
[Header("Effects")]
[SerializeField] private GameObject _BuzzedInEffect;
@@ -57,6 +59,20 @@ public class PlayerPodium : UdonSharpBehaviour
}
[NetworkCallable]
public void EnableChoiceCards(bool Enable)
{
_ChoiceCards.gameObject.SetActive(Enable);
_ChoiceCards.ResetCards();
}
[NetworkCallable]
public void SetCardChoices(string Choice1, string Choice2, string Choice3)
{
_ChoiceCards.SetChoices(Choice1, Choice2, Choice3);
}
[NetworkCallable]
public void EnableBuzzInEffect(bool Enable)
{
@@ -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: