From 8ea69143d9fe1204a47230c56f45cd9b374ebc43 Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Sat, 26 Jul 2025 03:58:02 -0400 Subject: [PATCH] Map loading code reworked to queue and auto-download multiple atlases. --- Assets/Scenes/witwics.unity | 2 + ...d1Placeholder.png => T_MapPlaceholder.png} | Bin ...der.png.meta => T_MapPlaceholder.png.meta} | 0 Assets/UdonSharp/CaseVideoSyncPlayer.asset | 406 +++++++++++++++--- Assets/UdonSharp/CaseVideoSyncPlayer.cs | 113 +++-- Assets/UdonSharp/Game Managers/CaseManager.cs | 6 +- .../Game Managers/GameManagerRound1.cs | 74 ++-- ProjectSettings/AudioManager.asset | 4 +- 8 files changed, 468 insertions(+), 137 deletions(-) rename Assets/Textures/Maps/{T_Round1Placeholder.png => T_MapPlaceholder.png} (100%) rename Assets/Textures/Maps/{T_Round1Placeholder.png.meta => T_MapPlaceholder.png.meta} (100%) diff --git a/Assets/Scenes/witwics.unity b/Assets/Scenes/witwics.unity index 4fc2012..ff15739 100644 --- a/Assets/Scenes/witwics.unity +++ b/Assets/Scenes/witwics.unity @@ -51674,6 +51674,8 @@ MonoBehaviour: _BlankScreenMesh: {fileID: 616351405} _VideoScreenMesh: {fileID: 1123401066} _MapScreenMesh: {fileID: 1005643829} + _PlaceholderMapTexture: {fileID: 2800000, guid: 44aab33f67dfa2949a8bd0a7e20d40e7, + type: 3} --- !u!114 &2057791821 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Textures/Maps/T_Round1Placeholder.png b/Assets/Textures/Maps/T_MapPlaceholder.png similarity index 100% rename from Assets/Textures/Maps/T_Round1Placeholder.png rename to Assets/Textures/Maps/T_MapPlaceholder.png diff --git a/Assets/Textures/Maps/T_Round1Placeholder.png.meta b/Assets/Textures/Maps/T_MapPlaceholder.png.meta similarity index 100% rename from Assets/Textures/Maps/T_Round1Placeholder.png.meta rename to Assets/Textures/Maps/T_MapPlaceholder.png.meta diff --git a/Assets/UdonSharp/CaseVideoSyncPlayer.asset b/Assets/UdonSharp/CaseVideoSyncPlayer.asset index 8a367d0..76e82ec 100644 --- a/Assets/UdonSharp/CaseVideoSyncPlayer.asset +++ b/Assets/UdonSharp/CaseVideoSyncPlayer.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 13 + Data: 18 - Name: Entry: 7 Data: @@ -126,21 +126,15 @@ MonoBehaviour: - Name: k__BackingField Entry: 7 Data: 8|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: SubMap, Assembly-CSharp - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 9|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Int32, mscorlib - Name: Entry: 8 Data: + - Name: k__BackingField + Entry: 9 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -155,19 +149,19 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 2 - Name: Entry: 7 - Data: 11|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime + Data: 10|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: - Name: Entry: 7 - Data: 12|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime + Data: 11|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: @@ -191,13 +185,13 @@ MonoBehaviour: Data: _ShowScreen - Name: $v Entry: 7 - Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _ShowScreen - Name: k__BackingField Entry: 7 - Data: 14|System.RuntimeType, mscorlib + Data: 13|System.RuntimeType, mscorlib - Name: Entry: 1 Data: ClueScreenType, Assembly-CSharp @@ -206,7 +200,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 9 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -221,19 +215,19 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 2 - Name: Entry: 7 - Data: 16|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime + Data: 15|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: - Name: Entry: 7 - Data: 17|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime + Data: 16|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: @@ -257,13 +251,13 @@ MonoBehaviour: Data: _FlashCorrectAnswer - Name: $v Entry: 7 - Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _FlashCorrectAnswer - Name: k__BackingField Entry: 7 - Data: 19|System.RuntimeType, mscorlib + Data: 18|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Boolean, mscorlib @@ -272,7 +266,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 19 + Data: 18 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -287,13 +281,13 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 21|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime + Data: 20|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: @@ -317,13 +311,13 @@ MonoBehaviour: Data: _VideoPlayer - Name: $v Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _VideoPlayer - Name: k__BackingField Entry: 7 - Data: 23|System.RuntimeType, mscorlib + Data: 22|System.RuntimeType, mscorlib - Name: Entry: 1 Data: VRC.SDK3.Video.Components.Base.BaseVRCVideoPlayer, VRCSDK3 @@ -332,7 +326,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 23 + Data: 22 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -347,13 +341,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 25|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 24|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -377,13 +371,13 @@ MonoBehaviour: Data: _VideoURL - Name: $v Entry: 7 - Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _VideoURL - Name: k__BackingField Entry: 7 - Data: 27|System.RuntimeType, mscorlib + Data: 26|System.RuntimeType, mscorlib - Name: Entry: 1 Data: VRC.SDKBase.VRCUrl, VRCSDKBase @@ -392,7 +386,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 27 + Data: 26 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -407,19 +401,19 @@ MonoBehaviour: Data: false - 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: 2 - Name: Entry: 7 - Data: 29|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime + Data: 28|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: - Name: Entry: 7 - Data: 30|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime + Data: 29|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: @@ -443,13 +437,13 @@ MonoBehaviour: Data: _TimeAndOffset - Name: $v Entry: 7 - Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _TimeAndOffset - Name: k__BackingField Entry: 7 - Data: 32|System.RuntimeType, mscorlib + Data: 31|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector2, UnityEngine.CoreModule @@ -458,7 +452,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 32 + Data: 31 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -473,19 +467,19 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 2 - Name: Entry: 7 - Data: 34|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime + Data: 33|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: - Name: Entry: 7 - Data: 35|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime + Data: 34|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - Name: Entry: 8 Data: @@ -509,13 +503,13 @@ MonoBehaviour: Data: SyncFrequency - Name: $v Entry: 7 - Data: 36|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: SyncFrequency - Name: k__BackingField Entry: 7 - Data: 37|System.RuntimeType, mscorlib + Data: 36|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Single, mscorlib @@ -524,7 +518,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 37 + Data: 36 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -539,7 +533,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -563,13 +557,13 @@ MonoBehaviour: Data: _BlankScreenMesh - Name: $v Entry: 7 - Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _BlankScreenMesh - Name: k__BackingField Entry: 7 - Data: 40|System.RuntimeType, mscorlib + Data: 39|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule @@ -578,7 +572,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 40 + Data: 39 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -593,13 +587,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 41|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 42|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 41|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -623,16 +617,16 @@ MonoBehaviour: Data: _VideoScreenMesh - Name: $v Entry: 7 - Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _VideoScreenMesh - Name: k__BackingField Entry: 9 - Data: 40 + Data: 39 - Name: k__BackingField Entry: 9 - Data: 40 + Data: 39 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -647,13 +641,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 45|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 44|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -677,16 +671,16 @@ MonoBehaviour: Data: _MapScreenMesh - Name: $v Entry: 7 - Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _MapScreenMesh - Name: k__BackingField Entry: 9 - Data: 40 + Data: 39 - Name: k__BackingField Entry: 9 - Data: 40 + Data: 39 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -701,13 +695,73 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 48|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 47|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: _PlaceholderMapTexture + - Name: $v + Entry: 7 + Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _PlaceholderMapTexture + - Name: k__BackingField + Entry: 7 + Data: 49|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.Texture2D, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 49 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: true + - Name: _fieldAttributes + Entry: 7 + Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 51|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -731,13 +785,13 @@ MonoBehaviour: Data: _MapDownloader - Name: $v Entry: 7 - Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _MapDownloader - Name: k__BackingField Entry: 7 - Data: 50|System.RuntimeType, mscorlib + Data: 53|System.RuntimeType, mscorlib - Name: Entry: 1 Data: VRC.SDK3.Image.VRCImageDownloader, VRCSDK3 @@ -746,7 +800,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 50 + Data: 53 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -761,7 +815,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -782,19 +836,25 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: _CurrentMapURL + Data: _MapImages - Name: $v Entry: 7 - Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: _CurrentMapURL + Data: _MapImages - Name: k__BackingField - Entry: 9 - Data: 27 + Entry: 7 + Data: 56|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.Texture2D[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 9 - Data: 27 + Data: 56 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -809,7 +869,211 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 57|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: _UdonEventReceiverThis + - Name: $v + Entry: 7 + Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _UdonEventReceiverThis + - Name: k__BackingField + Entry: 7 + Data: 59|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.Common.Interfaces.IUdonEventReceiver, VRC.Udon.Common + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 59 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 60|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: _CachedMapIndices + - Name: $v + Entry: 7 + Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _CachedMapIndices + - Name: k__BackingField + Entry: 7 + Data: 62|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32[], mscorlib + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 62 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 63|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: _MapDownloadIndex + - Name: $v + Entry: 7 + Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _MapDownloadIndex + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 65|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: _MapDownloadsInProgress + - Name: $v + Entry: 7 + Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _MapDownloadsInProgress + - Name: k__BackingField + Entry: 9 + Data: 18 + - Name: k__BackingField + Entry: 9 + Data: 18 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Assets/UdonSharp/CaseVideoSyncPlayer.cs b/Assets/UdonSharp/CaseVideoSyncPlayer.cs index 9849967..81744fe 100644 --- a/Assets/UdonSharp/CaseVideoSyncPlayer.cs +++ b/Assets/UdonSharp/CaseVideoSyncPlayer.cs @@ -15,15 +15,15 @@ public enum ClueScreenType Map } -public enum SubMap -{ - NoLabels, - OneLabel, - TwoLabels, - ThreeLabels, - CorrectLit, - OnlyCorrect -} +//public enum SubMap +//{ +// NoLabels, // 0 +// OneLabel, // 1 +// TwoLabels, // 2 +// ThreeLabels, // 3 +// CorrectLit, // 4 +// OnlyCorrect // 5 +//} [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] @@ -31,7 +31,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour { [SerializeField] private GameManagerRound1 _GameManager; - [UdonSynced, FieldChangeCallback(nameof(SubMapIndex))] private SubMap _SubMapIndex = 0; + [UdonSynced, FieldChangeCallback(nameof(SubMapIndex))] private int _SubMapIndex = 0; [UdonSynced, FieldChangeCallback(nameof(ShowScreen))] private ClueScreenType _ShowScreen = ClueScreenType.Blank; [FieldChangeCallback(nameof(FlashCorrectAnswer))] private bool _FlashCorrectAnswer = false; @@ -44,13 +44,22 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour [SerializeField] private MeshRenderer _VideoScreenMesh; [SerializeField] private MeshRenderer _MapScreenMesh; + [SerializeField] private Texture2D _PlaceholderMapTexture; + private VRCImageDownloader _MapDownloader; - private VRCUrl _CurrentMapURL; + private Texture2D[] _MapImages; + private IUdonEventReceiver _UdonEventReceiverThis; + private int[] _CachedMapIndices = new int[0]; + private int _MapDownloadIndex = 0; + private bool _MapDownloadsInProgress = false; + + private const int IMAGES_PER_MAP_ATLAS = 6; void Start() { _MapDownloader = new VRCImageDownloader(); + _UdonEventReceiverThis = (IUdonEventReceiver)this; } void OnDestroy() @@ -60,40 +69,70 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour [NetworkCallable] - public void LoadMap(int MapIndex) + public void QueueMapDownloads(int[] MapIndices) + { + if (_MapDownloadsInProgress) + { + Debug.LogError("[CaseVideoSyncPlayer] Cannot currently requeue a map download while one is in progress."); + return; + } + + _MapDownloadsInProgress = true; + _CachedMapIndices = MapIndices; + + _MapImages = new Texture2D[_CachedMapIndices.Length]; + for (int i = 0; i < _MapImages.Length; i++) + { + _MapImages[i] = _PlaceholderMapTexture; + } + + _SubMapIndex = 0; + _MapDownloadIndex = 0; + LoadMapFromIndex(_CachedMapIndices[_MapDownloadIndex]); + } + private void LoadMapFromIndex(int MapIndex) { VRCUrl MapURL = _GameManager.GetMapURL(MapIndex); - if (MapURL == _CurrentMapURL) return; - _CurrentMapURL = MapURL; - - SubMapIndex = 0; - ShowScreen = ClueScreenType.Blank; TextureInfo AdditionalTextureInfo = new TextureInfo(); AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp; AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp; AdditionalTextureInfo.GenerateMipMaps = false; - AdditionalTextureInfo.MaterialProperty = "_EmissionMap"; _MapDownloader.DownloadImage( - _CurrentMapURL, - _MapScreenMesh.sharedMaterial, - (IUdonEventReceiver)this, - AdditionalTextureInfo); + MapURL, null, _UdonEventReceiverThis, AdditionalTextureInfo); } - public override void OnImageLoadSuccess(IVRCImageDownload result) + public override void OnImageLoadSuccess(IVRCImageDownload Result) { - base.OnImageLoadSuccess(result); + _MapImages[_MapDownloadIndex] = Result.Result; + + int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS; + if (MapPage == _CachedMapIndices[MapPage]) + { + _MapScreenMesh.sharedMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]); + } + + _MapDownloadIndex++; + if (_MapDownloadIndex >= _CachedMapIndices.Length) + { + _MapDownloadsInProgress = false; + } + else + { + LoadMapFromIndex(_CachedMapIndices[_MapDownloadIndex]); + } + + base.OnImageLoadSuccess(Result); } - public override void OnImageLoadError(IVRCImageDownload result) + public override void OnImageLoadError(IVRCImageDownload Result) { - base.OnImageLoadError(result); + base.OnImageLoadError(Result); } public void NextCorrectAnswerFrame() { if (FlashCorrectAnswer) { - SubMapIndex = (SubMapIndex == SubMap.CorrectLit) ? SubMap.ThreeLabels : SubMap.CorrectLit; + SubMapIndex = (SubMapIndex == 4) ? 3 : 4; SendCustomEventDelayedSeconds(nameof(NextCorrectAnswerFrame), 0.2f); } else @@ -106,16 +145,20 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour private void UpdateMap() { - switch (SubMapIndex) + int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS; + int SubmapIndexWrapped = SubMapIndex % IMAGES_PER_MAP_ATLAS; + + switch (SubmapIndexWrapped) { - case SubMap.NoLabels: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.66666666f)); break; - case SubMap.OneLabel: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.66666666f)); break; - case SubMap.TwoLabels: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.33333333f)); break; - case SubMap.ThreeLabels: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.33333333f)); break; - case SubMap.CorrectLit: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.0f)); break; - case SubMap.OnlyCorrect: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.0f)); break; + case 0: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.66666666f)); break; + case 1: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.66666666f)); break; + case 2: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.33333333f)); break; + case 3: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.33333333f)); break; + case 4: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.0f)); break; + case 5: _MapScreenMesh.sharedMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.0f)); break; } + _MapScreenMesh.sharedMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]); ShowScreen = ClueScreenType.Map; RequestSerialization(); @@ -201,7 +244,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour } - public SubMap SubMapIndex + public int SubMapIndex { set { diff --git a/Assets/UdonSharp/Game Managers/CaseManager.cs b/Assets/UdonSharp/Game Managers/CaseManager.cs index 10ea84d..f42f193 100644 --- a/Assets/UdonSharp/Game Managers/CaseManager.cs +++ b/Assets/UdonSharp/Game Managers/CaseManager.cs @@ -112,7 +112,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 { @@ -185,6 +185,10 @@ public class CaseManager : UdonSharpBehaviour { return _CaseFileMaps[MapIndex]; } + public int GetMapCount() + { + return _CaseFileMaps.Length; + } public VRCUrl GetLootImage() { diff --git a/Assets/UdonSharp/Game Managers/GameManagerRound1.cs b/Assets/UdonSharp/Game Managers/GameManagerRound1.cs index b3afbe2..be2823f 100644 --- a/Assets/UdonSharp/Game Managers/GameManagerRound1.cs +++ b/Assets/UdonSharp/Game Managers/GameManagerRound1.cs @@ -60,9 +60,6 @@ public class GameManagerRound1 : GameManagerBase _PlayerBuzzInAllowed = new bool[_PlayerPodiums.Length]; - _AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopMusic"); - _AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopSFX"); - RequestSerialization(); base.InitialiseGameMode(); } @@ -92,7 +89,7 @@ public class GameManagerRound1 : GameManagerBase } Interface.HeaderUI.text = - "Found " + _QuestionsList.Count + " questions in this case file. Press 'Use' button to show scores."; + "Case has been loaded. "; _GameHasBegun = false; EnableInteraction("Start Game"); @@ -116,6 +113,19 @@ public class GameManagerRound1 : GameManagerBase // Again, why does this work, but not just casting to an enum? _CurrentQuestionType = (RoundSegmentType)(int)_CurrentQuestion["Type"].Number; _QuestionStage = 0; + + if (_CurrentQuestion.ContainsKey("Maps") && _CurrentQuestion["Maps"].TokenType == TokenType.DataList) + { + DataList Maps = _CurrentQuestion["Maps"].DataList; + int[] MapIndices = new int[Maps.Count]; + for (int i = 0; i < MapIndices.Length; i++) + { + MapIndices[i] = (int)Maps[i].Number; + } + + NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_VideoPlayer, NetworkEventTarget.All, + "QueueMapDownloads", MapIndices); + } } private void AssignStarterPoints() @@ -159,16 +169,6 @@ public class GameManagerRound1 : GameManagerBase return; } - if (_CurrentQuestion.ContainsKey("Maps") && _CurrentQuestion["Maps"].TokenType == TokenType.DataList) - { - DataList Maps = _CurrentQuestion["Maps"].DataList; - for (int i = 0; i < Maps.Count; i++) - { - NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_VideoPlayer, NetworkEventTarget.All, - "LoadMap", (int)Maps[i].Number); - } - } - DataDictionary Presentation = _CurrentQuestion["Presentation"].DataDictionary; switch ((PresentationMedium)(int)Presentation["Medium"].Number) { @@ -190,7 +190,14 @@ public class GameManagerRound1 : GameManagerBase _VideoPlayer.VideoURL = _CaseManager.GetVideo((int)Videos[_QuestionSubstage].Number); _QuestionSubstage++; - EnableInteraction("Play Video"); + if (_QuestionSubstage < Videos.Count) + { + EnableInteraction("Play Video"); + } + else + { + EnableInteraction("Reveal Question"); + } } else { @@ -207,18 +214,25 @@ public class GameManagerRound1 : GameManagerBase private void InitialiseACMECrimenetComputer(DataDictionary Presentation) { - HostCardBetweenRoundsInterface Interface = - (HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments); - Interface.HeaderUI.text = "This part isn't done yet. This will eventually have a really cool computer give you the clue."; + if (_QuestionSubstage < 1) + { + HostCardBetweenRoundsInterface Interface = + (HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments); + Interface.HeaderUI.text = "This part isn't done yet. This will eventually have a really cool computer give you the clue."; - _QuestionSubstage = 0; - MultipleChoiceRevealQuestion(); + _QuestionSubstage++; + EnableInteraction("Reveal Question"); + } + else + { + MultipleChoiceRevealQuestion(); + } } private void MultipleChoiceRevealQuestion() { _QuestionSubstage = 0; - _VideoPlayer.SubMapIndex = SubMap.NoLabels; + _VideoPlayer.SubMapIndex = 0; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice); @@ -253,7 +267,7 @@ public class GameManagerRound1 : GameManagerBase private void MultipleChoiceRevealChoice1() { - _VideoPlayer.SubMapIndex = SubMap.OneLabel; + _VideoPlayer.SubMapIndex = 1; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice); @@ -267,7 +281,7 @@ public class GameManagerRound1 : GameManagerBase } private void MultipleChoiceRevealChoice2() { - _VideoPlayer.SubMapIndex = SubMap.TwoLabels; + _VideoPlayer.SubMapIndex = 2; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice); @@ -281,7 +295,7 @@ public class GameManagerRound1 : GameManagerBase } private void MultipleChoiceRevealChoice3() { - _VideoPlayer.SubMapIndex = SubMap.ThreeLabels; + _VideoPlayer.SubMapIndex = 3; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.MultipleChoice); @@ -597,7 +611,7 @@ public class GameManagerRound1 : GameManagerBase private void FinalRoundShowMapPreview() { - _VideoPlayer.SubMapIndex = SubMap.ThreeLabels; + _VideoPlayer.SubMapIndex = 3; EnableRiskCards(); @@ -656,7 +670,7 @@ public class GameManagerRound1 : GameManagerBase } private void FinalRoundRevealChoice1() { - _VideoPlayer.SubMapIndex = SubMap.OneLabel; + _VideoPlayer.SubMapIndex = 1; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound); @@ -669,7 +683,7 @@ public class GameManagerRound1 : GameManagerBase } private void FinalRoundRevealChoice2() { - _VideoPlayer.SubMapIndex = SubMap.TwoLabels; + _VideoPlayer.SubMapIndex = 2; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound); @@ -682,7 +696,7 @@ public class GameManagerRound1 : GameManagerBase } private void FinalRoundRevealChoice3() { - _VideoPlayer.SubMapIndex = SubMap.ThreeLabels; + _VideoPlayer.SubMapIndex = 3; HostCardMultipleChoiceInterface Interface = (HostCardMultipleChoiceInterface)GetHostCardInterface(RoundSegmentType.FinalRound); @@ -1327,6 +1341,10 @@ public class GameManagerRound1 : GameManagerBase { return _CaseManager.GetMap(MapIndex); } + public int GetMapCount() + { + return _CaseManager.GetMapCount(); + } protected override void _HostCardUseButtonDown_Internal() diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset index d925021..ba6209e 100644 --- a/ProjectSettings/AudioManager.asset +++ b/ProjectSettings/AudioManager.asset @@ -10,8 +10,8 @@ AudioManager: Default Speaker Mode: 2 m_SampleRate: 48000 m_DSPBufferSize: 1024 - m_VirtualVoiceCount: 32 - m_RealVoiceCount: 24 + m_VirtualVoiceCount: 64 + m_RealVoiceCount: 32 m_EnableOutputSuspension: 1 m_SpatializerPlugin: OculusSpatializer m_AmbisonicDecoderPlugin: OculusSpatializer