Choice cards now cycle colours on every new question.

This commit is contained in:
2025-09-05 20:24:44 -04:00
parent cfd9defc1f
commit 6ca24773b0
30 changed files with 246 additions and 386 deletions
@@ -1347,7 +1347,7 @@ public class GameManagerRound1 : GameManagerBase
{
for (int i = 0; i < _PlayerPodiums.Length; i++)
{
_PlayerPodiums[i].SendCustomNetworkEvent(NetworkEventTarget.All, "EnableChoiceCards", true);
_PlayerPodiums[i].SendCustomNetworkEvent(NetworkEventTarget.All, "EnableChoiceCards", true, _QuestionIndex % _PlayerPodiums[i].GetColourOptionsCount());
}
}
@@ -1355,7 +1355,7 @@ public class GameManagerRound1 : GameManagerBase
{
for (int i = 0; i < _PlayerPodiums.Length; i++)
{
_PlayerPodiums[i].SendCustomNetworkEvent(NetworkEventTarget.All, "EnableChoiceCards", false);
_PlayerPodiums[i].SendCustomNetworkEvent(NetworkEventTarget.All, "EnableChoiceCards", false, 0);
}
}
@@ -18,12 +18,21 @@ public class PermissionsPanel : UdonSharpBehaviour
[SerializeField] private RectTransform _ListContainer;
[SerializeField] private GameObject _PlayerItemTemplate;
private const int MAX_PLAYERS_IN_LIST = 85;
private const int MAX_PLAYERS_IN_LIST = 100;
void Start()
{
for (int i = 0; i < PlayerData_Name.Length; i++)
{
GameObject NewListItem = Instantiate<GameObject>(_PlayerItemTemplate, _ListContainer, false);
NewListItem.SetActive(false);
}
}
public override void OnPlayerJoined(VRCPlayerApi Player)
{
for (int i = 0; i < MAX_PLAYERS_IN_LIST; i++)
for (int i = 0; i < PlayerData_Name.Length; i++)
{
if (PlayerData_Name[i] == null)
{
@@ -38,6 +47,7 @@ public class PermissionsPanel : UdonSharpBehaviour
}
}
RebuildPlayerList();
RequestSerialization();
base.OnPlayerJoined(Player);
@@ -45,44 +55,18 @@ public class PermissionsPanel : UdonSharpBehaviour
public override void OnPlayerLeft(VRCPlayerApi Player)
{
for (int i = 0; i < MAX_PLAYERS_IN_LIST; i++)
for (int i = 0; i < PlayerData_Name.Length; i++)
{
if (PlayerData_Name[i] == Player.displayName)
{
Debug.Log("[PermissionsPanel] Found exiting player " + PlayerData_Name[i] + "on the list. Removing...");
PlayerData_Name[i] = null;
Debug.Log("[PermissionsPanel] PlayerData_Name[" + i + "] now equals " + PlayerData_Name[i]);
break;
}
}
string[] NewPlayerData_Name = new string[MAX_PLAYERS_IN_LIST];
int[] NewPlayerData_ID = new int[MAX_PLAYERS_IN_LIST];
bool[] NewPlayerData_Admin = new bool[MAX_PLAYERS_IN_LIST];
bool[] NewPlayerData_Host = new bool[MAX_PLAYERS_IN_LIST];
bool[] NewPlayerData_Camera = new bool[MAX_PLAYERS_IN_LIST];
for (int i = 0; i < MAX_PLAYERS_IN_LIST; i++)
{
for (int j = i; j < MAX_PLAYERS_IN_LIST; j++)
{
if (PlayerData_Name[j] != null)
{
NewPlayerData_Name[i] = PlayerData_Name[j];
NewPlayerData_ID[i] = PlayerData_ID[j];
NewPlayerData_Admin[i] = PlayerData_Admin[j];
NewPlayerData_Host[i] = PlayerData_Host[j];
NewPlayerData_Camera[i] = PlayerData_Camera[j];
break;
}
}
}
PlayerData_Name = NewPlayerData_Name;
PlayerData_ID = NewPlayerData_ID;
PlayerData_Admin = NewPlayerData_Admin;
PlayerData_Host = NewPlayerData_Host;
PlayerData_Camera = NewPlayerData_Camera;
RebuildPlayerList();
RequestSerialization();
base.OnPlayerLeft(Player);
@@ -90,13 +74,15 @@ public class PermissionsPanel : UdonSharpBehaviour
public override void OnDeserialization(DeserializationResult Result)
{
RebuildPlayerList();
base.OnDeserialization(Result);
}
public void PermissionsChanged()
{
for (int i = 0; i < _ListContainer.childCount; i++)
for (int i = 0; i < PlayerData_Name.Length; i++)
{
GameObject Entry = _ListContainer.GetChild(i).gameObject;
PermissionsPanelPlayerEntry PlayerEntry = Entry.GetComponent<PermissionsPanelPlayerEntry>();
@@ -110,26 +96,32 @@ public class PermissionsPanel : UdonSharpBehaviour
private void RebuildPlayerList()
{
int CurrentListCount = _ListContainer.childCount;
for (int i = 0; i < CurrentListCount; i++)
Debug.Log("[PermissionsPanel] Rebuilding the player list...");
for (int i = 0; i < PlayerData_Name.Length; i++)
{
Destroy(_ListContainer.GetChild(CurrentListCount - i - 1).gameObject);
}
Debug.Log("[PermissionsPanel] PlayerData_Name[" + i + "] is " + PlayerData_Name[i]);
for (int i = 0; i < VRCPlayerApi.GetPlayerCount(); i++)
{
GameObject NewListItem = Instantiate<GameObject>(_PlayerItemTemplate, _ListContainer, false);
NewListItem.SetActive(true);
PermissionsPanelPlayerEntry PlayerListItem = NewListItem.GetComponent<PermissionsPanelPlayerEntry>();
PlayerListItem.PlayerNameUI.text = PlayerData_Name[i];
PermissionsPanelPlayerEntry PlayerListItem = _ListContainer.GetChild(i).GetComponent<PermissionsPanelPlayerEntry>();
PlayerListItem.AdminToggle.SetIsOnWithoutNotify(PlayerData_Admin[i]);
PlayerListItem.HostToggle.SetIsOnWithoutNotify(PlayerData_Host[i]);
PlayerListItem.CameraToggle.SetIsOnWithoutNotify(PlayerData_Camera[i]);
if (PlayerData_Name[i] != null)
{
PlayerListItem.PlayerNameUI.text = PlayerData_Name[i];
PlayerListItem.AdminToggle.interactable = false;
PlayerListItem.HostToggle.interactable = false;
PlayerListItem.CameraToggle.interactable = false;
PlayerListItem.AdminToggle.SetIsOnWithoutNotify(PlayerData_Admin[i]);
PlayerListItem.HostToggle.SetIsOnWithoutNotify(PlayerData_Host[i]);
PlayerListItem.CameraToggle.SetIsOnWithoutNotify(PlayerData_Camera[i]);
PlayerListItem.AdminToggle.interactable = (Networking.LocalPlayer.isInstanceOwner || Networking.LocalPlayer.isMaster);
PlayerListItem.HostToggle.interactable = (Networking.LocalPlayer.isInstanceOwner || Networking.LocalPlayer.isMaster);
PlayerListItem.CameraToggle.interactable = (Networking.LocalPlayer.isInstanceOwner || Networking.LocalPlayer.isMaster);
PlayerListItem.gameObject.SetActive(true);
}
else
{
PlayerListItem.gameObject.SetActive(false);
}
}
}
}
+71 -11
View File
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 4
Data: 5
- Name:
Entry: 7
Data:
@@ -176,19 +176,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _SpawnPosition
Data: _Mesh
- Name: $v
Entry: 7
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SpawnPosition
Data: _Mesh
- Name: <UserType>k__BackingField
Entry: 7
Data: 12|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -236,19 +236,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _HeldPosition
Data: _SpawnPosition
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _HeldPosition
Data: _SpawnPosition
- Name: <UserType>k__BackingField
Entry: 9
Data: 12
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 12
Data: 16
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -263,13 +269,67 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 16|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 17|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 18|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: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _HeldPosition
- Name: <UserType>k__BackingField
Entry: 9
Data: 16
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
- 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: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 21|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
+6 -2
View File
@@ -1,7 +1,5 @@
using UdonSharp;
using UdonSharp.Examples.Utilities;
using UnityEditor;
using UnityEngine;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
@@ -13,6 +11,7 @@ public class ChoiceCard : UdonSharpBehaviour
[UdonSynced] public int ChoiceNumber = 0;
[SerializeField] private ChoiceCardGroup CardGroup = null;
[SerializeField] private MeshRenderer _Mesh;
[SerializeField] private Transform _SpawnPosition;
[SerializeField] private Transform _HeldPosition;
@@ -32,6 +31,11 @@ public class ChoiceCard : UdonSharpBehaviour
CardGroup = ParentCardGroup;
}
public void SetColourMaterial(Material Colour)
{
_Mesh.sharedMaterial = Colour;
}
[NetworkCallable]
public void SetToHeldPosition()
{
+72 -12
View File
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 6
Data: 7
- Name:
Entry: 7
Data:
@@ -242,19 +242,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _PCCardHeldPosition
Data: _ChoiceCardColourOptions
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardHeldPosition
Data: _ChoiceCardColourOptions
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
Data: UnityEngine.Material[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -302,19 +302,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _PCCardAnimator
Data: _PCCardHeldPosition
- Name: $v
Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardAnimator
Data: _PCCardHeldPosition
- Name: <UserType>k__BackingField
Entry: 7
Data: 21|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -362,16 +362,76 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _SelectedChoice
Data: _PCCardAnimator
- Name: $v
Entry: 7
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SelectedChoice
Data: _PCCardAnimator
- Name: <UserType>k__BackingField
Entry: 7
Data: 25|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
- 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: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 27|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: _SelectedChoice
- Name: $v
Entry: 7
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SelectedChoice
- Name: <UserType>k__BackingField
Entry: 7
Data: 29|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
@@ -380,7 +440,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
Data: 29
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -395,13 +455,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 27|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 31|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
+9 -2
View File
@@ -3,7 +3,6 @@ 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;
@@ -15,6 +14,7 @@ public class ChoiceCardGroup : UdonSharpBehaviour
[SerializeField] private PlayerPodium _Podium;
[SerializeField] private ChoiceCard[] _ChoiceCards;
[SerializeField] private TextMeshProUGUI[] _ChoiceCardText;
[SerializeField] private Material[] _ChoiceCardColourOptions;
[SerializeField] private GameObject _PCCardHeldPosition;
[SerializeField] private Animator _PCCardAnimator;
@@ -139,7 +139,7 @@ public class ChoiceCardGroup : UdonSharpBehaviour
}
}
public void ResetCards()
public void ResetCards(int Colour = 0)
{
_SelectedChoice = -1;
@@ -156,6 +156,8 @@ public class ChoiceCardGroup : UdonSharpBehaviour
_ChoiceCardText[i].text = "";
_ChoiceCardText[i].gameObject.SetActive(false);
Card.SetColourMaterial(_ChoiceCardColourOptions[Colour]);
Card.DisableInteractive = IsInVR;
VRCPickup Pickup = Card.GetComponent<VRCPickup>();
@@ -167,4 +169,9 @@ public class ChoiceCardGroup : UdonSharpBehaviour
_PCCardAnimator.SetBool("Turn Forward", false);
}
public int GetColourOptionsCount()
{
return _ChoiceCardColourOptions.Length;
}
}
+8 -3
View File
@@ -149,7 +149,7 @@ public class PlayerPodium : UdonSharpBehaviour
public void ResetPodium()
{
ResetOwner();
EnableChoiceCards(false);
EnableChoiceCards(false, 0);
EnableBuzzer(false);
HighlightPodium(false);
ShowAuxiliaryVideoScreen(false);
@@ -181,10 +181,10 @@ public class PlayerPodium : UdonSharpBehaviour
[NetworkCallable]
public void EnableChoiceCards(bool Enable)
public void EnableChoiceCards(bool Enable, int ColourChoice)
{
_ChoiceCards.gameObject.SetActive(Enable);
_ChoiceCards.ResetCards();
_ChoiceCards.ResetCards(ColourChoice);
_ChoiceCards.SendCustomNetworkEvent(NetworkEventTarget.Owner, "MakeChoiceTextVisible");
}
@@ -212,6 +212,11 @@ public class PlayerPodium : UdonSharpBehaviour
return IsCorrectResponse;
}
public int GetColourOptionsCount()
{
return _ChoiceCards.GetColourOptionsCount();
}
[NetworkCallable]
public void EnableRiskCards(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: