public override void OnInspectorGUI() { base.OnInspectorGUI(); if (QuickGUI.TitleBar("Add Point", 12) == 0) { mPolygon.AddPoint(Vector2.zero); return; } drop = QuickGUI.DrawHeader("Points", null, drop); if (drop) { QuickGUI.BeginContents(20); for (int i = 0; i < mPolygon.Points.Length; i++) { bool del = false; Vector2 p = mPolygon.Points[i]; EditorGUILayout.BeginHorizontal(); Vector2 newp = EditorGUILayout.Vector2Field("", p); if (p != newp) { mPolygon.Points[i] = newp; mPolygon.SetVerticesDirty(); } if (i > 2 && GUILayout.Button("-", GUILayout.Width(20))) { del = true; } EditorGUILayout.EndHorizontal(); if (del) { mPolygon.RemovePoint(i); break; } } QuickGUI.EndContents(); } }
void DrawDingObject() { if (!mDingObject || !mDing) { mDingObject = Selection.activeGameObject; } if (!mDingObject) { EditorGUILayout.BeginVertical("flow overlay box", GUILayout.Width(350)); GUILayout.Label("<size=25><b>NOTHINE SELECTED.</b></size>"); EditorGUILayout.EndVertical(); return; } EditorGUILayout.BeginVertical("flow overlay box", GUILayout.Width(350)); string t = mDingObject.name; int s = QuickGUI.TitleBar(t, 15, new string[] { mDing ? "<25>true:\u2764" : "<25>\u2764", mDingObject.activeSelf ? "<25>true:\u2714" : "<25>\u2714" }); if (s == 1) { mDing = !mDing; if (!mDing && Selection.activeGameObject) { mDingObject = Selection.activeGameObject; } } else if (s == 2) { mDingObject.gameObject.SetActive(!mDingObject.activeSelf); } if (s >= 0) { EditorGUIUtility.PingObject(mDingObject); } dingScroll = EditorGUILayout.BeginScrollView(dingScroll); Component[] cps = mDingObject.GetComponents <Component>(); for (int i = 0; i < cps.Length; i++) { if (!cps[i] || cps[i] is Transform) { continue; } //System.Type ctp = cps[i].GetType(); int id = cps[i].GetInstanceID(); bool v = popDingCmps.Contains(id); bool v2 = EditorGUILayout.InspectorTitlebar(v, cps[i]); if (v2 ^ v) { if (!v2) { popDingCmps.Remove(id); popDingEditors.Remove(id); } else { popDingCmps.Add(id); } } if (v2) { UnityEditor.Editor edi;// sr.GetValue<Editor>(cmps[i].GetType().Name); if (!popDingEditors.TryGetValue(id, out edi) || !edi) { edi = UnityEditor.Editor.CreateEditor(cps[i]); popDingEditors[id] = edi; } if (edi) { edi.OnInspectorGUI(); } } } GUILayout.Space(10); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { mPos = EditorGUILayout.BeginScrollView(mPos); if (mTarget.m_Anims != null) { for (int i = 0; i < mTarget.m_Anims.Length; i++) { bool drop = mDropIndex == i; EditorGUILayout.BeginVertical(drop ? "flow overlay box" : "box"); var anim = mTarget.m_Anims[i]; int ret = QuickGUI.TitleBarWithBtn(anim.m_Name, 12, 15, "OL Minus", "OL Plus"); if (ret == 0) { mDropIndex = i; GUI.FocusControl(null); } if (drop) { var str = EditorGUILayout.TextField("Name", anim.m_Name ?? ""); mDirty |= str != anim.m_Name; anim.m_Name = str; var dur = Mathf.Max(0.0001f, EditorGUILayout.FloatField("Duration", anim.m_Duration)); mDirty |= dur != anim.m_Duration; anim.m_Duration = dur; OnFrameGUI(anim); } if (drop) { GUILayout.Space(10); } EditorGUILayout.EndVertical(); if (ret == 1) { RemoveAnim(i); mDirty = true; GUI.FocusControl(null); break; } else if (ret == 2) { InsertAnim(i, anim); mDropIndex = i; mDirty = true; GUI.FocusControl(null); break; } } } EditorGUILayout.BeginVertical("U2D.createRect"); if (QuickGUI.TitleBar("New Emoji Animation", 13) == 0) { InsertAnim(mTarget.m_Anims == null ? 0 : mTarget.m_Anims.Length); mDropIndex = mTarget.m_Anims.Length - 1; mDirty = true; GUI.FocusControl(null); } if (mDirty) { mDirty = false; EditorUtility.SetDirty(target); serializedObject.Update(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }