From 757f42a8ea2c911938d8f46cbacaae3b8e3ab61a Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Wed, 16 Jul 2025 04:37:58 -0400 Subject: [PATCH] - Fixed a large number of simple sync issues during round 1. - Fixed reset issues with round 2. --- Assets/Scenes/witwics.unity | 2 +- Assets/UdonSharp/CaseVideoSyncPlayer.cs | 9 ++++----- Assets/UdonSharp/Game Managers/CaseManager.cs | 2 +- Assets/UdonSharp/Game Managers/GameManagerRound1.cs | 9 ++++++--- Assets/UdonSharp/Game Managers/GameManagerRound2.cs | 6 ++++++ Assets/UdonSharp/Podium/PlayerPodium.cs | 7 ++++--- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Assets/Scenes/witwics.unity b/Assets/Scenes/witwics.unity index 8cb05f7..4f6fd09 100644 --- a/Assets/Scenes/witwics.unity +++ b/Assets/Scenes/witwics.unity @@ -36944,7 +36944,7 @@ MonoBehaviour: _udonSharpBackingUdonBehaviour: {fileID: 2057791819} _GameManager: {fileID: 515404446} _VideoPlayer: {fileID: 2057791821} - SyncFrequency: 5 + SyncFrequency: 0 _BlankScreenMesh: {fileID: 616351405} _VideoScreenMesh: {fileID: 1123401066} _MapScreenMesh: {fileID: 1005643829} diff --git a/Assets/UdonSharp/CaseVideoSyncPlayer.cs b/Assets/UdonSharp/CaseVideoSyncPlayer.cs index b891e22..9849967 100644 --- a/Assets/UdonSharp/CaseVideoSyncPlayer.cs +++ b/Assets/UdonSharp/CaseVideoSyncPlayer.cs @@ -130,8 +130,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour public override void OnVideoStart() { - Debug.LogError("Displaying video material..."); - ShowScreen = ClueScreenType.Video; UpdateTimeAndOffset(); @@ -143,7 +141,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour if (Networking.IsOwner(gameObject)) { TimeAndOffset = new Vector2(_VideoPlayer.GetTime(), (float)Networking.GetServerTimeInSeconds()); - RequestSerialization(); if (SyncFrequency > 0.0f) { @@ -152,8 +149,10 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour } else { - SendCustomEvent(nameof(Resync)); + Resync(); } + + RequestSerialization(); } public void Resync() @@ -252,7 +251,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour _TimeAndOffset = value; if (!Networking.IsOwner(gameObject)) { - SendCustomEvent(nameof(Resync)); + Resync(); } } get => _TimeAndOffset; diff --git a/Assets/UdonSharp/Game Managers/CaseManager.cs b/Assets/UdonSharp/Game Managers/CaseManager.cs index 140be66..a747430 100644 --- a/Assets/UdonSharp/Game Managers/CaseManager.cs +++ b/Assets/UdonSharp/Game Managers/CaseManager.cs @@ -111,7 +111,7 @@ public class CaseManager : UdonSharpBehaviour ErrorString = "Ensure the 'Round 3' dictionary entry is a dictionary with a key called 'Continent' and an integer value."; } - ContinueToRound3(); + ContinueToRound1(); } else { diff --git a/Assets/UdonSharp/Game Managers/GameManagerRound1.cs b/Assets/UdonSharp/Game Managers/GameManagerRound1.cs index c7c5f9f..2d69ab2 100644 --- a/Assets/UdonSharp/Game Managers/GameManagerRound1.cs +++ b/Assets/UdonSharp/Game Managers/GameManagerRound1.cs @@ -439,7 +439,8 @@ public class GameManagerRound1 : GameManagerBase int PodiumIndex = _BuzzedInPlayer - 1; if (PodiumIndex >= 0 && PodiumIndex < _PlayerPodiums.Length) { - _PlayerPodiums[PodiumIndex].AdjustScore(5); + _PlayerPodiums[PodiumIndex].SendCustomNetworkEvent(NetworkEventTarget.Owner, + "AdjustScore", 5); } EndBuzzInPeriod(); @@ -536,7 +537,8 @@ public class GameManagerRound1 : GameManagerBase int PodiumIndex = _BuzzedInPlayer - 1; if (PodiumIndex >= 0 && PodiumIndex < _PlayerPodiums.Length) { - _PlayerPodiums[PodiumIndex].AdjustScore(5); + _PlayerPodiums[PodiumIndex].SendCustomNetworkEvent(NetworkEventTarget.Owner, + "AdjustScore", 5); } } @@ -1026,7 +1028,8 @@ public class GameManagerRound1 : GameManagerBase int PodiumIndex = _BuzzedInPlayer - 1; if (PodiumIndex >= 0 && PodiumIndex < _PlayerPodiums.Length) { - _PlayerPodiums[PodiumIndex].AdjustScore(5); + _PlayerPodiums[PodiumIndex].SendCustomNetworkEvent(NetworkEventTarget.Owner, + "AdjustScore", 5); } _BuzzedInPlayer = -1; diff --git a/Assets/UdonSharp/Game Managers/GameManagerRound2.cs b/Assets/UdonSharp/Game Managers/GameManagerRound2.cs index 78c1725..8a18faf 100644 --- a/Assets/UdonSharp/Game Managers/GameManagerRound2.cs +++ b/Assets/UdonSharp/Game Managers/GameManagerRound2.cs @@ -33,6 +33,12 @@ public class GameManagerRound2 : GameManagerBase { _StageIndex = 0; + LocationBoardReset(); + + // Make sure we have the correct interface up after the last function. + HostCardBetweenRoundsInterface Interface = + (HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments); + base.InitialiseGameMode(); } diff --git a/Assets/UdonSharp/Podium/PlayerPodium.cs b/Assets/UdonSharp/Podium/PlayerPodium.cs index 883f79d..992ae4d 100644 --- a/Assets/UdonSharp/Podium/PlayerPodium.cs +++ b/Assets/UdonSharp/Podium/PlayerPodium.cs @@ -102,6 +102,7 @@ public class PlayerPodium : UdonSharpBehaviour RequestSerialization(); } + [NetworkCallable] public void AdjustScore(int Adjustment) { PlayerScore += Adjustment; @@ -141,7 +142,7 @@ public class PlayerPodium : UdonSharpBehaviour bool IsCorrectResponse = _ChoiceCards.GetSelectedChoice() == CorrectResponse; if (IsCorrectResponse) { - AdjustScore(10); + SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(AdjustScore), 10); } return IsCorrectResponse; @@ -174,11 +175,11 @@ public class PlayerPodium : UdonSharpBehaviour { if (_ChoiceCards.GetSelectedChoice() == CorrectResponse) { - AdjustScore(_RiskCards.GetSelectedChoice()); + SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(AdjustScore), _RiskCards.GetSelectedChoice()); } else { - AdjustScore(-_RiskCards.GetSelectedChoice()); + SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(AdjustScore), -_RiskCards.GetSelectedChoice()); } }