summaryrefslogtreecommitdiff
path: root/Thronefall_v1.57/Thronefall/Rewired/InputManager.cs
blob: 1bae3e41ed0957724d93e7e646911d4b322c296b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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();
	}
}