-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathUIButtonKeys.cs
56 lines (49 loc) · 1.13 KB
/
UIButtonKeys.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 UnityEngine;
[AddComponentMenu("NGUI/Interaction/Button Keys (Legacy)")]
[ExecuteInEditMode]
public class UIButtonKeys : UIKeyNavigation
{
public UIButtonKeys selectOnClick;
public UIButtonKeys selectOnUp;
public UIButtonKeys selectOnDown;
public UIButtonKeys selectOnLeft;
public UIButtonKeys selectOnRight;
protected override void OnEnable()
{
Upgrade();
base.OnEnable();
}
public void Upgrade()
{
if (onClick == null && selectOnClick != null)
{
onClick = selectOnClick.gameObject;
selectOnClick = null;
NGUITools.SetDirty(this);
}
if (onLeft == null && selectOnLeft != null)
{
onLeft = selectOnLeft.gameObject;
selectOnLeft = null;
NGUITools.SetDirty(this);
}
if (onRight == null && selectOnRight != null)
{
onRight = selectOnRight.gameObject;
selectOnRight = null;
NGUITools.SetDirty(this);
}
if (onUp == null && selectOnUp != null)
{
onUp = selectOnUp.gameObject;
selectOnUp = null;
NGUITools.SetDirty(this);
}
if (onDown == null && selectOnDown != null)
{
onDown = selectOnDown.gameObject;
selectOnDown = null;
NGUITools.SetDirty(this);
}
}
}