-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonitorInputSystem.cs
More file actions
53 lines (48 loc) · 1.96 KB
/
Copy pathMonitorInputSystem.cs
File metadata and controls
53 lines (48 loc) · 1.96 KB
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
using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.InputSystem.UI;
using RPGMaker.Codebase.Runtime.Map;
using RPGMaker.Codebase.Runtime.Common;
using RPGMaker.Codebase.Runtime.Common.Enum;
using RPGMaker.Codebase.CoreSystem.Helper;
using UnityEngine.InputSystem;
namespace RPGMaker.Codebase.Addon.ponApp.VirtualPad
{
public class MonitorInputSystem : MonoBehaviour
{
Action _TryToMoveCharacterDelegate;
Action _TryToMoveVehicleDelegate;
private void Start() {
InitTryToMoveMethod();
}
private void Update() {
KillTryToMove();
}
private void InitTryToMoveMethod() {
try
{
Type typeMapManager = typeof(MapManager);
MethodInfo tryToMoveCharacterMethod = typeMapManager.GetMethod("TryToMoveCharacterClick", BindingFlags.NonPublic | BindingFlags.Static);
MethodInfo tryToMoveVehicleMethod = typeMapManager.GetMethod("TryToMoveVehicleClick", BindingFlags.NonPublic | BindingFlags.Static);
_TryToMoveCharacterDelegate = (Action) Delegate.CreateDelegate(typeof(Action), null, tryToMoveCharacterMethod);
_TryToMoveVehicleDelegate = (Action) Delegate.CreateDelegate(typeof(Action), null, tryToMoveVehicleMethod);
}
catch (Exception)
{
Debug.LogWarning("Warning : InitTryToMoveMethod initialization failed.");
}
}
private void KillTryToMove() {
try
{
InputDistributor.RemoveInputHandler(GameStateHandler.GameState.MAP, HandleType.LeftClick, _TryToMoveCharacterDelegate);
InputDistributor.RemoveInputHandler(GameStateHandler.GameState.MAP, HandleType.LeftClick, _TryToMoveVehicleDelegate);
}
catch (Exception)
{
//Debug.LogWarning("Warning : KillTryToMove update failed.");
}
}
}
}