- Keeping logs of previous round winners so player names can be referenced.

- Round 3 sync seems to work now, but resets and early grabs cause issues.
This commit is contained in:
2025-07-18 17:04:02 -04:00
parent 6456720622
commit 999a0342d5
6 changed files with 200 additions and 71 deletions
@@ -212,6 +212,11 @@ public class CaseManager : UdonSharpBehaviour
RequestSerialization();
}
public string[] GetCurrentWinningPlayers()
{
return _CurrentWinningPlayers;
}
public string CrookToString(AccusedCrook Crook)
{
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 8
Data: 9
- Name:
Entry: 7
Data:
@@ -519,6 +519,60 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _Players
- Name: $v
Entry: 7
Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Players
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 35|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -3,8 +3,8 @@ using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
public enum PanelType
@@ -28,6 +28,7 @@ public class GameManagerRound2 : GameManagerBase
[UdonSynced] private int _StageIndex = 0;
[UdonSynced] private int _CurrentPlayerCounter = 0;
[UdonSynced] private string[] _Players = new string[2];
public override void InitialiseGameMode()
@@ -111,8 +112,17 @@ public class GameManagerRound2 : GameManagerBase
private void BeginRound()
{
_Players = _CaseManager.GetCurrentWinningPlayers();
if (_Players == null || _Players.Length != 2)
{
_Players = new string[2];
_Players[0] = Networking.GetOwner(gameObject).displayName;
_Players[1] = _Players[0];
}
HostCardRecoverTheLootInterface RecoverTheLootInterface =
(HostCardRecoverTheLootInterface)GetHostCardInterface(RoundSegmentType.RecoverTheLoot);
RecoverTheLootInterface.SetComment(_Players[_CurrentPlayerCounter % _Players.Length] + ", you're up first.", Color.black);
for (int i = 0; i < _Landmarks.Length; i++)
{
@@ -193,16 +203,20 @@ public class GameManagerRound2 : GameManagerBase
// and should also enable victory animations.
public void YoureWinner()
{
string[] Winner = new string[1];
Winner[0] = _Players[_CurrentPlayerCounter % _Players.Length];
_CaseManager.SetCurrentWinningPlayers(Winner);
HostCardRecoverTheLootInterface Interface =
(HostCardRecoverTheLootInterface)GetHostCardInterface(RoundSegmentType.RecoverTheLoot);
Interface.SetComment("Winner! Congratulations, [[PLAYER]]", Color.red);
Interface.SetComment("Winner! Congratulations, " + Winner[0], Color.red);
Interface.EnableAllPanelButtons(false);
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
"StopMusic");
EnableInteraction("Continue with the game in whatever way ends up being necessary when this is implemented");
EnableInteraction("Go To The Map");
}
@@ -229,7 +243,7 @@ public class GameManagerRound2 : GameManagerBase
Interface.EnableAllPanelButtons(true);
Interface.SetComment("[[PLAYER]], your turn.", Color.black);
Interface.SetComment(_Players[_CurrentPlayerCounter % _Players.Length] + ", your turn.", Color.black);
RequestSerialization();
}