internal static void CustomScriptGUI() { //showCustomScript = GuiX.xDrawTitleBar(" Custom Scripts", 0, new Rect(-9f, 0, 0, 0), showCustomScript); GDrawX.Bar(BarOffset).xDrawL_Arrow(ref showCustomScript).xDrawL_BoldLabel("Custom Scripts");//.xDrawR_Toggle(ref showCustomScript) if (!showCustomScript) { return; } if (customScripts == null) { customScripts = h2Settings.customScripts; } using (GuiX.xScrollView(ref scrollPos)) { for (var i = 0; i < customScripts.Length; i++) { var cs = customScripts[i]; using (GuiX.hzLayout) { cs.name = EditorGUILayout.TextField(cs.name, GUILayout.Width(180f)); cs.displayName = EditorGUILayout.TextField(cs.displayName, GUILayout.Width(180f)); EditorGUILayout.Space(); } } } }
internal static void ShortcutGUI() { var useShortcut = h2Settings.enableShortcut; GDrawX.Bar(BarOffset).xDrawL_BoldLabel("SHORTCUT").xDrawR_Toggle(ref useShortcut);//.xDrawL_Arrow(ref showCustomScript) h2Settings.enableShortcut = useShortcut; using (GuiX.hzLayout) { EditorGUI.BeginDisabledGroup(!useShortcut); h2Settings.use_Alt_Shortcut = GuiX.GLToggle(h2Settings.use_Alt_Shortcut, "Alt + Key", 130); h2Settings.use_Shift_Shortcut = GuiX.GLToggle(h2Settings.use_Shift_Shortcut, "Shift + Key", 130); h2Settings.use_Single_Shortcut = GuiX.GLToggle(h2Settings.use_Single_Shortcut, "Key", 130); EditorGUI.EndDisabledGroup(); } }
public void Draw(Action <int, int, string> onReorder = null, Action <string, string, int> onRename = null, Action <string, int, vlbGUIList <string> > OnRightClick = null, Rect?drawRect = null) { _needRepaint = false; //isExpand = GuiX.xDrawTitleBar(title, 5f, null, isExpand); GDrawX.Bar().xDrawL_Arrow(ref isExpand) .xDrawL_BoldLabel(title) .xDrawSub(subRect => { using (GuiX.DisableGroup(editIndex != -1)) { if (subRect.dy(2f).xMiniButton("+", false)) { list.Add(""); editIndex = drawer.CacheList.Count - 1; editName = ""; isExpand = true; _needRepaint = true; } } }, 16f, false, new Vector2(-2f, 0f)); //var rAdd = GUILayoutUtility.GetLastRect().xAdjustTL(16).dy(2f).dw(-2f); //if (rAdd.xMiniButton("+", false)) { // list.Add(""); // editIndex = drawer.CacheList.Count - 1; // editName = ""; // isExpand = true; // _needRepaint = true; //} if (isExpand) { drawer.Draw((r, v, idx) => { //if (idx == 0) Debug.Log("d2StringGUI " + idx + ":" + r); if (idx == editIndex) { RenameGUI(r); } else { var v1 = EditorGUI.TextField(r.dw(-20f).dt(2f), v); if (v1 != v) { list[idx] = v1; if (onRename != null) { onRename(v, v1, idx); } } //Debug.Log(Event.current + ":" + r.Contains(Event.current.mousePosition) + ":" + GUI.GetNameOfFocusedControl //remove focus when click outside if (GUI.GetNameOfFocusedControl() == focusName && !r.Contains(Event.current.mousePosition) && Event.current.type == EventType.mouseDown) { GUI.FocusControl(null); _needRepaint = true; } /*EditorGUI.LabelField(r.dl(r.width - 80f).dw(-10f).dt(2f).db(-2f), "" + depth * idx, * GuiX.miniLabelGrayStyle);*/ } //if (v != "Default") { // Can not remove group / Stacks Default var remRect = r.xSubRectRight(16f).dx(-4f); GUI.DrawTexture(remRect, EditorResource.GetTexture2D("remove")); if (remRect.xLMB_isDown().noModifier) { //updateComponent(v, null); if (editIndex == idx) { editIndex = -1; } list.RemoveAt(idx); _needRepaint = true; } //} return(18); }, onReorder, OnRightClick, null, drawRect); } }
internal static void IconsGUI() { var useIcon = h2Settings.enableIcons; GDrawX.Bar(BarOffset).xDrawL_BoldLabel("ICONS SETTINGS").xDrawR_Toggle(ref useIcon);//.xDrawL_Arrow(ref showCustomScript) h2Settings.enableIcons = useIcon; EditorGUI.BeginDisabledGroup(!useIcon); var idx = currentIconMode; var rr = GUILayoutUtility.GetLastRect(); if (iconModesDrawer == null) { iconModesDrawer = new h2StringBool { source = new StringBuilder(h2Settings.iconModes), total = h2Settings.nIcons }; } if (modeTitles == null) { var list = new List <string> { "D" }; for (var i = 1; i < h2Settings.nModes; i++) { list.Add("" + i); } modeTitles = list.ToArray(); } idx = GUI.Toolbar(rr.r(470f).l(470f - (10f + 20f * h2Settings.nModes)), idx, modeTitles); iconModesDrawer.offset = idx * (h2Settings.nIcons + 1); if (idx != currentIconMode) { currentIconMode = idx; h2Settings.currentMode = idx; h2IconMode.currentIconMode = idx; //EditorX.xDelayCall(WindowX.Hierarchy.Repaint); } const int nCols = 3; using (GuiX.hzLayout) { for (var i = 0; i < iconTitles.Length; i++) { if (i % nCols == 0) { GUILayout.BeginVertical(); } iconModesDrawer.Draw(i, (j, v) => GuiX.GLToggle(v, iconTitles[j], 130f)); if (i % nCols == nCols - 1 || i == iconTitles.Length - 1) { GUILayout.EndVertical(); } } } if (iconModesDrawer.changed) { h2Settings.iconModes = iconModesDrawer.source.ToString(); h2IconMode._iconModes = null; //Debug.Log(h2Settings.iconModes + " ---> " + iconModesDrawer.source); //Debug.Log("after ---> " + h2Settings.iconModes); } EditorGUI.EndDisabledGroup(); }