-
Notifications
You must be signed in to change notification settings - Fork 324
/
Copy pathGetInputEventEditorWindow.cs
56 lines (52 loc) · 1.64 KB
/
GetInputEventEditorWindow.cs
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace ToolKits
{
public class GetInputEventWindow : EditorWindow
{
private bool isSpaceDown = false;
private static GetInputEventWindow _window;
[MenuItem("Tools/GetInputEventWindow", priority = 24)]
private static void PopUp()
{
_window = GetWindow<GetInputEventWindow>("GetInputEventWindow");
_window.Show();
}
private void OnGUI()
{
Event e = Event.current;
if (e.isKey)
{
if (e.keyCode == KeyCode.Space)
{
isSpaceDown = e.type != EventType.KeyUp;
}
if (e.type == EventType.KeyUp)
{
if (e.keyCode == KeyCode.A && isSpaceDown)
{
Debug.LogError("组合键:空格 + A");
}
else if (e.keyCode == KeyCode.S && isSpaceDown)
{
Debug.LogError("组合键:空格 + S");
}
}
else if (e.type == EventType.KeyDown)
{
if (e.keyCode == KeyCode.UpArrow)
{
Debug.LogError("组合键:空格+上箭头");
}
else if (e.keyCode == KeyCode.DownArrow)
{
Debug.LogError("组合键:空格+下箭头");
}
}
}
}
}
}