From 463fec38b237c8bba8ff29eb5967343016816508 Mon Sep 17 00:00:00 2001 From: originalnicodr Date: Sun, 10 Mar 2024 12:15:32 -0300 Subject: [PATCH] Changed the lights config button to only show the inspector with the lights properties, and added a new option for the default freecam (so to be able to use the gameplay camera if you can't interact with the menu). --- src/Cinematic/Cells/LightCell.cs | 3 +-- src/Config/ConfigManager.cs | 5 +++++ src/UI/Panels/CamPaths.cs | 9 ++++++--- src/UI/Panels/FreeCamPanel.cs | 3 ++- src/UI/Panels/LightsManger.cs | 9 ++++++--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Cinematic/Cells/LightCell.cs b/src/Cinematic/Cells/LightCell.cs index f514e8d..fe95920 100644 --- a/src/Cinematic/Cells/LightCell.cs +++ b/src/Cinematic/Cells/LightCell.cs @@ -43,8 +43,7 @@ namespace UnityExplorer.UI.Panels ButtonRef inspectButton = UIFactory.CreateButton(UIRoot, "InspectButton", "Config"); UIFactory.SetLayoutElement(inspectButton.GameObject, minWidth: 50, minHeight: 25, flexibleWidth: 9999); inspectButton.OnClick += () => InspectorManager.InspectWithFilters(light.GetComponent(), "Light", - UnityExplorer.Inspectors.MemberFilter.Property | - UnityExplorer.Inspectors.MemberFilter.Field + UnityExplorer.Inspectors.MemberFilter.Property ); //Move to Camera diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index ffffe13..2a08f9f 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -30,6 +30,7 @@ namespace UnityExplorer.Config public static ConfigElement Reflection_Signature_Blacklist; public static ConfigElement Reflection_Hide_NativeInfoPtrs; + public static ConfigElement Default_Gameplay_Freecam; public static ConfigElement Pause; public static ConfigElement Frameskip; public static ConfigElement Screenshot; @@ -179,6 +180,10 @@ namespace UnityExplorer.Config "For example, this will hide 'Class.NativeFieldInfoPtr_value' for the field 'Class.value'.", false); + Default_Gameplay_Freecam = new("Default Gameplay Freecam", + "Turn this on if you want the default gameplay freecam toggle on the Freecam panel to be on on startup.", + false); + Pause = new("Pause", "Toggle the pause of the game.", KeyCode.PageUp); diff --git a/src/UI/Panels/CamPaths.cs b/src/UI/Panels/CamPaths.cs index 66974f5..e4e6f6f 100644 --- a/src/UI/Panels/CamPaths.cs +++ b/src/UI/Panels/CamPaths.cs @@ -276,9 +276,12 @@ namespace UnityExplorer.UI.Panels Quaternion arrowRot = lookaheadPoints[i].rotation; if (followObject != null && FreeCamPanel.followRotationToggle.isOn) arrowRot = followObject.transform.rotation * arrowRot; - // We could expose the color of the arrow to a setting - GameObject arrow = ArrowGenerator.CreateArrow(arrowPos, arrowRot, Color.green); - arrow.transform.SetParent(pathVisualizer.transform, true); + try { + // We could expose the color of the arrow to a setting + GameObject arrow = ArrowGenerator.CreateArrow(arrowPos, arrowRot, Color.green); + arrow.transform.SetParent(pathVisualizer.transform, true); + } + catch { ExplorerCore.LogWarning("Couldn't create campath visualizer."); } n = 0; } } diff --git a/src/UI/Panels/FreeCamPanel.cs b/src/UI/Panels/FreeCamPanel.cs index 4b69e36..1d39d52 100644 --- a/src/UI/Panels/FreeCamPanel.cs +++ b/src/UI/Panels/FreeCamPanel.cs @@ -270,7 +270,7 @@ namespace UnityExplorer.UI.Panels GameObject toggleObj = UIFactory.CreateToggle(ContentRoot, "UseGameCameraToggle", out useGameCameraToggle, out Text useGameCameraText); UIFactory.SetLayoutElement(toggleObj, minHeight: 25, flexibleWidth: 9999); useGameCameraToggle.onValueChanged.AddListener(OnUseGameCameraToggled); - useGameCameraToggle.isOn = false; + useGameCameraToggle.isOn = ConfigManager.Default_Gameplay_Freecam.Value; useGameCameraText.text = "Use Game Camera?"; AddSpacer(5); @@ -499,6 +499,7 @@ namespace UnityExplorer.UI.Panels void OnUseGameCameraToggled(bool value) { + // TODO: Change the value on ConfigManager.Default_Gameplay_Freecam and save it EventSystemHelper.SetSelectedGameObject(null); if (!inFreeCamMode) diff --git a/src/UI/Panels/LightsManger.cs b/src/UI/Panels/LightsManger.cs index 522360c..3ff136f 100644 --- a/src/UI/Panels/LightsManger.cs +++ b/src/UI/Panels/LightsManger.cs @@ -158,9 +158,12 @@ namespace UnityExplorer.UI.Panels switch(requestedType){ case LightType.Spot: lightComponent.range = 10; - GameObject arrow = ArrowGenerator.CreateArrow(Vector3.zero, Quaternion.identity, lightComponent.color); - arrow.SetActive(false); - arrow.transform.SetParent(obj.transform, true); + try { + GameObject arrow = ArrowGenerator.CreateArrow(Vector3.zero, Quaternion.identity, lightComponent.color); + arrow.SetActive(false); + arrow.transform.SetParent(obj.transform, true); + } + catch { ExplorerCore.LogWarning("Couldn't create spotlight visualizer."); } break; case LightType.Point: GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);