1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2026-10-10 04:53:15 +08:00

Added assignable hotkeys on the Options panel, deselected some cam-paths panel buttons so they are not accidentally triggered when pressing space after clicking on them, and user input over the freecam when a path is being played.

This commit is contained in:
originalnicodr
2024-01-27 19:32:52 -03:00
parent 252521061b
commit 47ad903ca7
6 changed files with 195 additions and 27 deletions
+112
View File
@@ -29,6 +29,29 @@ namespace UnityExplorer.Config
public static ConfigElement<string> Reflection_Signature_Blacklist;
public static ConfigElement<bool> Reflection_Hide_NativeInfoPtrs;
public static ConfigElement<KeyCode> Pause;
public static ConfigElement<KeyCode> Frameskip;
public static ConfigElement<KeyCode> Screenshot;
public static ConfigElement<KeyCode> HUD_Toggle;
public static ConfigElement<KeyCode> Freecam_Toggle;
public static ConfigElement<KeyCode> Block_Freecam_Movement;
public static ConfigElement<KeyCode> Speed_Up_Movement;
public static ConfigElement<KeyCode> Speed_Down_Movement;
public static ConfigElement<KeyCode> Forwards_1;
public static ConfigElement<KeyCode> Forwards_2;
public static ConfigElement<KeyCode> Backwards_1;
public static ConfigElement<KeyCode> Backwards_2;
public static ConfigElement<KeyCode> Left_1;
public static ConfigElement<KeyCode> Left_2;
public static ConfigElement<KeyCode> Right_1;
public static ConfigElement<KeyCode> Right_2;
public static ConfigElement<KeyCode> Up;
public static ConfigElement<KeyCode> Down;
public static ConfigElement<KeyCode> Tilt_Left;
public static ConfigElement<KeyCode> Tilt_Right;
public static ConfigElement<KeyCode> Increase_FOV;
public static ConfigElement<KeyCode> Decrease_FOV;
// internal configs
internal static InternalConfigHandler InternalHandler { get; private set; }
internal static readonly Dictionary<UIManager.Panels, ConfigElement<string>> PanelSaveData = new();
@@ -145,6 +168,95 @@ namespace UnityExplorer.Config
"Use this to blacklist NativeMethodPtr_s and NativeFieldInfoPtrs_s from the class inspector, mainly to reduce clutter.\r\n" +
"For example, this will hide 'Class.NativeFieldInfoPtr_value' for the field 'Class.value'.",
false);
Pause = new("Pause",
"Toggle the pause of the game.",
KeyCode.PageUp);
Frameskip = new("Frameskip",
"Skip a frame when the game is paused.",
KeyCode.PageDown);
Screenshot = new("Take a screenshot",
"Takes a screenshot with the size multiplier specified in the Misc panel.\n" +
"Saves the screenshot to 'sinai-dev-UnityExplorer\\Screenshots' in png format.",
KeyCode.None);
HUD_Toggle = new("HUD Toggle",
"Toggle the games HUD. If there are elements that are still visible try loading the 'Load HUD elements' button on the Misc panel, and toggle the HUD again.",
KeyCode.Delete);
Freecam_Toggle = new("Freecam",
"Toggles freecamera mode.",
KeyCode.Insert);
Block_Freecam_Movement = new("Block Freecam movement",
"Blocks the freecam from moving when pressing the freecam-related hotkeys.",
KeyCode.Home);
Speed_Up_Movement = new("Speed up movement",
"Maintain this key pressed while moving the camera around to increase the freecam movement speed.",
KeyCode.LeftShift);
Speed_Down_Movement = new("Speed down movement",
"Maintain this key pressed while moving the camera around to decrease the freecam movement speed.",
KeyCode.LeftAlt);
Forwards_1 = new("Forwards 1",
"Move the freecam forwards.",
KeyCode.W);
Forwards_2 = new("Forwards 2",
"Move the freecam forwards, alt key.",
KeyCode.UpArrow);
Backwards_1 = new("Backwards 1",
"Move the freecam backward.",
KeyCode.S);
Backwards_2 = new("Backwards 2",
"Move the freecam backward, alt key.",
KeyCode.DownArrow);
Left_1 = new("Left 1",
"Move the freecam to the left.",
KeyCode.A);
Left_2 = new("Left 2",
"Move the freecam to the left, alt key.",
KeyCode.LeftArrow);
Right_1 = new("Right 1",
"Move the freecam to the right.",
KeyCode.D);
Right_2 = new("Right 2",
"Move the freecam to the right, alt key.",
KeyCode.RightArrow);
Up = new("Up",
"Move the freecam upwards.",
KeyCode.Space);
Down = new("Down",
"Move the freecam down.",
KeyCode.LeftControl);
Tilt_Left = new("Tilt left",
"Tilt the camera to the left.",
KeyCode.Q);
Tilt_Right = new("Tilt right",
"Tilt the camera to the left.",
KeyCode.E);
Increase_FOV = new("Increase FOV",
"Increase the field of view of the current freecam.",
KeyCode.KeypadPlus);
Decrease_FOV = new("Decrease FOV",
"Decrease the field of view of the current freecam.",
KeyCode.KeypadMinus);
}
}
}
+10 -9
View File
@@ -1,4 +1,7 @@
using UnityExplorer.UI;
using UnityExplorer.Config;
using UnityExplorer.UI;
using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using UniverseLib.Input;
#if CPP
#if UNHOLLOWER
@@ -7,8 +10,6 @@ using UnhollowerRuntimeLib;
using Il2CppInterop.Runtime.Injection;
#endif
#endif
using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using System;
@@ -104,13 +105,13 @@ namespace UnityExplorer
maybeForcePause();
UIManager.GetPanel<UnityExplorer.UI.Panels.Misc>(UIManager.Panels.Misc).MaybeTakeScreenshot();
if (InputManager.GetKeyDown(KeyCode.Pause))
if (InputManager.GetKeyDown(ConfigManager.Pause.Value))
{
UIManager.GetTimeScaleWidget().PauseToggle();
}
// FrameSkip
if (InputManager.GetKeyDown(KeyCode.PageDown))
if (InputManager.GetKeyDown(ConfigManager.Frameskip.Value))
{
if (UIManager.GetTimeScaleWidget().IsPaused()) {
UIManager.GetTimeScaleWidget().PauseToggle();
@@ -118,22 +119,22 @@ namespace UnityExplorer
}
}
if (InputManager.GetKeyDown(KeyCode.F12))
if (InputManager.GetKeyDown(ConfigManager.Screenshot.Value))
{
UIManager.GetPanel<UnityExplorer.UI.Panels.Misc>(UIManager.Panels.Misc).screenshotStatus = UnityExplorer.UI.Panels.Misc.ScreenshotState.TurnOffUI;
}
if (InputManager.GetKeyDown(KeyCode.Delete))
if (InputManager.GetKeyDown(ConfigManager.HUD_Toggle.Value))
{
UIManager.GetPanel<UnityExplorer.UI.Panels.Misc>(UIManager.Panels.Misc).ToggleHUDElements();
}
if (InputManager.GetKeyDown(KeyCode.Insert))
if (InputManager.GetKeyDown(ConfigManager.Freecam_Toggle.Value))
{
FreeCamPanel.StartStopButton_OnClick();
}
if (InputManager.GetKeyDown(KeyCode.Home))
if (InputManager.GetKeyDown(ConfigManager.Block_Freecam_Movement.Value))
{
FreeCamPanel.blockFreecamMovementToggle.isOn = !FreeCamPanel.blockFreecamMovementToggle.isOn;
}
@@ -27,6 +27,29 @@ namespace UnityExplorer.Loader.Standalone
public KeyCode Force_Unlock_Toggle;
public bool Disable_EventSystem_Override;
public KeyCode Pause;
public KeyCode Frameskip;
public KeyCode Screenshot;
public KeyCode HUD_Toggle;
public KeyCode Freecam_Toggle;
public KeyCode Block_Freecam_Movement;
public KeyCode Speed_Up_Movement;
public KeyCode Speed_Down_Movement;
public KeyCode Forwards_1;
public KeyCode Forwards_2;
public KeyCode Backwards_1;
public KeyCode Backwards_2;
public KeyCode Left_1;
public KeyCode Left_2;
public KeyCode Right_1;
public KeyCode Right_2;
public KeyCode Up;
public KeyCode Down;
public KeyCode Tilt_Left;
public KeyCode Tilt_Right;
public KeyCode Increase_FOV;
public KeyCode Decrease_FOV;
internal void Awake()
{
Instance = this;
@@ -53,6 +76,29 @@ namespace UnityExplorer.Loader.Standalone
ConfigManager.Force_Unlock_Mouse.Value = this.Force_Unlock_Mouse;
ConfigManager.Force_Unlock_Toggle.Value = this.Force_Unlock_Toggle;
ConfigManager.Disable_EventSystem_Override.Value = this.Disable_EventSystem_Override;
ConfigManager.Pause.Value = this.Pause;
ConfigManager.Frameskip.Value = this.Frameskip;
ConfigManager.Screenshot.Value = this.Screenshot;
ConfigManager.HUD_Toggle.Value = this.HUD_Toggle;
ConfigManager.Freecam_Toggle.Value = this.Freecam_Toggle;
ConfigManager.Block_Freecam_Movement.Value = this.Block_Freecam_Movement;
ConfigManager.Speed_Up_Movement.Value = this.Speed_Up_Movement;
ConfigManager.Speed_Down_Movement.Value = this.Speed_Down_Movement;
ConfigManager.Forwards_1.Value = this.Forwards_1;
ConfigManager.Forwards_2.Value = this.Forwards_2;
ConfigManager.Backwards_1.Value = this.Backwards_1;
ConfigManager.Backwards_2.Value = this.Backwards_2;
ConfigManager.Left_1.Value = this.Left_1;
ConfigManager.Left_2.Value = this.Left_2;
ConfigManager.Right_1.Value = this.Right_1;
ConfigManager.Right_2.Value = this.Right_2;
ConfigManager.Up.Value = this.Up;
ConfigManager.Down.Value = this.Down;
ConfigManager.Tilt_Left.Value = this.Tilt_Left;
ConfigManager.Tilt_Right.Value = this.Tilt_Right;
ConfigManager.Increase_FOV.Value = this.Increase_FOV;
ConfigManager.Decrease_FOV.Value = this.Decrease_FOV;
}
}
}
+11 -3
View File
@@ -99,15 +99,15 @@ namespace UnityExplorer.UI.Panels
//Move to Camera
ButtonRef moveToCameraButton = UIFactory.CreateButton(horiGroup, "Copy Camera pos and rot", "Copy Camera pos and rot");
UIFactory.SetLayoutElement(moveToCameraButton.GameObject, minWidth: 100, minHeight: 25, flexibleWidth: 9999);
moveToCameraButton.OnClick += () => {point.position = FreeCamPanel.ourCamera.transform.position; point.rotation = FreeCamPanel.ourCamera.transform.rotation; controlPoints[index] = point;};
moveToCameraButton.OnClick += () => {point.position = FreeCamPanel.ourCamera.transform.position; point.rotation = FreeCamPanel.ourCamera.transform.rotation; controlPoints[index] = point; EventSystemHelper.SetSelectedGameObject(null);};
ButtonRef copyFovButton = UIFactory.CreateButton(horiGroup, "Copy Camera FoV", "Copy Camera FoV");
UIFactory.SetLayoutElement(copyFovButton.GameObject, minWidth: 100, minHeight: 25, flexibleWidth: 9999);
copyFovButton.OnClick += () => {point.fov = FreeCamPanel.ourCamera.fieldOfView; controlPoints[index] = point;};
copyFovButton.OnClick += () => {point.fov = FreeCamPanel.ourCamera.fieldOfView; controlPoints[index] = point; EventSystemHelper.SetSelectedGameObject(null);};
ButtonRef moveToPointButton = UIFactory.CreateButton(horiGroup, "Move Cam to Node", "Move Cam to Node");
UIFactory.SetLayoutElement(moveToPointButton.GameObject, minWidth: 100, minHeight: 25, flexibleWidth: 9999);
moveToPointButton.OnClick += () => {FreeCamPanel.ourCamera.transform.position = point.position; FreeCamPanel.ourCamera.transform.rotation = point.rotation; FreeCamPanel.ourCamera.fieldOfView = point.fov;};
moveToPointButton.OnClick += () => {FreeCamPanel.ourCamera.transform.position = point.position; FreeCamPanel.ourCamera.transform.rotation = point.rotation; FreeCamPanel.ourCamera.fieldOfView = point.fov; EventSystemHelper.SetSelectedGameObject(null);};
//Add node next
@@ -143,18 +143,24 @@ namespace UnityExplorer.UI.Panels
GetCameraPathsManager().setTime(time);
GetCameraPathsManager().StartPath();
}
EventSystemHelper.SetSelectedGameObject(null);
}
void TogglePause_OnClick(){
if(GetCameraPathsManager()){
GetCameraPathsManager().TogglePause();
}
EventSystemHelper.SetSelectedGameObject(null);
}
void Stop_OnClick(){
if (GetCameraPathsManager()){
GetCameraPathsManager().Stop();
}
EventSystemHelper.SetSelectedGameObject(null);
}
void AddNode_OnClick(){
@@ -162,6 +168,8 @@ namespace UnityExplorer.UI.Panels
CatmullRom.CatmullRomPoint point = new CatmullRom.CatmullRomPoint(freeCam.transform.position, freeCam.transform.rotation, freeCam.fieldOfView);
controlPoints.Add(point);
UpdateListNodes();
EventSystemHelper.SetSelectedGameObject(null);
}
void Time_OnEndEdit(string input)
+15 -14
View File
@@ -1,5 +1,6 @@
using UniverseLib.Input;
using UnityExplorer.Config;
using UnityExplorer.Inspectors;
using UniverseLib.Input;
using UniverseLib.UI;
using UniverseLib.UI.Models;
#if UNHOLLOWER
@@ -444,7 +445,7 @@ namespace UnityExplorer.UI.Panels
// ------------- Handle input ----------------
if (FreeCamPanel.blockFreecamMovementToggle.isOn){
if (FreeCamPanel.blockFreecamMovementToggle.isOn || FreeCamPanel.cameraPathMover.playingPath){
return;
}
@@ -455,34 +456,34 @@ namespace UnityExplorer.UI.Panels
float moveSpeed = FreeCamPanel.desiredMoveSpeed * 0.01665f; //"0.01665f" (60fps) in place of Time.DeltaTime. DeltaTime causes issues when game is paused.
if (InputManager.GetKey(KeyCode.LeftShift) || InputManager.GetKey(KeyCode.RightShift))
if (InputManager.GetKey(ConfigManager.Speed_Up_Movement.Value))
moveSpeed *= 10f;
if (InputManager.GetKey(KeyCode.LeftAlt))
if (InputManager.GetKey(ConfigManager.Speed_Down_Movement.Value))
moveSpeed *= 0.1f;
if (InputManager.GetKey(KeyCode.LeftArrow) || InputManager.GetKey(KeyCode.A))
if (InputManager.GetKey(ConfigManager.Left_1.Value) || InputManager.GetKey(ConfigManager.Left_2.Value))
transform.position += transform.right * -1 * moveSpeed;
if (InputManager.GetKey(KeyCode.RightArrow) || InputManager.GetKey(KeyCode.D))
if (InputManager.GetKey(ConfigManager.Right_1.Value) || InputManager.GetKey(ConfigManager.Right_2.Value))
transform.position += transform.right * moveSpeed;
if (InputManager.GetKey(KeyCode.UpArrow) || InputManager.GetKey(KeyCode.W))
if (InputManager.GetKey(ConfigManager.Forwards_1.Value) || InputManager.GetKey(ConfigManager.Forwards_2.Value))
transform.position += transform.forward * moveSpeed;
if (InputManager.GetKey(KeyCode.DownArrow) || InputManager.GetKey(KeyCode.S))
if (InputManager.GetKey(ConfigManager.Backwards_1.Value) || InputManager.GetKey(ConfigManager.Backwards_2.Value))
transform.position += transform.forward * -1 * moveSpeed;
if (InputManager.GetKey(KeyCode.Space) || InputManager.GetKey(KeyCode.PageUp))
if (InputManager.GetKey(ConfigManager.Up.Value))
transform.position += transform.up * moveSpeed;
if (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.PageDown))
if (InputManager.GetKey(ConfigManager.Down.Value))
transform.position += transform.up * -1 * moveSpeed;
if (InputManager.GetKey(KeyCode.Q))
if (InputManager.GetKey(ConfigManager.Tilt_Left.Value))
transform.Rotate(0, 0, moveSpeed, Space.Self);
if (InputManager.GetKey(KeyCode.E))
if (InputManager.GetKey(ConfigManager.Tilt_Right.Value))
transform.Rotate(0, 0, - moveSpeed, Space.Self);
if (InputManager.GetMouseButton(1))
@@ -494,12 +495,12 @@ namespace UnityExplorer.UI.Panels
transform.localEulerAngles = new Vector3(newRotationY, newRotationX, transform.localEulerAngles.z);
}
if (InputManager.GetKey(KeyCode.KeypadMinus))
if (InputManager.GetKey(ConfigManager.Decrease_FOV.Value))
{
FreeCamPanel.ourCamera.fieldOfView -= moveSpeed;
}
if (InputManager.GetKey(KeyCode.KeypadPlus))
if (InputManager.GetKey(ConfigManager.Increase_FOV.Value))
{
FreeCamPanel.ourCamera.fieldOfView += moveSpeed;
}
+1 -1
View File
@@ -89,7 +89,7 @@ namespace UnityExplorer.CatmullRom
public CatmullRomMover(IntPtr ptr) : base(ptr) { }
#endif
bool playingPath;
public bool playingPath;
private bool closedLoop;
private CatmullRomPoint[] splinePoints;
// The point the camera will be following along the path