mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-18 09:07:51 +08:00
Cleanup libs, target ML 0.3.1
This commit is contained in:
@ -7,11 +7,7 @@ using UnityExplorer.Core.Config;
|
||||
using UnityExplorer.Core;
|
||||
using UnityExplorer.UI;
|
||||
using System.Collections;
|
||||
#if ML
|
||||
using Harmony;
|
||||
#else
|
||||
using HarmonyLib;
|
||||
#endif
|
||||
|
||||
namespace UnityExplorer.Core.Input
|
||||
{
|
||||
@ -215,198 +211,4 @@ namespace UnityExplorer.Core.Input
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Was rewriting but something broke, not looking into it right now.
|
||||
|
||||
//using System;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.EventSystems;
|
||||
//using UnityExplorer.Core.Input;
|
||||
//using BF = System.Reflection.BindingFlags;
|
||||
//using UnityExplorer.Core.Config;
|
||||
//using UnityExplorer.Core;
|
||||
//using UnityExplorer.UI;
|
||||
//using System.Collections;
|
||||
//#if ML
|
||||
//using Harmony;
|
||||
//#else
|
||||
//using HarmonyLib;
|
||||
//#endif
|
||||
|
||||
//namespace UnityExplorer.Core.Input
|
||||
//{
|
||||
// public class CursorUnlocker
|
||||
// {
|
||||
// public static bool Unlock
|
||||
// {
|
||||
// get => unlock;
|
||||
// set
|
||||
// {
|
||||
// unlock = value;
|
||||
// UpdateCursorControl();
|
||||
// }
|
||||
// }
|
||||
// private static bool unlock;
|
||||
|
||||
// public static bool ShouldActuallyUnlock => UIManager.ShowMenu && Unlock;
|
||||
|
||||
// private static CursorLockMode lastLockMode;
|
||||
// private static bool lastVisibleState;
|
||||
|
||||
// private static bool currentlySetting = false;
|
||||
|
||||
// private static Type CursorType
|
||||
// => cursorType
|
||||
// ?? (cursorType = ReflectionUtility.GetTypeByName("UnityEngine.Cursor"));
|
||||
// private static Type cursorType;
|
||||
|
||||
// public static void Init()
|
||||
// {
|
||||
// SetupPatches();
|
||||
|
||||
// UpdateCursorControl();
|
||||
|
||||
// Unlock = ConfigManager.Force_Unlock_Mouse.Value;
|
||||
// ConfigManager.Force_Unlock_Mouse.OnValueChanged += (bool val) => { Unlock = val; };
|
||||
|
||||
// if (ConfigManager.Aggressive_Force_Unlock.Value)
|
||||
// RuntimeProvider.Instance.StartCoroutine(ForceUnlockCoroutine());
|
||||
// }
|
||||
|
||||
// private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
|
||||
|
||||
// private static IEnumerator ForceUnlockCoroutine()
|
||||
// {
|
||||
// while (true)
|
||||
// {
|
||||
// yield return _waitForEndOfFrame;
|
||||
|
||||
// UpdateCursorControl();
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void UpdateCursorControl()
|
||||
// {
|
||||
// currentlySetting = true;
|
||||
|
||||
// if (ShouldActuallyUnlock)
|
||||
// {
|
||||
// if (Cursor.lockState != CursorLockMode.None)
|
||||
// Cursor.lockState = CursorLockMode.None;
|
||||
// if (!Cursor.visible)
|
||||
// Cursor.visible = true;
|
||||
|
||||
// SetEventSystem();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (Cursor.lockState != lastLockMode)
|
||||
// Cursor.lockState = lastLockMode;
|
||||
// if (Cursor.visible != lastVisibleState)
|
||||
// Cursor.visible = lastVisibleState;
|
||||
|
||||
// ReleaseEventSystem();
|
||||
// }
|
||||
|
||||
// currentlySetting = false;
|
||||
// }
|
||||
|
||||
// // Event system overrides
|
||||
|
||||
// private static bool m_settingEventSystem;
|
||||
// private static EventSystem m_lastEventSystem;
|
||||
// private static BaseInputModule m_lastInputModule;
|
||||
|
||||
// public static void SetEventSystem()
|
||||
// {
|
||||
// if (InputManager.CurrentType == InputType.InputSystem
|
||||
// || !UIManager.EventSys
|
||||
// || EventSystem.current == UIManager.EventSys)
|
||||
// return;
|
||||
|
||||
// if (EventSystem.current && EventSystem.current != UIManager.EventSys)
|
||||
// {
|
||||
// m_lastEventSystem = EventSystem.current;
|
||||
// m_lastEventSystem.enabled = false;
|
||||
// }
|
||||
|
||||
// // Set to our current system
|
||||
// m_settingEventSystem = true;
|
||||
// UIManager.EventSys.enabled = true;
|
||||
// EventSystem.current = UIManager.EventSys;
|
||||
// InputManager.ActivateUIModule();
|
||||
// m_settingEventSystem = false;
|
||||
// }
|
||||
|
||||
// public static void ReleaseEventSystem()
|
||||
// {
|
||||
// if (InputManager.CurrentType == InputType.InputSystem
|
||||
// || !UIManager.EventSys
|
||||
// || EventSystem.current != UIManager.EventSys
|
||||
// || !m_lastEventSystem)
|
||||
// return;
|
||||
|
||||
// if (m_lastEventSystem.gameObject.activeInHierarchy)
|
||||
// {
|
||||
// m_lastEventSystem.enabled = true;
|
||||
|
||||
// m_settingEventSystem = true;
|
||||
// EventSystem.current = m_lastEventSystem;
|
||||
// m_lastInputModule?.ActivateModule();
|
||||
// m_settingEventSystem = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Patches
|
||||
|
||||
// private static void SetupPatches()
|
||||
// {
|
||||
// if (CursorType == null)
|
||||
// throw new Exception("Could not load Type 'UnityEngine.Cursor'!");
|
||||
|
||||
// lastLockMode = Cursor.lockState;
|
||||
// lastVisibleState = Cursor.visible;
|
||||
|
||||
// // Let mod loader handle actual patching (only necessary until ML 0.3.1)
|
||||
// ExplorerCore.Loader.SetupCursorPatches();
|
||||
// }
|
||||
|
||||
// public static void Prefix_EventSystem_set_current(ref EventSystem value)
|
||||
// {
|
||||
// if (!m_settingEventSystem && value != UIManager.EventSys)
|
||||
// {
|
||||
// m_lastEventSystem = value;
|
||||
// m_lastInputModule = value?.currentInputModule;
|
||||
|
||||
// if (ShouldActuallyUnlock)
|
||||
// {
|
||||
// value = UIManager.EventSys;
|
||||
// value.enabled = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void Prefix_set_lockState(ref CursorLockMode value)
|
||||
// {
|
||||
// if (!currentlySetting)
|
||||
// {
|
||||
// lastLockMode = value;
|
||||
|
||||
// if (ShouldActuallyUnlock)
|
||||
// value = CursorLockMode.None;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void Prefix_set_visible(ref bool value)
|
||||
// {
|
||||
// if (!currentlySetting)
|
||||
// {
|
||||
// lastVisibleState = value;
|
||||
|
||||
// if (ShouldActuallyUnlock)
|
||||
// value = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
Reference in New Issue
Block a user