diff options
| author | chai <215380520@qq.com> | 2023-11-02 11:51:31 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2023-11-02 11:51:31 +0800 |
| commit | 7f493f682503f5186308de7b8f74b5b49233cfe4 (patch) | |
| tree | 8a91e2056bc79788ee4735dce88b8d516ba12beb /Thronefall/Rewired/InputManager.cs | |
+init
Diffstat (limited to 'Thronefall/Rewired/InputManager.cs')
| -rw-r--r-- | Thronefall/Rewired/InputManager.cs | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Thronefall/Rewired/InputManager.cs b/Thronefall/Rewired/InputManager.cs new file mode 100644 index 0000000..1bae3e4 --- /dev/null +++ b/Thronefall/Rewired/InputManager.cs @@ -0,0 +1,81 @@ +using System.ComponentModel; +using System.Text.RegularExpressions; +using Rewired.Platforms; +using Rewired.Utils; +using Rewired.Utils.Interfaces; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Rewired; + +[AddComponentMenu("Rewired/Input Manager")] +[EditorBrowsable(EditorBrowsableState.Never)] +public sealed class InputManager : InputManager_Base +{ + private bool ignoreRecompile; + + protected override void OnInitialized() + { + SubscribeEvents(); + } + + protected override void OnDeinitialized() + { + UnsubscribeEvents(); + } + + protected override void DetectPlatform() + { + scriptingBackend = ScriptingBackend.Mono; + scriptingAPILevel = ScriptingAPILevel.Net20; + editorPlatform = EditorPlatform.None; + platform = Platform.Unknown; + webplayerPlatform = WebplayerPlatform.None; + isEditor = false; + if (SystemInfo.deviceName == null) + { + _ = string.Empty; + } + if (SystemInfo.deviceModel == null) + { + _ = string.Empty; + } + platform = Platform.Windows; + scriptingBackend = ScriptingBackend.Mono; + scriptingAPILevel = ScriptingAPILevel.NetStandard20; + } + + protected override void CheckRecompile() + { + } + + protected override IExternalTools GetExternalTools() + { + return new ExternalTools(); + } + + private bool CheckDeviceName(string searchPattern, string deviceName, string deviceModel) + { + if (!Regex.IsMatch(deviceName, searchPattern, RegexOptions.IgnoreCase)) + { + return Regex.IsMatch(deviceModel, searchPattern, RegexOptions.IgnoreCase); + } + return true; + } + + private void SubscribeEvents() + { + UnsubscribeEvents(); + SceneManager.sceneLoaded += OnSceneLoaded; + } + + private void UnsubscribeEvents() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + OnSceneLoaded(); + } +} |
