Nextrek
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
|
//----------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2013 Tasharen Entertainment
//----------------------------------------------
using UnityEngine;
using UnityEditor;
[CanEditMultipleObjects]
[CustomEditor(typeof(UIToggle))]
public class UIToggleInspector : UIWidgetContainerEditor
{
enum Transition
{
Smooth,
Instant,
}
public override void OnInspectorGUI ()
{
serializedObject.Update();
NGUIEditorTools.SetLabelWidth(100f);
UIToggle toggle = target as UIToggle;
GUILayout.Space(6f);
GUI.changed = false;
GUILayout.BeginHorizontal();
NGUIEditorTools.DrawProperty("Group", serializedObject, "group", GUILayout.Width(120f));
GUILayout.Label(" - zero means 'none'");
GUILayout.EndHorizontal();
NGUIEditorTools.DrawProperty("Starting State", serializedObject, "startsActive");
NGUIEditorTools.SetLabelWidth(80f);
if (NGUIEditorTools.DrawHeader("State Transition"))
{
NGUIEditorTools.BeginContents();
NGUIEditorTools.DrawProperty("Sprite", serializedObject, "activeSprite");
NGUIEditorTools.DrawProperty("Animation", serializedObject, "activeAnimation");
if (serializedObject.isEditingMultipleObjects)
{
NGUIEditorTools.DrawProperty("Instant", serializedObject, "instantTween");
}
else
{
GUI.changed = false;
Transition tr = toggle.instantTween ? Transition.Instant : Transition.Smooth;
GUILayout.BeginHorizontal();
tr = (Transition)EditorGUILayout.EnumPopup("Transition", tr);
GUILayout.Space(18f);
GUILayout.EndHorizontal();
if (GUI.changed)
{
NGUIEditorTools.RegisterUndo("Toggle Change", toggle);
toggle.instantTween = (tr == Transition.Instant);
UnityEditor.EditorUtility.SetDirty(toggle);
}
}
NGUIEditorTools.EndContents();
}
NGUIEditorTools.DrawEvents("On Value Change", toggle, toggle.onChange);
serializedObject.ApplyModifiedProperties();
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|