From 846e35c1e98936b85154df67c4a33c5f494a9dd9 Mon Sep 17 00:00:00 2001 From: JaXt0r <120568393+JaXt0r@users.noreply.github.com> Date: Sat, 27 Jan 2024 06:29:01 +0100 Subject: [PATCH 1/2] fix(ControllerManager): Now waits until GVR is bootstrapped before loading stuff. --- Assets/GothicVR/Scripts/Globals/GvrEvents.cs | 2 ++ Assets/GothicVR/Scripts/Manager/GvrBootstrapper.cs | 5 +++-- .../Scripts/Player/BasicMovement/ControllerManager.cs | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Assets/GothicVR/Scripts/Globals/GvrEvents.cs b/Assets/GothicVR/Scripts/Globals/GvrEvents.cs index 5db1a1d23..238827c74 100644 --- a/Assets/GothicVR/Scripts/Globals/GvrEvents.cs +++ b/Assets/GothicVR/Scripts/Globals/GvrEvents.cs @@ -9,6 +9,8 @@ namespace GVR.Globals /// public static class GvrEvents { + public static readonly UnityEvent ZenKitBootstrapped = new(); + public static readonly UnityEvent MainMenuSceneLoaded = new(); public static readonly UnityEvent MainMenuSceneUnloaded = new(); diff --git a/Assets/GothicVR/Scripts/Manager/GvrBootstrapper.cs b/Assets/GothicVR/Scripts/Manager/GvrBootstrapper.cs index a0e595467..d50403ade 100644 --- a/Assets/GothicVR/Scripts/Manager/GvrBootstrapper.cs +++ b/Assets/GothicVR/Scripts/Manager/GvrBootstrapper.cs @@ -76,13 +76,14 @@ public static void BootGothicVR(string g1Dir) LoadDialogs(); LoadSfxVm(g1Dir); LoadPfxVm(g1Dir); - LoadMusicVv(g1Dir); + LoadMusicVm(g1Dir); LoadMusic(); LoadFonts(); watch.Stop(); Debug.Log($"Time spent for Bootstrapping ZenKit: {watch.Elapsed}"); + GvrEvents.ZenKitBootstrapped.Invoke(); } public static void ZenKitLoggerCallback(LogLevel level, string name, string message) @@ -184,7 +185,7 @@ private static void LoadPfxVm(string g1Dir) GameData.PfxVm = new DaedalusVm(fullPath); } - private static void LoadMusicVv(string g1Dir) + private static void LoadMusicVm(string g1Dir) { var fullPath = Path.GetFullPath(Path.Join(g1Dir, "/_work/DATA/scripts/_compiled/MUSIC.DAT")); GameData.MusicVm = new DaedalusVm(fullPath); diff --git a/Assets/GothicVR/Scripts/Player/BasicMovement/ControllerManager.cs b/Assets/GothicVR/Scripts/Player/BasicMovement/ControllerManager.cs index 067f9bff0..0a29f8dc6 100644 --- a/Assets/GothicVR/Scripts/Player/BasicMovement/ControllerManager.cs +++ b/Assets/GothicVR/Scripts/Player/BasicMovement/ControllerManager.cs @@ -4,6 +4,7 @@ using System.Linq; using GVR.Data; using GVR.Extensions; +using GVR.Globals; using GVR.GothicVR.Scripts.Manager; using GVR.Util; using TMPro; @@ -34,10 +35,13 @@ public class ControllerManager : SingletonBehaviour AudioSource mapaudio; AudioClip scrollsound; - protected override void Awake() + private void Start() { - base.Awake(); + GvrEvents.ZenKitBootstrapped.AddListener(Initialize); + } + private void Initialize() + { maproll = MapObject.gameObject.GetComponent(); mapaudio = MapObject.gameObject.GetComponent(); scrollsound = VobHelper.GetSoundClip("SCROLLROLL.WAV"); From 38ab2b9c7080bafe41309d273a1d52ee5574561b Mon Sep 17 00:00:00 2001 From: JaXt0r <120568393+JaXt0r@users.noreply.github.com> Date: Sat, 27 Jan 2024 06:42:24 +0100 Subject: [PATCH 2/2] fix(Lab): Game stops crashing. --- Assets/GothicVR-Lab/Scenes/Lab.unity | 45 ++++++++++--------- .../Handler/{IHandler.cs => ILabHandler.cs} | 2 +- .../{IHandler.cs.meta => ILabHandler.cs.meta} | 0 ...bleHandler.cs => LabLockableLabHandler.cs} | 2 +- ....cs.meta => LabLockableLabHandler.cs.meta} | 0 .../{NpcHandler.cs => LabNpcLabHandler.cs} | 7 +-- ...ndler.cs.meta => LabNpcLabHandler.cs.meta} | 0 ...cs => LabVobHandAttachPointsLabHandler.cs} | 2 +- ... LabVobHandAttachPointsLabHandler.cs.meta} | 0 .../GothicVR-Lab/Scripts/LabBootstrapper.cs | 12 ++--- 10 files changed, 34 insertions(+), 36 deletions(-) rename Assets/GothicVR-Lab/Scripts/Handler/{IHandler.cs => ILabHandler.cs} (70%) rename Assets/GothicVR-Lab/Scripts/Handler/{IHandler.cs.meta => ILabHandler.cs.meta} (100%) rename Assets/GothicVR-Lab/Scripts/Handler/{LockableHandler.cs => LabLockableLabHandler.cs} (91%) rename Assets/GothicVR-Lab/Scripts/Handler/{LockableHandler.cs.meta => LabLockableLabHandler.cs.meta} (100%) rename Assets/GothicVR-Lab/Scripts/Handler/{NpcHandler.cs => LabNpcLabHandler.cs} (90%) rename Assets/GothicVR-Lab/Scripts/Handler/{NpcHandler.cs.meta => LabNpcLabHandler.cs.meta} (100%) rename Assets/GothicVR-Lab/Scripts/Handler/{VobHandAttachPointsHandler.cs => LabVobHandAttachPointsLabHandler.cs} (99%) rename Assets/GothicVR-Lab/Scripts/Handler/{VobHandAttachPointsHandler.cs.meta => LabVobHandAttachPointsLabHandler.cs.meta} (100%) diff --git a/Assets/GothicVR-Lab/Scenes/Lab.unity b/Assets/GothicVR-Lab/Scenes/Lab.unity index 2c84255b9..029015e16 100644 --- a/Assets/GothicVR-Lab/Scenes/Lab.unity +++ b/Assets/GothicVR-Lab/Scenes/Lab.unity @@ -2172,7 +2172,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7387125324240799344, guid: efebdf03cb1ccd043827e933755e413e, type: 3} propertyPath: m_AnchoredPosition.x - value: 122 + value: 0 objectReference: {fileID: 0} - target: {fileID: 7387125324240799344, guid: efebdf03cb1ccd043827e933755e413e, type: 3} propertyPath: m_AnchoredPosition.y @@ -3167,7 +3167,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6242851353689079636, guid: f9da24840c60a814295b88e6319d9f9c, type: 3} propertyPath: m_AnchoredPosition.x - value: 91 + value: 0 objectReference: {fileID: 0} - target: {fileID: 6242851353689079636, guid: f9da24840c60a814295b88e6319d9f9c, type: 3} propertyPath: m_AnchoredPosition.y @@ -3301,6 +3301,7 @@ MonoBehaviour: arrowMaterial: {fileID: 2100000, guid: dc6ce4e18c065d34f9037b5b60259872, type: 2} fillerMaterial: {fileID: 2100000, guid: 7f15366450c487344a1e66a13b22a847, type: 2} skyMaterial: {fileID: 2100000, guid: 39ac659c922b5b1489714aacd9b952e9, type: 2} + mapMaterial: {fileID: 0} gothicLoadingMenuMaterial: {fileID: 0} loadingBarBackgroundMaterial: {fileID: 0} loadingBarMaterial: {fileID: 0} @@ -3320,11 +3321,13 @@ MonoBehaviour: skipMainMenu: 0 useXRDeviceSimulator: 0 createWorldMesh: 0 - createWaypoints: 0 vobItemsDynamicAttach: 0 - createWayPointMeshes: 0 - createWaypointEdgeMeshes: 0 - enableDayTime: 0 + showBarrier: 0 + drawWayPoints: 0 + drawWaypointEdges: 0 + drawFreePoints: 0 + spawnAtSpecificWayNetPoint: + TimeMultiplier: 0 sunMovementPerformanceValue: 0 startHour: 0 startMinute: 0 @@ -3340,8 +3343,6 @@ MonoBehaviour: vobCullingLarge: maxObjectSize: 0 cullingDistance: 0 - spawnAtSpecificFreePoint: - drawFreePointMeshes: 0 drawVobCullingGizmos: 0 vobTypeToSpawn: createOcNpcs: 0 @@ -3353,8 +3354,8 @@ MonoBehaviour: enableVobParticles: 0 zenKitLogLevel: 3 showZspyLogs: 1 - showZenKitVfsFileNotFoundErrors: 0 showMusicLogs: 0 + showBarrierLogs: 0 --- !u!114 &464842616 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4652,7 +4653,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.x - value: 181.14 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.y @@ -4660,7 +4661,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.x - value: 147.05 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.y @@ -7843,7 +7844,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8107108474233336363, guid: 49e2fbde9521b4341879174df5a51b64, type: 3} propertyPath: m_SizeDelta.x - value: 262.09998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8107108474233336363, guid: 49e2fbde9521b4341879174df5a51b64, type: 3} propertyPath: m_SizeDelta.y @@ -7851,7 +7852,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8107108474233336363, guid: 49e2fbde9521b4341879174df5a51b64, type: 3} propertyPath: m_AnchoredPosition.x - value: 147.04999 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8107108474233336363, guid: 49e2fbde9521b4341879174df5a51b64, type: 3} propertyPath: m_AnchoredPosition.y @@ -8950,7 +8951,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.x - value: 262.09998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.y @@ -8958,7 +8959,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.x - value: 147.04999 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.y @@ -9765,7 +9766,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.x - value: 262.1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.y @@ -9773,7 +9774,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.x - value: 147.05 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.y @@ -16344,7 +16345,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.x - value: 178.94 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_SizeDelta.y @@ -16352,7 +16353,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.x - value: 147.05 + value: 0 objectReference: {fileID: 0} - target: {fileID: 781630663273105846, guid: fcac0c3f142ea3742a0565751dec41de, type: 3} propertyPath: m_AnchoredPosition.y @@ -17393,9 +17394,9 @@ MonoBehaviour: bootNpcHandler: 1 bootLockableHandler: 0 bootAttachPointHandler: 0 - npcHandler: {fileID: 1791413021} - lockableHandler: {fileID: 1956714045} - vobHandAttachPointsHandler: {fileID: 330949651} + npcLabHandler: {fileID: 1791413021} + lockableLabHandler: {fileID: 1956714045} + vobHandAttachPointsLabHandler: {fileID: 330949651} --- !u!1001 &2119216504 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/GothicVR-Lab/Scripts/Handler/IHandler.cs b/Assets/GothicVR-Lab/Scripts/Handler/ILabHandler.cs similarity index 70% rename from Assets/GothicVR-Lab/Scripts/Handler/IHandler.cs rename to Assets/GothicVR-Lab/Scripts/Handler/ILabHandler.cs index e993099f0..4e281942a 100644 --- a/Assets/GothicVR-Lab/Scripts/Handler/IHandler.cs +++ b/Assets/GothicVR-Lab/Scripts/Handler/ILabHandler.cs @@ -1,6 +1,6 @@ namespace GVR.Lab.Handler { - public interface IHandler + public interface ILabHandler { public void Bootstrap(); } diff --git a/Assets/GothicVR-Lab/Scripts/Handler/IHandler.cs.meta b/Assets/GothicVR-Lab/Scripts/Handler/ILabHandler.cs.meta similarity index 100% rename from Assets/GothicVR-Lab/Scripts/Handler/IHandler.cs.meta rename to Assets/GothicVR-Lab/Scripts/Handler/ILabHandler.cs.meta diff --git a/Assets/GothicVR-Lab/Scripts/Handler/LockableHandler.cs b/Assets/GothicVR-Lab/Scripts/Handler/LabLockableLabHandler.cs similarity index 91% rename from Assets/GothicVR-Lab/Scripts/Handler/LockableHandler.cs rename to Assets/GothicVR-Lab/Scripts/Handler/LabLockableLabHandler.cs index 4c1f26046..b9c2b2bbe 100644 --- a/Assets/GothicVR-Lab/Scripts/Handler/LockableHandler.cs +++ b/Assets/GothicVR-Lab/Scripts/Handler/LabLockableLabHandler.cs @@ -5,7 +5,7 @@ namespace GVR.Lab.Handler { - public class LockableHandler : MonoBehaviour, IHandler + public class LabLockableLabHandler : MonoBehaviour, ILabHandler { public GameObject chestsGo; public GameObject doorsGo; diff --git a/Assets/GothicVR-Lab/Scripts/Handler/LockableHandler.cs.meta b/Assets/GothicVR-Lab/Scripts/Handler/LabLockableLabHandler.cs.meta similarity index 100% rename from Assets/GothicVR-Lab/Scripts/Handler/LockableHandler.cs.meta rename to Assets/GothicVR-Lab/Scripts/Handler/LabLockableLabHandler.cs.meta diff --git a/Assets/GothicVR-Lab/Scripts/Handler/NpcHandler.cs b/Assets/GothicVR-Lab/Scripts/Handler/LabNpcLabHandler.cs similarity index 90% rename from Assets/GothicVR-Lab/Scripts/Handler/NpcHandler.cs rename to Assets/GothicVR-Lab/Scripts/Handler/LabNpcLabHandler.cs index 9d0ae7542..f881622e4 100644 --- a/Assets/GothicVR-Lab/Scripts/Handler/NpcHandler.cs +++ b/Assets/GothicVR-Lab/Scripts/Handler/LabNpcLabHandler.cs @@ -15,7 +15,7 @@ namespace GVR.Lab.Handler { - public class NpcHandler : MonoBehaviour, IHandler + public class LabNpcLabHandler : MonoBehaviour, ILabHandler { public TMP_Dropdown animationsDropdown; public GameObject bloodwynSlotGo; @@ -62,11 +62,8 @@ private void BootstrapBloodwyn() // Hero { // Need to be set for later usage (e.g. Bloodwyn checks your inventory if enough nuggets are carried) - var heroGo = PrefabCache.TryGetObject(PrefabCache.PrefabType.Npc); - heroGo.SetParent(bloodwynSlotGo); var heroInstance = GameData.GothicVm.InitInstance("hero"); - LookupCache.NpcCache[heroInstance.Index] = properties; - GameData.GothicVm.GlobalOther = heroInstance; + GameData.GothicVm.GlobalHero = heroInstance; } var mdmName = "Hum_GRDM_ARMOR.asc"; diff --git a/Assets/GothicVR-Lab/Scripts/Handler/NpcHandler.cs.meta b/Assets/GothicVR-Lab/Scripts/Handler/LabNpcLabHandler.cs.meta similarity index 100% rename from Assets/GothicVR-Lab/Scripts/Handler/NpcHandler.cs.meta rename to Assets/GothicVR-Lab/Scripts/Handler/LabNpcLabHandler.cs.meta diff --git a/Assets/GothicVR-Lab/Scripts/Handler/VobHandAttachPointsHandler.cs b/Assets/GothicVR-Lab/Scripts/Handler/LabVobHandAttachPointsLabHandler.cs similarity index 99% rename from Assets/GothicVR-Lab/Scripts/Handler/VobHandAttachPointsHandler.cs rename to Assets/GothicVR-Lab/Scripts/Handler/LabVobHandAttachPointsLabHandler.cs index 41ac65cec..35497ed5f 100644 --- a/Assets/GothicVR-Lab/Scripts/Handler/VobHandAttachPointsHandler.cs +++ b/Assets/GothicVR-Lab/Scripts/Handler/LabVobHandAttachPointsLabHandler.cs @@ -18,7 +18,7 @@ namespace GVR.Lab.Handler { - public class VobHandAttachPointsHandler: MonoBehaviour, IHandler + public class LabVobHandAttachPointsLabHandler: MonoBehaviour, ILabHandler { public TMP_Dropdown vobCategoryDropdown; public TMP_Dropdown vobItemDropdown; diff --git a/Assets/GothicVR-Lab/Scripts/Handler/VobHandAttachPointsHandler.cs.meta b/Assets/GothicVR-Lab/Scripts/Handler/LabVobHandAttachPointsLabHandler.cs.meta similarity index 100% rename from Assets/GothicVR-Lab/Scripts/Handler/VobHandAttachPointsHandler.cs.meta rename to Assets/GothicVR-Lab/Scripts/Handler/LabVobHandAttachPointsLabHandler.cs.meta diff --git a/Assets/GothicVR-Lab/Scripts/LabBootstrapper.cs b/Assets/GothicVR-Lab/Scripts/LabBootstrapper.cs index c0f2a439c..0a21b2745 100644 --- a/Assets/GothicVR-Lab/Scripts/LabBootstrapper.cs +++ b/Assets/GothicVR-Lab/Scripts/LabBootstrapper.cs @@ -14,9 +14,9 @@ public class LabBootstrapper : MonoBehaviour public bool bootLockableHandler; public bool bootAttachPointHandler; - public NpcHandler npcHandler; - public LockableHandler lockableHandler; - public VobHandAttachPointsHandler vobHandAttachPointsHandler; + public LabNpcLabHandler npcLabHandler; + public LabLockableLabHandler lockableLabHandler; + public LabVobHandAttachPointsLabHandler vobHandAttachPointsLabHandler; private bool isBooted; /// @@ -31,11 +31,11 @@ private void Update() GvrBootstrapper.BootGothicVR(SettingsManager.GameSettings.GothicIPath); if (bootNpcHandler) - npcHandler.Bootstrap(); + npcLabHandler.Bootstrap(); if (bootLockableHandler) - lockableHandler.Bootstrap(); + lockableLabHandler.Bootstrap(); if (bootAttachPointHandler) - vobHandAttachPointsHandler.Bootstrap(); + vobHandAttachPointsLabHandler.Bootstrap(); } private void OnDestroy()