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 = EditorGUILayoutUtil.PopupEnum <UITableLayout.Arrangement>("Orientation", ref grid.arrangement, GUILayout.ExpandWidth(false)); string rowCol = grid.isHorizontal? "Column Size": "Row Size"; if (EditorGUILayoutUtil.IntField(rowCol, ref grid.maxPerLine, GUILayout.ExpandWidth(false))) { if (grid.maxPerLine <= 0) { grid.maxPerLine = 1; } changed = true; } changed |= EditorGUILayoutUtil.IntField("Row Header", ref grid.rowHeader, GUILayout.ExpandWidth(false)); changed |= EditorGUILayoutUtil.IntField("Column Header", ref grid.columnHeader, GUILayout.ExpandWidth(false)); changed |= EditorGUILayoutUtil.Toggle("Reuse Cell", ref grid.reuseCell, GUILayout.ExpandWidth(false)); NGUIEditorTools.EndContents(); } if (changed) { grid.InitArray(); } return(changed); }
public static void PreferenceMenu() { bool di = DiService.enableDi; if (EditorGUILayoutUtil.Toggle("enable DI", ref di)) { DiService.enableDi = di; Save(); } }
public override void OnHeaderGUI(List <Object> found) { EditorGUILayoutUtil.TextArea("Exclude", ref exclude); EditorGUILayoutUtil.Toggle("Exclude TexLoader", ref excludeTexLoader); EditorGUILayout.BeginHorizontal(); EditorGUILayoutUtil.TextField(null, ref filter); if (GUILayout.Button("Search")) { SetExclude(exclude); Search(); } EditorGUILayout.EndHorizontal(); }
public override void OnHeaderGUI() { EditorGUILayoutUtil.ObjectField <GameObject>("Scene Root", ref sceneRoot, true); GUI.enabled = sceneRoot != null; ComponentSelector.Draw("Select", NGUISettings.atlas, OnSelectAtlas, true); EditorGUILayoutUtil.TextField("Filter", ref filter); if (EditorGUILayoutUtil.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 (EditorGUILayoutUtil.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 (EditorGUILayoutUtil.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 |= EditorGUILayoutUtil.Vector2Field("Padding", ref grid.padding); if (grid.cellMinSize.x == 0 && grid.cellMinSize.y == 0) { changed |= EditorGUILayoutUtil.Vector2Field("Cell Size", ref grid.cellSize); } if (grid.cellSize.x == 0 && grid.cellSize.y == 0) { changed |= EditorGUILayoutUtil.Vector2Field("Cell Min Size", ref grid.cellMinSize); } changed |= EditorGUILayoutUtil.IntField("Total Width", ref grid.totalWidth); changed |= EditorGUILayoutUtil.Toggle("Resize Collider", ref grid.resizeCollider, GUILayout.ExpandWidth(false)); if (grid.resizeCollider && grid.padding != Vector2.zero) { EditorGUI.indentLevel += 1; changed |= EditorGUILayoutUtil.Toggle("Expand Collider To Padding", ref grid.expandColliderToPadding, GUILayout.ExpandWidth(false)); EditorGUI.indentLevel -= 1; } NGUIEditorTools.EndContents(); } return(changed); }
public override void OnHeaderGUI() { EditorGUILayoutUtil.ObjectField <LexiconRegistry>("Lexicon Registry", ref lexReg, false); if (lexReg == null) { return; } EditorGUILayoutUtil.PopupEnum <SystemLanguage>("Mother language", ref motherLang); EditorGUILayoutUtil.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(); } } EditorGUILayoutUtil.Toggle("Lock", ref locked); if (EditorGUILayoutUtil.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 (EditorGUILayoutUtil.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); }
public override void OnHeaderGUI() { Validate(); EditorGUILayout.BeginHorizontal(); if (EditorGUILayoutUtil.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 (EditorGUILayoutUtil.PopupNullable("Panel", ref panelSel, panels, ObjToString.DefaultToString)) { Refresh(); if (panelSel != null) { EditorGUIUtility.PingObject(panelSel); Selection.activeGameObject = panelSel.gameObject; } } EditorGUILayoutUtil.Toggle("Show Active Only", ref showActiveOnly); EditorGUILayout.EndHorizontal(); INGUIAtlas[] atlases = GetAtlases(widgets); INGUIFont[] fonts = GetFonts(widgets); if (EditorGUILayoutUtil.PopupNullable("Select Atlas", ref atlasSel, atlases, ObjToString.DefaultToString)) { if (atlasSel != null) { fontSel = null; } } if (EditorGUILayoutUtil.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; EditorUtil.SetDirty(widgets[i]); } } if (GUILayout.Button("-1 under selection")) { for (int i = index; i < widgets.Length; ++i) { widgets[i].depth = widgets[i].depth - 1; EditorUtil.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(); }