private bool DrawTableStructure() { bool changed = false; if (NGUIEditorTools.DrawHeader("Table Structure")) { NGUIEditorTools.BeginContents(); EditorGUILayout.HelpBox("Modifying structure values may occur unintented result", MessageType.Warning); changed = EditorGUIUtil.PopupEnum <UITableLayout.Arrangement>("Orientation", ref grid.arrangement, GUILayout.ExpandWidth(false)); string rowCol = grid.isHorizontal? "Column Size": "Row Size"; if (EditorGUIUtil.IntField(rowCol, ref grid.maxPerLine, GUILayout.ExpandWidth(false))) { if (grid.maxPerLine <= 0) { grid.maxPerLine = 1; } changed = true; } changed |= EditorGUIUtil.IntField("Row Header", ref grid.rowHeader, GUILayout.ExpandWidth(false)); changed |= EditorGUIUtil.IntField("Column Header", ref grid.columnHeader, GUILayout.ExpandWidth(false)); changed |= EditorGUIUtil.Toggle("Reuse Cell", ref grid.reuseCell, GUILayout.ExpandWidth(false)); NGUIEditorTools.EndContents(); } if (changed) { grid.InitArray(); } return(changed); }
public override void OnHeaderGUI(List<Object> found) { EditorGUIUtil.TextArea ("Exclude", ref exclude); EditorGUIUtil.Toggle("Exclude TexLoader", ref excludeTexLoader); EditorGUILayout.BeginHorizontal(); EditorGUIUtil.TextField(null, ref filter); if (GUILayout.Button("Search")) { SetExclude(exclude); Search(); } EditorGUILayout.EndHorizontal(); }
public override void OnHeaderGUI() { EditorGUIUtil.ObjectField <GameObject>("Scene Root", ref sceneRoot, true); GUI.enabled = sceneRoot != null; ComponentSelector.Draw <UIAtlas>("Select", NGUISettings.atlas, OnSelectAtlas, true); EditorGUIUtil.TextField("Filter", ref filter); if (EditorGUIUtil.Toggle("Expand", ref expand)) { foreach (string s in spriteMap.Keys) { foldMap[s] = expand; } } GUI.enabled = true; NGUIEditorTools.DrawSeparator(); }
private bool DrawSize() { bool changed = false; if (NGUIEditorTools.DrawHeader("Size")) { NGUIEditorTools.BeginContents(); if (EditorGUIUtil.PopupEnum <UITableLayout.HAlign>("Horizontal Align", ref grid.halign, GUILayout.ExpandWidth(false))) { for (int i = 0; i < grid.haligns.Length; ++i) { grid.haligns[i] = grid.halign; } changed = true; } if (EditorGUIUtil.PopupEnum <UITableLayout.VAlign>("Vertical Align", ref grid.valign, GUILayout.ExpandWidth(false))) { for (int i = 0; i < grid.valigns.Length; ++i) { grid.valigns[i] = grid.valign; } changed = true; } changed |= EditorGUIUtil.Vector2Field("Padding", ref grid.padding); if (grid.cellMinSize.x == 0 && grid.cellMinSize.y == 0) { changed |= EditorGUIUtil.Vector2Field("Cell Size", ref grid.cellSize); } if (grid.cellSize.x == 0 && grid.cellSize.y == 0) { changed |= EditorGUIUtil.Vector2Field("Cell Min Size", ref grid.cellMinSize); } changed |= EditorGUIUtil.IntField("Total Width", ref grid.totalWidth); changed |= EditorGUIUtil.Toggle("Resize Collider", ref grid.resizeCollider, GUILayout.ExpandWidth(false)); if (grid.resizeCollider && grid.padding != Vector2.zero) { EditorGUI.indentLevel += 1; changed |= EditorGUIUtil.Toggle("Expand Collider To Padding", ref grid.expandColliderToPadding, GUILayout.ExpandWidth(false)); EditorGUI.indentLevel -= 1; } NGUIEditorTools.EndContents(); } return(changed); }
public override void OnHeaderGUI() { EditorGUIUtil.ObjectField <LexiconRegistry>("Lexicon Registry", ref lexReg, false); if (lexReg == null) { return; } EditorGUIUtil.PopupEnum <SystemLanguage>("Mother language", ref motherLang); EditorGUIUtil.PopupEnum <SystemLanguage>("Language", ref lang); fold = EditorGUILayout.Foldout(fold, "Translate All"); if (fold) { if (GUILayout.Button("Convert all Scene and prefab") && EditorUtility.DisplayDialog("Confirm", "Convert All?", "OK", "Cancel")) { Lexicon.SetMotherLanguage(motherLang); Lexicon.SetLanguage(lang); TranslateLanguage(); } } EditorGUIUtil.Toggle("Lock", ref locked); if (EditorGUIUtil.Toggle("Visible Only", ref visibleOnly)) { roots = null; } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Reload Table", GUILayout.Height(30))) { ReloadTable(); ApplyTableToText(); } if (GUILayout.Button("Apply table to text", GUILayout.Height(30))) { ApplyTableToText(); } if (GUILayout.Button("Revert", GUILayout.Height(30))) { Clear(); } EditorGUILayout.EndHorizontal(); DrawFindLexiconGUI(); }
protected override bool OnInspectorGUI(UITab tab, int i) { bool changed = base.OnInspectorGUI(tab, i); if (tab != null && selectTab) { bool visible = tab.IsVisible(); if (EditorGUIUtil.Toggle(null, ref visible, GUILayout.Width(30))) { changed = true; for (int j = 0; j < Length; ++j) { UITab t = this[j] as UITab; if (tab != t) { t.uiRoot.SetActive(false); } EditorUtil.SetDirty(t.gameObject); } tab.uiRoot.SetActive(true); } } return(changed); }
private void DrawAudioTriggers() { EditorGUIUtil.Toggle("Lock", ref locked); // set missing triggers EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Missing"); if (missingTriggerInspector.DrawInspectorGUI(ref missingTable, ref missingClip) && missingClip.IsNotEmpty()) { foreach (AudioTriggerInspectorImpl i in triggers) { if (i.trigger.audioGroupGuid.IsEmpty() || i.trigger.clip.IsEmpty()) { i.SelectTable(missingTable); i.trigger.clip = missingClip; CompatibilityEditor.SetDirty(i.trigger); changedList.Add(i.trigger.gameObject); } } } EditorGUILayout.EndHorizontal(); EditorGUIUtil.DrawSeparator(); // Search AudioTriggers if ((roots.IsEmpty() || !locked) && Selection.gameObjects.IsNotEmpty() && !Array.Equals(roots, Selection.gameObjects)) { Clear(); roots = Selection.gameObjects; List <AudioTrigger> audio = new List <AudioTrigger> (); foreach (GameObject o in roots) { foreach (UIButton btn in o.GetComponentsInChildren <UIButton>(true)) { AudioTrigger[] t = btn.GetComponents <AudioTrigger> (); if (t.IsEmpty()) { t = new AudioTrigger[] { btn.gameObject.AddComponent <AudioTrigger> () }; changedList.Add(btn.gameObject); CompatibilityEditor.SetDirty(btn.gameObject); } audio.AddRange(t); } } AudioDataTable[] tables = AudioTriggerInspectorImpl.LoadTables(); triggers = new AudioTriggerInspectorImpl[audio.Count]; for (int i = 0; i < audio.Count; ++i) { triggers [i] = new AudioTriggerInspectorImpl(audio [i], tables); triggers [i].showLabel = false; } } // draw trigger list EditorGUILayout.BeginVertical(); foreach (AudioTriggerInspectorImpl a in triggers) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(a.trigger.gameObject, typeof(GameObject), true); if (a.DrawInspectorGUI()) { changedList.Add(a.trigger.gameObject); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); if (GUILayout.Button("Save")) { SaveChange(changedList); changedList.Clear(); } }
public override void OnHeaderGUI() { Validate(); EditorGUILayout.BeginHorizontal(); if (EditorGUIUtil.ObjectField <GameObject>("Root", ref root, true)) { Refresh(); } GUI.enabled = root != null; if (GUILayout.Button("Refresh", GUILayout.ExpandWidth(false))) { Refresh(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); UIPanel[] panels = root != null?root.GetComponentsInChildren <UIPanel>(true) : new UIPanel[0]; EditorGUILayout.BeginHorizontal(); if (EditorGUIUtil.PopupNullable("Panel", ref panelSel, panels, ObjToString.DefaultToString)) { Refresh(); if (panelSel != null) { EditorGUIUtility.PingObject(panelSel); Selection.activeGameObject = panelSel.gameObject; } } EditorGUIUtil.Toggle("Show Active Only", ref showActiveOnly); EditorGUILayout.EndHorizontal(); UIAtlas[] atlases = GetAtlases(widgets); UIFont[] fonts = GetFonts(widgets); if (EditorGUIUtil.PopupNullable("Select Atlas", ref atlasSel, atlases, ObjToString.DefaultToString)) { if (atlasSel != null) { fontSel = null; } } if (EditorGUIUtil.PopupNullable("Select Font", ref fontSel, fonts, ObjToString.DefaultToString)) { if (fontSel != null) { atlasSel = null; } } EditorGUILayout.BeginHorizontal(); int index = Array.FindIndex(widgets, w => w.gameObject == Selection.activeGameObject); GUI.enabled = index >= 0; if (GUI.enabled) { if (GUILayout.Button("+1 over selection")) { for (int i = 0; i <= index; ++i) { widgets[i].depth = widgets[i].depth + 1; CompatibilityEditor.SetDirty(widgets[i]); } } if (GUILayout.Button("-1 under selection")) { for (int i = index; i < widgets.Length; ++i) { widgets[i].depth = widgets[i].depth - 1; CompatibilityEditor.SetDirty(widgets[i]); } } // TODOM key handling var e = Event.current; if (e.type == EventType.KeyUp) { if (e.keyCode == KeyCode.UpArrow) { index--; if (index >= 0) { Select(widgets[index]); } } else if (e.keyCode == KeyCode.DownArrow) { index++; if (index < widgets.Length) { Select(widgets[index]); } } } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }