diff --git a/Assets/Gothic-Core/Scripts/Const/Constants.cs b/Assets/Gothic-Core/Scripts/Const/Constants.cs index 89e651cf1..7d14f83e1 100644 --- a/Assets/Gothic-Core/Scripts/Const/Constants.cs +++ b/Assets/Gothic-Core/Scripts/Const/Constants.cs @@ -110,11 +110,11 @@ public static class Animations public static LayerMask WaterLayer = LayerMask.NameToLayer("Water"); public static LayerMask UILayer = LayerMask.NameToLayer("UI"); - // HVR Layers (could also be reused and implemented for XRIT if needed) - public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (suggested by HVR) - public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (suggested by HVR) - public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (suggested by HVR) - public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (suggested by HVR) + // VR layers (used by the VR backend for player, hands and grabbables) + public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (VR backend default) + public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (VR backend default) + public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (VR backend default) + public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (VR backend default) // Custom layers public static LayerMask VobItemLayer = LayerMask.NameToLayer("VobItem"); diff --git a/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs b/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs index b9c272e8a..14de065a6 100644 --- a/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs +++ b/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs @@ -802,7 +802,7 @@ private static void SnapDigSpotToLoader(GameObject go) /// /// Child vobs are created inside their parent's GO without a VobLoader of their own. Their adapters - /// (VRVobContainer, HvrPhysicsChest, door lock picking, VRFocus) call + /// (VRVobContainer, chest lid physics, door lock picking, VRFocus) call /// GetComponentInParent<VobLoader>() and got the PARENT's vob (often an unnamed zCVob) - /// InvalidCastExceptions, "No door or container found for ><", doors/chests that don't work (G2 Xardas' tower). /// diff --git a/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs b/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs index 4051cb677..fc33bd480 100644 --- a/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs @@ -112,7 +112,7 @@ public void Init(string root, bool mountModFiles = false, IReadOnlyList _prefab = new(s => { // Lookup is done in following places: - // 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (HVR, Flat, ...) + // 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (VR, Flat, ...) // 2. Prefabs/... - Located inside core module (Gothic-Core), if we don't need special handling. var contextPrefixPath = $"{_contextInteractionService.GetContextName()}/{s}"; return new[] { contextPrefixPath, s }.Select(Resources.Load) diff --git a/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs b/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs index bfac97158..5a05209c7 100644 --- a/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs @@ -24,7 +24,7 @@ public class NpcHelperService { /// /// Ranges are in meter. - /// FIXME - We should use PERC_ASSESSTALK range to leverage HVR's Grabbable hover and remote grab distance! + /// FIXME - We should use PERC_ASSESSTALK range to leverage the VR grab hover and remote grab distance! /// public readonly Dictionary PerceptionRanges = new (); diff --git a/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs b/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs index 7a3036323..613f8d4a4 100644 --- a/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs @@ -30,7 +30,7 @@ public class MobInteractionService [Inject] private readonly NpcInventoryService _npcInventoryService; /// - /// Doors use HVRPhysicsDoor and chests their lid physics - not the mob/trigger path. + /// Doors use VR hinge physics and chests their lid physics - not the mob/trigger path. /// Beds are oCMobDoors too (BED*/BEDHIGH* visuals), but get used like other mobs (SLEEPABIT_S1). /// public bool ShouldHandleGrab(IVirtualObject vob) diff --git a/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs b/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs index 5e60d2874..5b9f7325d 100644 --- a/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs @@ -515,7 +515,7 @@ private void AddToMobInteractableList(VobContainer container) switch (container.Vob.Type) { // case VirtualObjectType.oCMOB: // FIXME - Needed? e.g. IMovableObject - // oCMobDoor excluded: doors use HVRPhysicsDoor for VR interaction, not AI_UseMob. + // oCMobDoor excluded: doors use VR hinge physics for interaction, not AI_UseMob. case VirtualObjectType.oCMobFire: case VirtualObjectType.oCMobInter: case VirtualObjectType.oCMobBed: diff --git a/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs b/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs index 965871736..01b692c4e 100644 --- a/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs +++ b/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs @@ -6,7 +6,6 @@ using Gothic.Core.Services.Caches; using Gothic.Core.Services.Npc; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core.Utils; using Reflex.Attributes; using TMPro; using UnityEngine; @@ -60,7 +59,7 @@ public void MonsterDestroyClick() private IEnumerator SpawnMonster(int amount, string instanceName = null) { - if (instanceName.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(instanceName)) instanceName = _monsterSelector.options[_monsterSelector.value].text; while (amount-- > 0) diff --git a/Assets/Gothic-VR/Editor/Backends.meta b/Assets/Gothic-VR/Editor/Backends.meta new file mode 100644 index 000000000..e0bca044e --- /dev/null +++ b/Assets/Gothic-VR/Editor/Backends.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50e2c55096528eb4e9862698e09895bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Editor/Backends/Hvr.meta b/Assets/Gothic-VR/Editor/Backends/Hvr.meta new file mode 100644 index 000000000..33be139d3 --- /dev/null +++ b/Assets/Gothic-VR/Editor/Backends/Hvr.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20444a335b2a3ce468b4eed4495db208 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Editor/HurricaneActions.cs b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs similarity index 93% rename from Assets/Gothic-VR/Editor/HurricaneActions.cs rename to Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs index 42937c501..c014ca396 100644 --- a/Assets/Gothic-VR/Editor/HurricaneActions.cs +++ b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs @@ -5,7 +5,7 @@ using UnityEditor.Rendering.Universal; using UnityEngine; -namespace Gothic.VR.Editor +namespace Gothic.VR.Editor.Backends.Hvr { public class HurricaneActions { @@ -24,6 +24,9 @@ private static void ConvertHVRMaterialToURP() foreach (var folder in _hvrMaterialFolders) { + if (!Directory.Exists(folder)) + continue; + materialFiles.AddRange(Directory.GetFiles(folder, "*.mat")); } diff --git a/Assets/Gothic-VR/Editor/HurricaneActions.cs.meta b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs.meta similarity index 100% rename from Assets/Gothic-VR/Editor/HurricaneActions.cs.meta rename to Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs b/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs index 10999817b..94a0c7f45 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs @@ -1,16 +1,23 @@ -#if GOTHIC_HVR_INSTALLED +using System; using Gothic.Core.Adapters.Context; +using Gothic.Core.Extensions; +using Gothic.Core.Logging; using Gothic.Core.Models.Context; using Gothic.Core.Services.Context; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Services.Context; -using Gothic.Core.Extensions; using Reflex.Attributes; using ZenKit; +using Logger = Gothic.Core.Logging.Logger; +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Backends.Hvr; +#endif namespace Gothic.VR.Adapters.Context { /// /// Bootstrap class which will register listener to set this module as Active if GameSettings.Controls match. + /// Also selects the VR backend (interaction framework) which provides our VR ports. /// public class VRContextBootstrap : AbstractContextBootstrap { @@ -19,24 +26,42 @@ public class VRContextBootstrap : AbstractContextBootstrap [Inject] private readonly ContextDialogService _contextDialogService; [Inject] private readonly ContextTextInputService _contextTextInputService; + /// + /// Returns the VR backend compiled into this build, or null if none is available. + /// + public static IVrBackend SelectBackend() + { +#if GOTHIC_HVR_INSTALLED + return new HvrBackend(); +#else + return null; +#endif + } + protected override void RegisterControlModule(Controls controls) { if (controls != Controls.VR) return; -// We register VR only if we have HVR installed. -#if GOTHIC_HVR_INSTALLED - // We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is the first time, - // when we can set our VR service. But the [Inject] resolves are done already at frame 0 at Bootstrap.scene. - // Therefore, we need to set the VR service via new() and as proxy implementation. + var backend = SelectBackend(); + if (backend == null) + { + const string message = "VR controls are set, but no VR backend is available. " + + "Set DeveloperConfig > Controls.GameControls = Flat, or install a VR backend " + + "(e.g. HVR, plus scripting define >GOTHIC_HVR_INSTALLED<)."; + Logger.LogError(message, LogCat.VR); + throw new ArgumentException(message); + } + + Logger.Log($"VR backend: {backend.Name}", LogCat.VR); + + // We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is + // the first time, when we can set our VR service. But the [Inject] resolves are done already at frame 0 + // at Bootstrap.scene. Therefore, we need to set the VR service via new() and as proxy implementation. _contextInteractionService.SetImpl(new VRContextInteractionService()); _contextMenuService.SetImpl(new VRContextMenuService().Inject()); _contextDialogService.SetImpl(new VRContextDialogService().Inject()); _contextTextInputService.SetImpl(new VRContextTextInputService()); -#else - throw new System.ArgumentException( - "VR context is set, but compiler directive >GOTHIC_HVR_INSTALLED< isn't set. Did you set up Hurricane VR properly?"); -#endif } protected override void RegisterGameVersionModule(GameVersion version) @@ -45,4 +70,3 @@ protected override void RegisterGameVersionModule(GameVersion version) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs index 6d71d715a..28be0b9de 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Debugging.Fighting; namespace Gothic.VR.Adapters.Debugging.Fighting @@ -8,4 +7,3 @@ public class VrColliderHitTracker : ColliderHitTracker } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs index ba89e15c4..02cc01d07 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Debugging.Fighting; namespace Gothic.VR.Debugging.Fighting @@ -8,4 +7,3 @@ public class VrNpcColliderDebugAdapter : NpcColliderDebugAdapter } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs index 3b55c8ca7..3e2a4fbdb 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core.Adapters.UI; using Gothic.Core; @@ -230,4 +229,3 @@ private GameObject CreateField(MarvinProperty floatProperty, GameObject r } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs index e94e0bca6..acec0ec87 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections; using System.Collections.Generic; using System.Linq; @@ -368,4 +367,3 @@ private void SubtractItemFromHand(List inventory, GameObject handIt } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs index 48cefc69c..ecd70d436 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Const; using Gothic.VR.Adapters.Vob.VobItem; @@ -24,4 +23,3 @@ private void Start() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs index fde3e48da..58b573193 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.VR.Services; using Reflex.Attributes; using UnityEngine; @@ -44,4 +43,3 @@ public void SetOnTop(bool onTop) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs index 0717f09ac..a810f6b77 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections; using Gothic.Core.Extensions; using Gothic.Core.Manager; @@ -71,4 +70,3 @@ private IEnumerator DisableDelayed(int milliseconds) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs index 5e5c9f80d..53cae9242 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Adapters.UI.Menus; using Gothic.Core.Const; using Gothic.Core.Services; @@ -101,4 +100,3 @@ private bool IsGameScene() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs index ec77eb34d..9e50444b2 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Manager; using Gothic.VR.Interaction.Models; using Gothic.VR.Interaction.Ports; @@ -56,4 +55,3 @@ private void OnBeforeGrabbed(VrGrabArgs args) } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs index 9b35186a2..c210ea7ca 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; @@ -235,4 +234,3 @@ public IEnumerable CollectMarvinInspectorProperties() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs index 0863fcd9c..05ab02965 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections; using System.Collections.Generic; using System.Linq; @@ -147,4 +146,3 @@ private Transform GetNearestSnapPoint(Vector3 pos) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs index ffbbb77bb..74098b5a4 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core; using Gothic.Core.Logging; @@ -147,4 +146,3 @@ private void SetRenderDistance(int value) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs index f5765b935..ecf61c136 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections; using System.Collections.Generic; @@ -577,4 +576,3 @@ public IEnumerable CollectMarvinInspectorProperties() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs index c107becce..6d906a8c2 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Logging; using Gothic.Core.Manager; @@ -166,4 +165,3 @@ private void OnDestroy() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs index e4e592a1c..efe9bff70 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections.Generic; using System.Linq; @@ -91,4 +90,3 @@ public class MatchResult public float Score { get; set; } // 0-1, where 1 is perfect match } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs index eaed05a22..f7f2b2809 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.UI.Menus; @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs index 2d25a8b86..08e35f253 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.UI.Menus; @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs index 70e87eaef..05456a6c9 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Meshes; using Gothic.Core.Services.Vm; using Gothic.Core; @@ -38,4 +37,3 @@ private void Start() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs index 9d140326f..8647dfafb 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using UnityEngine; namespace Gothic.VR.Adapters.UI @@ -30,4 +29,3 @@ private void Update() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs index 15916c5fc..44881378e 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.Core.Adapters.Video; @@ -275,4 +274,3 @@ private void UnlockPlayer() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs index ec2aaaaa3..df921e7e8 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -194,4 +193,3 @@ private void OnDialogClicked(NpcInstance instance, int informationId) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs index bf57fd424..fd04440cb 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Context; using Gothic.VR.Services.Context; using Reflex.Attributes; @@ -124,4 +123,3 @@ private bool TryResolveCamera() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs index f4b94a8eb..d16667f46 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Context; using Gothic.VR.Services.Context; using Reflex.Attributes; @@ -82,4 +81,3 @@ private bool TryResolveCamera() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs index cd967f194..204d4669b 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.Core.Adapters.UI; @@ -126,4 +125,3 @@ private void HideExpiredMessages() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs index 744fa7f4c..dd73c2ecf 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Npc; +using Gothic.Core.Adapters.Npc; using Gothic.Core.Services.Config; using Gothic.Core.Services.UI; using Gothic.Core; @@ -76,4 +75,3 @@ public void ScheduleHide(float delay) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs index d0294810a..9901f9805 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using TMPro; @@ -265,4 +264,3 @@ private static Material CreateCopy(Material onTopAsset, int renderQueue, Materia } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs b/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs index 8c6114d1e..fe981c37e 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.Vob; using Gothic.Core.Const; @@ -170,4 +169,3 @@ private void SetFocusName() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs b/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs index 41bb7c5bb..4fc4df670 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Npc; +using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.UI.StatusBars; using Gothic.Core.Manager; using Gothic.Core.Models.Container; @@ -98,4 +97,3 @@ private void OnGrabbed(VrGrabArgs args) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs b/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs index f93d81ca0..9f62cb045 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections; using System.Collections.Generic; @@ -393,4 +392,3 @@ private static void AddEquippedLabel(GameObject socketRoot) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs index 3dff0704e..5b021549f 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Vob; +using Gothic.Core.Adapters.Vob; using Gothic.Core.Models.Container; using System.Collections.Generic; using Gothic.Core.Models.Vm; @@ -81,4 +80,3 @@ private bool IsWeapon(VobContainer container) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs index c79d5bc55..495250201 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections; +using System.Collections; using Gothic.Core; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; @@ -262,5 +261,3 @@ private void PlaySound(string soundName, string fallback = null) } } } -#endif - diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs index d9a74ce93..6af192e7d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using UnityEngine; namespace Gothic.VR.Adapters.Vob.LockPicking @@ -111,4 +110,3 @@ private void UpdateStatus(RotationState state) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs index e51c96eb1..5009b0c8d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using UnityEngine; +using UnityEngine; namespace Gothic.VR.Adapters.Vob.LockPicking { @@ -10,4 +9,3 @@ public class VRLockPickProperties : VRVobItemProperties public Transform HoldingHand; } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs index 41bd31162..fb36a5595 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; @@ -191,4 +190,3 @@ private void Dig() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs index 799f329af..df115c243 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Adapters.Vob; using Gothic.Core.Logging; using Gothic.Core.Services.Vobs; @@ -65,4 +64,3 @@ private void OnReleased(VrGrabArgs _) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs index 42598ccce..e617d160d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Adapters.Vob; using Gothic.Core.Const; @@ -80,4 +79,3 @@ private void PrepareSounds(IContainer vobContainer) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs index c167e3a27..a7a33f233 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Adapters.Vob; using Gothic.Core.Manager; @@ -70,4 +69,3 @@ private void PrepareSounds(IDoor props) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs index 4988eddce..6dc29d1bd 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections; +using System.Collections; using Gothic.Core.Const; using Gothic.Core.Manager; using Gothic.Core.Services.Config; @@ -316,4 +315,3 @@ private void OnDisable() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs index 62d6ef39f..475bdf68c 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.Vob; @@ -116,4 +115,3 @@ private bool TryFireHitViaVRWeaponService(NpcContainer targetNpcContainer) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs b/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs index 897ac8d0c..539ea6cd1 100644 --- a/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs +++ b/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections.Generic; using System.Linq; @@ -586,4 +585,3 @@ public void CalculateCapsuleOverlap(CapsuleCollider capsuleCollider, out Vector3 } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs new file mode 100644 index 000000000..52f621bab --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs @@ -0,0 +1,20 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Ports; +using Reflex.Core; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + public class HvrBackend : IVrBackend + { + public string Name => "HurricaneVR"; + + public void InstallBindings(ContainerBuilder containerBuilder) + { + containerBuilder.AddSingleton(typeof(HvrInput), typeof(IVrInput)); + containerBuilder.AddSingleton(typeof(HvrHaptics), typeof(IVrHaptics)); + containerBuilder.AddSingleton(typeof(HvrUiPointers), typeof(IVrUiPointers)); + containerBuilder.AddSingleton(typeof(HvrSfxPlayer), typeof(IVrSfxPlayer)); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta new file mode 100644 index 000000000..a04af0d7c --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 40aa78a38329bf048a068cc514c6e5bb \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs new file mode 100644 index 000000000..db7f50f42 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs @@ -0,0 +1,19 @@ +using Reflex.Core; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// A VR interaction framework that provides the implementations of our VR ports. + /// The active backend is selected by VRContextBootstrap. + /// + public interface IVrBackend + { + string Name { get; } + + /// + /// Registers the backend's implementations of IVrInput, IVrHaptics, IVrUiPointers and IVrSfxPlayer. + /// IVrRig isn't registered here, as it lives on the player prefab. + /// + void InstallBindings(ContainerBuilder containerBuilder); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta new file mode 100644 index 000000000..9d6233c4b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 669e6e07f5d4e6f4b960ca635362a5da \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs b/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs index 5465d9aba..766db0e4f 100644 --- a/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs +++ b/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs @@ -1,10 +1,10 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; -using Gothic.VR.Interaction.Backends.Hvr; -using Gothic.VR.Interaction.Ports; +using Gothic.Core.Logging; +using Gothic.VR.Adapters.Context; using Gothic.VR.Services; using Reflex.Core; using UnityEngine; +using Logger = Gothic.Core.Logging.Logger; namespace Gothic.VR { @@ -17,11 +17,13 @@ public void InstallBindings(ContainerBuilder containerBuilder) { containerBuilder.OnContainerBuilt += (container) => ReflexProjectInstaller.DIContainer = container; - // VR backend (IVrRig lives on the player prefab, see VRContextInteractionService.Rig) - containerBuilder.AddSingleton(typeof(HvrInput), typeof(IVrInput)); - containerBuilder.AddSingleton(typeof(HvrHaptics), typeof(IVrHaptics)); - containerBuilder.AddSingleton(typeof(HvrUiPointers), typeof(IVrUiPointers)); - containerBuilder.AddSingleton(typeof(HvrSfxPlayer), typeof(IVrSfxPlayer)); + // VR ports (IVrInput, IVrHaptics, ...) come from the active backend. + // Without a backend, nothing is registered and VRContextBootstrap fails the boot with a clear error. + var backend = VRContextBootstrap.SelectBackend(); + if (backend == null) + Logger.LogError("No VR backend available. VR ports aren't registered.", LogCat.VR); + else + backend.InstallBindings(containerBuilder); containerBuilder.AddSingleton(typeof(VRPlayerService)); containerBuilder.AddSingleton(typeof(VRWeaponService)); @@ -31,4 +33,3 @@ public void InstallBindings(ContainerBuilder containerBuilder) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs index 6a49f43d3..710d1985b 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Const; using Gothic.Core.Models.Dialog; @@ -69,4 +68,3 @@ public void FillDialog(NpcInstance instance, List dialogOptions) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs index 8ea86ae1d..f04cb3bef 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Linq; using Gothic.Core; using Gothic.Core.Const; @@ -363,4 +362,3 @@ public void EnableMenus() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs index 8f20d3690..4b8c4b730 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using System.Linq; using Gothic.Core.Model.UI.Menu; @@ -382,4 +381,3 @@ private MutableMenuItemInstance CreateImmersionBackButton(AbstractMenuInstance m } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs b/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs index f113cb242..aeb08c265 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Logging; using Gothic.Core.Services.Context; @@ -48,4 +47,3 @@ public void Play(string fileName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs b/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs index 5fd6f4cfb..6ffd16d19 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Vob; +using Gothic.Core.Adapters.Vob; using Gothic.Core.Logging; using Gothic.Core.Services.Context; using Gothic.Core.Services.Player; @@ -180,4 +179,3 @@ private static GameObject CreateMobDialogAnchor(VobLoader loader) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs b/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs index edafd4800..5d607fecf 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.VR.Adapters.Player; @@ -56,4 +55,3 @@ private void UpdateHands() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs b/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs index 9bf1e4d10..751f9e153 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Adapters.Vob.Item; using Gothic.Core.Const; @@ -188,4 +187,3 @@ private void OnHit(NpcContainer _, NpcContainer __, Vector3 ___) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs b/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs index db1a8081f..dfb565ece 100644 --- a/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Models.Container; using Gothic.VR.Interaction.Models; @@ -59,4 +58,3 @@ public void Vibrate(VrHandSide handSide, VrHapticPreset preset) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs b/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs index 986cad9e6..0fa73cc11 100644 --- a/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs +++ b/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.VR.Services; using Reflex.Attributes; using UnityEngine; @@ -19,4 +18,3 @@ private void FixedUpdate() } } } -#endif diff --git a/Docs/HVR-replacement/phase-0-decouple.md b/Docs/HVR-replacement/phase-0-decouple.md index 0ad0ff0aa..7b54701bb 100644 --- a/Docs/HVR-replacement/phase-0-decouple.md +++ b/Docs/HVR-replacement/phase-0-decouple.md @@ -8,11 +8,13 @@ folder. Nothing changes for the player: HVR still runs everything. ## Exit criteria -- [ ] No file outside `Gothic-VR/Scripts/Interaction/Backends/Hvr/` has `using HurricaneVR…` or an `HVR*` type. -- [ ] `#if GOTHIC_HVR_INSTALLED` exists only in the HVR backend folder and in `VRContextBootstrap` (backend selection). -- [ ] `Gothic.VR` compiles with `GOTHIC_HVR_INSTALLED` removed. Without a backend, VR mode fails at boot with a clear +- [x] No file outside `Gothic-VR/Scripts/Interaction/Backends/Hvr/` has `using HurricaneVR…` or an `HVR*` type. + (Editor tooling about the backend is the exception: `Editor/Backends/Hvr/HurricaneActions.cs` converts the + HVR materials by folder path, `Editor/VRContextToolActions.cs` toggles the define. Neither uses HVR types.) +- [x] `#if GOTHIC_HVR_INSTALLED` exists only in the HVR backend folder and in `VRContextBootstrap` (backend selection). +- [x] `Gothic.VR` compiles with `GOTHIC_HVR_INSTALLED` removed. Without a backend, VR mode fails at boot with a clear log error, not a compile error. -- [ ] Our prefabs no longer wire HVR UnityEvents to our methods in the inspector; adapters subscribe in code. +- [x] Our prefabs no longer wire HVR UnityEvents to our methods in the inspector; adapters subscribe in code. (0c) - [ ] Playtest on Quest + PCVR shows no behaviour change (see test plan). ## Proposed structure @@ -196,17 +198,21 @@ Split into four PRs so each one stays reviewable. ### PR 0d - Gating and leftovers -- [ ] Remove `#if GOTHIC_HVR_INSTALLED` from the 22 files that don't use HVR (list in 02 §6) and from the 8 that - only used our wrappers. -- [ ] `VRContextBootstrap`: select the backend (`Hvr` for now). If none is available, log +- [x] Remove `#if GOTHIC_HVR_INSTALLED` from the 22 files that don't use HVR (list in 02 §6) and from the 8 that + only used our wrappers. (After 0a-0c this was 49 files under `Gothic-VR/Scripts`, all file-level wrappers.) +- [x] `VRContextBootstrap`: select the backend (`Hvr` for now). If none is available, log `Logger.LogError(…, LogCat.VR)` with a hint to set `GameControls = Flat` or install a backend, then throw as today. (Switching to Flat automatically would mean loading the Flat player scene; not worth it for a - transitional state.) -- [ ] `ReflexVRSceneInstaller`: always compiled; registers port implementations from the active backend. -- [ ] `Gothic-Lab/…/LabFightHandler.cs`: replace the `HurricaneVR.Framework.Core.Utils` helper with our own extension. -- [ ] `Gothic-Core/Scripts/Const/Constants.cs:113-117`: change the comment "HVR Layers" to "VR layers". Layer names + transitional state.) `VRContextBootstrap.SelectBackend()` returns an `IVrBackend` (`HvrBackend`) or null. +- [x] `ReflexVRSceneInstaller`: always compiled; registers port implementations from the active backend. + (`IVrBackend.InstallBindings()`. Without a backend it logs an error and registers no ports; the Player scene + is loaded before `InitPhase1()`, so this error comes before the bootstrap error.) +- [x] `Gothic-Lab/…/LabFightHandler.cs`: replace the `HurricaneVR.Framework.Core.Utils` helper with our own extension. + (Its only use was `IsNullOrWhiteSpace()`; replaced by `string.IsNullOrWhiteSpace()`, no extension needed.) +- [x] `Gothic-Core/Scripts/Const/Constants.cs:113-117`: change the comment "HVR Layers" to "VR layers". Layer names stay (`TagManager.asset` unchanged). -- [ ] Remove the HVR wording from comments in `MobInteractionService`, `VobService` and `NpcHelperService`. +- [x] Remove the HVR wording from comments in `MobInteractionService`, `VobService` and `NpcHelperService`. + (Also `VobInitializerDomain` and `ResourceCacheService`.) ## Test plan (unchanged behaviour)