/** 使用するか否かのトグル表示 */ protected IDisposable showIsEnableToggle() { var ret = new GUILayout.VerticalScope("box"); isEnable = EditorGUILayout.ToggleLeft(new GUIContent(name, tooltips), isEnable); return(new MergeDispose(new IDisposable[] { ret, new IndentScope() })); }
public virtual void DoGUI() { var list = GetSortedList((T)this); var count = list.Count(); using (new GUILayout.HorizontalScope()) { GUILayout.Label($"{label}: "); currentIdx = GUILayout.Toolbar(currentIdx, list.Select(ins => ins.name).ToArray()); } var current = list.ElementAt(Mathf.Min(currentIdx, count - 1)); var isTop = list.First() == current; var tmp = GUI.enabled; GUI.enabled = isTop; using (var h = new GUILayout.HorizontalScope()) { GUILayout.Space(16f); using (var v = new GUILayout.VerticalScope()) { current.DoGUIInternal(); } } GUI.enabled = tmp; }
public override void Draw(int window) { DrawTab(); if (!isInit) { return; } using (var vertical = new GUILayout.VerticalScope()) { switch (_selectedTab) { case 0: DrawHeader(); DrawScrollViewHierarchy(); break; case 1: DrawScrollViewModify(); break; case 2: DrawEvent(); break; } if (GUILayout.Button(new GUIContent("Close"))) { show = false; SetViewPageItem(null); } } base.Draw(window); }
public static int Popup(int selectedIndex, List <string> displayedOptions, ref bool opened) { string cur = displayedOptions[selectedIndex]; if (opened) { GUILayout.BeginVertical(); if (GUILayout.Button(cur)) { opened = false; } using (var scope = new GUILayout.VerticalScope("box")) { for (int i = 0; i < displayedOptions.Count; i++) { if (GUILayout.Button(displayedOptions[i])) { opened = false; return(i); } } } GUILayout.EndVertical(); } else { if (GUILayout.Button(cur)) { opened = true; } } return(selectedIndex); }
static object SliderFuncVector <T>(object v, object min, object max, ref string unparsedStr, string label = "", string[] elemLabels = null) { var elementNum = AbstractVector.GetElementNum <T>(); var eLabels = elemLabels ?? defaultElemLabelsVector; using (var h0 = new GUILayout.HorizontalScope()) { if (!string.IsNullOrEmpty(label)) { GUILayout.Label(label); } using (var vertical = new GUILayout.VerticalScope()) { var strs = SplitUnparsedStr(unparsedStr, elementNum); for (var i = 0; i < elementNum; ++i) { using (var h1 = new GUILayout.HorizontalScope()) { var elem = Slider(AbstractVector.GetAtIdx <T>(v, i), AbstractVector.GetAtIdx <T>(min, i), AbstractVector.GetAtIdx <T>(max, i), ref strs[i], eLabels[i]); v = AbstractVector.SetAtIdx <T>(v, i, elem); } } unparsedStr = JoinUnparsedStr(strs); } } return(v); }
public void DrawArray(RangeOfOperator.Range indexOfOperator) { GUILayout.Space(5); bool[,] arrayTransformTop = indexOfOperator.array; scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.BeginHorizontal(); for (int x = -1; x < arrayTransformTop.GetLength(0); x++) { EditorGUILayout.BeginVertical(); for (int y = -1; y < arrayTransformTop.GetLength(1); y++) { using (var verticalScope = new GUILayout.VerticalScope("box")) { if (isTableFieldNames(x, y)) { continue; } DrowTogle(arrayTransformTop, x, y, indexOfOperator, 25, 20); } } EditorGUILayout.EndVertical(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); GUILayout.Space(5); }
static object SliderFuncRect(object v, object min, object max, ref string unparsedStr, string label = "", string[] elemLabels = null) { const int elementNum = 4; var eLabels = elemLabels ?? defaultElemLabelsRect; using (var h0 = new GUILayout.HorizontalScope()) { if (!string.IsNullOrEmpty(label)) { GUILayout.Label(label); } using (var vertical = new GUILayout.VerticalScope()) { var strs = SplitUnparsedStr(unparsedStr, elementNum); var rect = (Rect)v; var rectMin = (Rect)min; var rectMax = (Rect)max; rect.x = Slider(rect.x, rectMin.x, rectMax.x, ref strs[0], eLabels[0]); rect.y = Slider(rect.y, rectMin.y, rectMax.y, ref strs[1], eLabels[1]); rect.width = Slider(rect.width, rectMin.width, rectMax.width, ref strs[2], eLabels[2]); rect.height = Slider(rect.height, rectMin.height, rectMax.height, ref strs[3], eLabels[3]); v = rect; unparsedStr = JoinUnparsedStr(strs); } } return(v); }
static public void OnGUIEnum <T>(ref T value, string displayName = null, GUILayoutOption[] op = null) where T : struct { using (var h = new GUILayout.VerticalScope()) { var labels = Enum.GetNames(typeof(T)); var index = Array.IndexOf(labels, Enum.GetName(typeof(T), value)); if (labels.Length > 1) { GUILayout.Label(displayName); if (index >= 0) { index = GUILayout.SelectionGrid(index, labels, 4, op); Enum.TryParse(labels[index], out value); } else { GUILayout.Label(string.Format("value:{0} index {1} is not valid", value, index)); } } else { GUILayout.Label(displayName + labels.FirstOrDefault()); } } }
public void DrawArray(bool[,] array, float MaxWidth, float MaxHeight) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.BeginHorizontal(); for (int x = -1; x < array.GetLength(0); x++) { EditorGUILayout.BeginVertical(); for (int y = -1; y < array.GetLength(1); y++) { using (var verticalScope = new GUILayout.VerticalScope("box")) { if (isTableFieldNames(x, y)) { continue; } array[x, y] = EditorGUILayout.Toggle(array[x, y], GUILayout.MaxWidth(MaxWidth), GUILayout.MaxHeight(MaxHeight)); } } EditorGUILayout.EndVertical(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); GUILayout.Space(5); }
private void RegisteredListenersList() { using (GUILayout.HorizontalScope h = new GUILayout.HorizontalScope("ToolbarButton")) { GUILayout.Label("Registered Listeners"); } if (!Application.isPlaying) { using (GUILayout.VerticalScope v = new GUILayout.VerticalScope(GameEventStyles.Box, GUILayout.Height(21))) GUILayout.Label("All GameEventListeners registered to this event. Populated at runtime."); } else { using (GUILayout.ScrollViewScope s = new GUILayout.ScrollViewScope(_listenersScrollPosition, GameEventStyles.Box)) { _listenersScrollPosition = s.scrollPosition; if (_listeners.Count == 0) { GUILayout.Label("No GameEventListeners are registered to this event."); } for (int i = 0; i < _listeners.Count; i++) { GUIStyle style = i % 2 == 0 ? GameEventStyles.ListBackgroundEven : GameEventStyles.ListBackgroundOdd; if (GUILayout.Button(_listeners[i].gameObject.name, style)) { Selection.activeObject = _listeners[i]; } } } } }
private void OnGUI() { if (isDebugMenu) { _windowRect.x = Screen.width / 2 - _windowRect.width / 2; _windowRect.y = Screen.height / 2 - _windowRect.height / 2; GUILayout.Window( GetHashCode(), _windowRect, (id) => { using (var v = new GUILayout.VerticalScope(GUILayout.MinWidth(300f))) { blockManager.DebugMenu(); etherscan.DebugMenu(); bool isCalib = GUILayout.Toggle(isCalibrationpattern, "Disp CalibrationPattern"); if (isCalib != isCalibrationpattern) { UpdateCanvas(isCalib); } } GUI.DragWindow(); }, "Settings"); } }
void OnGUIAnimator() { using (var title = new GUILayout.VerticalScope("box")){ EditorGUILayout.LabelField("export component graph", EditorStyles.boldLabel); EditorGUILayout.Space(); exportClassReference = EditorGUILayout.Toggle("reference class", exportClassReference); exportCallbacks = EditorGUILayout.Toggle("callback", exportCallbacks); exportIsComponentOnly = EditorGUILayout.Toggle("component only", exportIsComponentOnly); if (GUILayout.Button("export")) { ExplortReferenceMap.Export(exportClassReference, exportCallbacks, exportIsComponentOnly); } } using (var title = new GUILayout.VerticalScope("box")){ EditorGUILayout.LabelField("export object graph", EditorStyles.boldLabel); EditorGUILayout.Space(); isContainFamilly = EditorGUILayout.Toggle("contain familly", isContainFamilly); exportCallbacks = EditorGUILayout.Toggle("callback", exportCallbacks); if (GUILayout.Button("export")) { ExplortReferenceMap.ExportObjectReference(isContainFamilly, exportCallbacks); } } }
public bool OnGUI() { var ret = false; var drawFuncs = _funcDatas.Where(fd => fd._checkEnable == null || fd._checkEnable()).Select(fd => fd._draw).ToList(); if (drawFuncs.Any()) { var foldStr = _foldOpen ? "▼" : "▶"; using (var h = new GUILayout.HorizontalScope()) { _foldOpen ^= GUILayout.Button(foldStr + _name, Style.FoldoutPanelStyle); _titleAction?.Invoke(); } if (_foldOpen) { using (var v = new GUILayout.VerticalScope("window")) { ret = drawFuncs.Aggregate(false, (changed, drawFunc) => changed || drawFunc()); } } } return(ret); }
protected override void DrawItem() { using (var scroll = new GUILayout.ScrollViewScope(scrollPos)) { scrollPos = scroll.scrollPosition; using (var vertical = new GUILayout.VerticalScope()) { var grouped = groupedPopupDataGeneric.GroupBy(m => m.group); foreach (var item in grouped) { if (!string.IsNullOrEmpty(searchString)) { if (searchString.ToLower().Contains("g:")) { var s = searchString.ToLower().Split(':'); if (!item.Key.ToLower().Contains(s.Last().ToLower())) { continue; } } } string label = string.IsNullOrEmpty(item.Key) ? " Ungrouped" : " " + item.Key; GUILayout.Label(label, GroupHeader); foreach (var child in item) { if (!string.IsNullOrEmpty(searchString)) { if (!searchString.ToLower().Contains("g:")) { if (!child.item.ToString().ToLower().Contains(searchString.ToLower())) { continue; } } } var contetn = new GUIContent(child.item.ToString()); if (CurrentGeneric != null) { if (CurrentGeneric.item.Equals(child.item)) { contetn.image = EditorGUIUtility.FindTexture("d_P4_CheckOutRemote"); } } if (GUILayout.Button(contetn, ItemStyle)) { OnSelectGeneric?.Invoke(child); editorWindow.Close(); } Rect btnRect = GUILayoutUtility.GetLastRect(); if (btnRect.Contains(Event.current.mousePosition)) { //GUI.Box(btnRect, "", new GUIStyle("U2D.createRect")); editorWindow.Repaint(); } } } } } }
protected override void OnGUIInternal() { using (var h = new GUILayout.HorizontalScope()) { using (var v = new GUILayout.VerticalScope(GUILayout.MinWidth(300f))) { _miscFolds.OnGUI(); _dynamicFoldEnable = GUILayout.Toggle(_dynamicFoldEnable, "DynamicFold"); _dynamicFolds.OnGUI(); _int = GUIUtil.IntButton(_int, "IntButton"); GUIUtil.Indent(() => { GUILayout.Label("Indent"); }); using (var cs = new GUIUtil.ColorScope(Color.green)) { GUILayout.Label("ColorScope"); } } _fieldFolds.OnGUI(); _sliderFolds.OnGUI(); } }
private void DoDiscordWindow(int windowId) { GUISkinUtils.RenderWithSkin(SetGUIStyle(), () => { using (GUILayout.VerticalScope v = new GUILayout.VerticalScope("Box")) { using (GUILayout.HorizontalScope h = new GUILayout.HorizontalScope()) { GUILayout.Label(avatar); GUILayout.Label("<b>" + Request.username + "</b> wants to join your server."); } using (GUILayout.HorizontalScope b = new GUILayout.HorizontalScope()) { if (GUILayout.Button("Accept")) { CloseWindow(1); } if (GUILayout.Button("Deny")) { CloseWindow(0); } } } }); }
public override void OnDrawScrollArea() { float width = (position.width - 80) * 0.5f; foreach (var item in fixerDatas) { using (var vertical = new GUILayout.VerticalScope("box")) { using (var horizon = new GUILayout.HorizontalScope()) { item.fix = EditorGUILayout.ToggleLeft(GUIContent.none, item.fix, GUILayout.Width(20)); // GUILayout.Label($"Missing GameObject in {(isViewState ? "State" : "Page")} : [{(isViewState ? item.originalNotFoundItem.viewState.name : item.originalNotFoundItem.viewPage.name)}], Under ViewElement : [{item.originalNotFoundItem.viewPageItem.viewElement.name}]"); GUILayout.Label($"{item.originalNotFoundItem.stateOrPageName} ({(item.originalNotFoundItem.isViewState ? "State" : "Page")})"); GUILayout.Label(Drawer.arrowIcon); GUILayout.Label($"{item.originalNotFoundItem.viewElement.name} (ViewElement)"); } item.tempPath = EditorGUILayout.TextField("Transform Path", item.tempPath); if (item.originalNotFoundItem.viewElement.transform.Find(item.tempPath) == null) { GUILayout.Label(new GUIContent($"[{item.tempPath}] is not a vaild Path in target ViewElement", Drawer.miniErrorIcon), GUILayout.Height(EditorGUIUtility.singleLineHeight)); } else { GUILayout.Label(new GUIContent($"Good! GameObject can be found with the input Path"), GUILayout.Height(EditorGUIUtility.singleLineHeight)); } item.delete = EditorGUILayout.ToggleLeft("This item is nolonger in use, help me delete it.(You also need to check the checkbox on the lefttop)", item.delete); } } }
static object SliderFuncVector <T, ElemType>(object v, object min, object max, ref string unparsedStr, string label = "", string[] elemLabels = null) { var vec = new AbstractVector(v); var minVec = new AbstractVector(min); var maxVec = new AbstractVector(max); var elementNum = vec.GetElementNum(); var eLabels = elemLabels ?? defaultElemLabelsVector; using (var h0 = new GUILayout.HorizontalScope()) { if (!string.IsNullOrEmpty(label)) { GUILayout.Label(label); } using (var vertical = new GUILayout.VerticalScope()) { var strs = SplitUnparsedStr(unparsedStr, elementNum); for (var i = 0; i < elementNum; ++i) { using (var h1 = new GUILayout.HorizontalScope()) { var elem = Slider((ElemType)vec[i], (ElemType)minVec[i], (ElemType)maxVec[i], ref strs[i], eLabels[i]); vec[i] = elem; } } unparsedStr = JoinUnparsedStr(strs); } } return(v); }
void OnGUI() { using (var verticalScope = new GUILayout.VerticalScope("box")) { // "Expand" button if (!m_expanded) { if (GUILayout.Button("Show Menu")) { m_expanded = true; } } // Expanded content if (m_expanded) { m_spawnRateValue = LabelSlider(m_spawnRateValue, m_spawnRateMin, m_spawnRateMax, "Spawn Rate", OnSpawnRateChange); m_spawnSpeedValue = LabelSlider(m_spawnSpeedValue, m_spawnSpeedMin, m_spawnSpeedMax, "Spawn Speed", OnSpawnSpeedChange); m_spawnSizeValue = LabelSlider(m_spawnSizeValue, m_spawnSizeMin, m_spawnSizeMax, "Spawn Size", OnSpawnSizeChange); // // "Clear Score" button // if(GUILayout.Button("Clear Score")) // { // // TODO: Clear score // } // "Collapse" button if (GUILayout.Button("Hide Menu")) { m_expanded = false; } } } }
void OnGUI() { using (var verticalScope = new GUILayout.VerticalScope("box")) { // "Expand" button if (!m_expanded) { if (GUILayout.Button("Show Menu")) { m_expanded = true; } } // Expanded content if (m_expanded) { m_driftForce = LabelSlider(m_driftForce, m_driftForceMin, m_driftForceMax, "Drift Force", OnDriftForceChange); m_tuningForce = LabelSlider(m_tuningForce, m_tuningForceMin, m_tuningForceMax, "Tuning Force", OnTuningForceChange); m_numParticles = LabelSliderInt(m_numParticles, m_numParticlesMin, m_numParticlesMax, "Num Particles", OnNumParticlesChange); // "Respawn" button if (GUILayout.Button("Reset Particles")) { OnResetParticles.Invoke(); } // "Collapse" button if (GUILayout.Button("Hide Menu")) { m_expanded = false; } } } }
public override void OnInspectorGUI() { serializedObject.Update(); var target = this.target as ValueData; showOrders = EditorGUILayout.Foldout(showOrders, "Orders"); if (showOrders) { using (var cHorizontalScope = new GUILayout.HorizontalScope()) { GUILayout.Space(EditorGUI.indentLevel * 15 + 4); using (var cVerticalScope = new GUILayout.VerticalScope()) { EditorGUILayout.LabelField("Value modifiers are executed in these orders"); foreach (var orderData in target.orders) { if (!this.cache.TryGetValue(orderData, out var cache)) { cache = new CacheData(target.GetByFullName(orderData.valueName).modifiers); this.cache.Add(orderData, cache); cache.drawer.displayAdd = false; cache.drawer.displayRemove = false; cache.drawer.headerHeight = 1; cache.drawer.onReorderCallbackWithDetails = (ReorderableList list, int oldIndex, int newIndex) => { // Restore old state var moved = list.list[newIndex]; list.list.RemoveAt(newIndex); list.list.Insert(oldIndex, moved); EditorUtility.SetDirty(target); Undo.RegisterCompleteObjectUndo(target, "Modified list"); // Restore new state list.list.RemoveAt(oldIndex); list.list.Insert(newIndex, moved); target.Validate(); }; } cache.showPosition = EditorGUILayout.BeginFoldoutHeaderGroup(cache.showPosition, orderData.valueName); if (cache.showPosition) { cache.drawer.DoLayoutList(); } EditorGUILayout.EndFoldoutHeaderGroup(); } } } } EditorGUILayout.EndFoldoutHeaderGroup(); serializedObject.ApplyModifiedProperties(); }
private void BoneManagerWindow(int id) { if (Event.current.type == EventType.MouseDown) { GUI.FocusWindow(windowID); windowdragflag = true; } else if (Event.current.type == EventType.MouseUp) { windowdragflag = false; } if (ModedCharas.Count == 0) { EmptyPage(new GUIContent("No Characters. ")); GUI.DragWindow(); return; } GUILayout.BeginHorizontal(); using (var verticalScope = new GUILayout.VerticalScope("box", GUILayout.Width(windowRect.width * 0.24f))) { GUILayout.BeginHorizontal(); GUILayout.Label("Characters: ", labelstyle); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); scrollPosition[0] = GUILayout.BeginScrollView(scrollPosition[0]); foreach (var Chara in ModedCharas) { ModedCharaList(Chara); } GUILayout.EndScrollView(); } using (var verticalScope = new GUILayout.VerticalScope("box", GUILayout.Width(windowRect.width * 0.24f))) { ModedBoneList(selectedChara); } GUILayout.BeginVertical(); scrollPosition[2] = GUILayout.BeginScrollView(scrollPosition[2]); if (additionalBonePage) { AdditionalBonePage(); } else { BoneModifierEditor(selectedBone); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(GUIStrings.Close_Window, buttonstyleNoStretch)) { mainWindow = false; } GUILayout.EndHorizontal(); GUI.DragWindow(); }
public override void OnToolGUI(EditorWindow window) { if (Selection.activeGameObject == null) { return; } if (currentSelection != Selection.activeGameObject) { // reset currentSelection = Selection.activeGameObject; if (rect.size.magnitude < .1f) { rect.size = new Vector2(10, 10); } rect.center = Selection.activeGameObject.transform.position; } Color rectColor = new Color(.52f, .76f, .86f); rect = RectHandleUtilities.DrawRectHandles(rect, currentSelection.transform.position.z, Handles.DotHandleCap, rectColor, Color.clear, 0.1F * HandleUtility.GetHandleSize(currentSelection.transform.position), 0f); Handles.BeginGUI(); using (var area = new GUILayout.AreaScope(new Rect(20, 20, 300f, 200f))) { using (var vert = new GUILayout.VerticalScope()) { minDist = EditorGUILayout.FloatField("Min Dist", minDist); maxDist = EditorGUILayout.FloatField("Max Dist", maxDist); if (GUILayout.Button("Distribute!")) { var dist = new PoissonDiscSampler(rect.width, rect.height, minDist, maxDist); int undoId = Undo.GetCurrentGroup(); foreach (var point in dist.Samples()) { Vector3 pos = rect.min + point; pos.z = currentSelection.transform.position.z; GameObject newObj; if (PrefabUtility.IsAnyPrefabInstanceRoot(currentSelection)) { var prefab = PrefabUtility.GetCorrespondingObjectFromSource(currentSelection); newObj = (GameObject)PrefabUtility.InstantiatePrefab(prefab, currentSelection.transform.parent); newObj.transform.position = pos; } else { newObj = Instantiate(currentSelection, pos, currentSelection.transform.rotation, currentSelection.transform.parent); } Undo.RegisterCreatedObjectUndo(newObj, "Ditribute Object"); Undo.CollapseUndoOperations(undoId); } } } } Handles.EndGUI(); }
private void OnGUI() { using (var verticalScope = new GUILayout.VerticalScope("box")) { // Save selection group ---------------------- // If saves exist, show selection popup if (_save_names != null && _save_names.Count != 0) { int new_selected_save_id = EditorGUILayout.Popup(_selected_save_id, _save_names.ToArray()); if (new_selected_save_id != _selected_save_id) { SelectSaveByID(new_selected_save_id); } } // -------------------------------------------- // Save action group -------------------------- using (var horizontalScope = new GUILayout.HorizontalScope()) { GUILayout.Label("File name: ", GUILayout.Width(65)); _save_name = GUILayout.TextField(_save_name, GUILayout.ExpandWidth(true)); if (string.IsNullOrEmpty(_save_name) == false && GUILayout.Button("save", GUILayout.Width(80))) { SaveConfiguration(); } } // -------------------------------------------- } DisplayAssets(); //if (GUILayout.Button("REFRESH") == true) //{ // RefreshContent(); //} using (var verticalScope = new GUILayout.VerticalScope("box")) { using (var horizontalScope = new GUILayout.HorizontalScope()) { if (GUILayout.Button("Select All") == true) { _path_holder.SelectAll(); } if (GUILayout.Button("Unselect All") == true) { _path_holder.ClearSelection(); } } if (GUILayout.Button("EXPORT PACKAGE") == true) { ExportPackage(); } } }
private void DoAddServerWindow(int windowId) { Event e = Event.current; if (e.isKey) { switch (e.keyCode) { case KeyCode.Return: OnAddServerButtonClicked(); break; case KeyCode.Escape: OnCancelButtonClicked(); break; } } SetGUIStyle(); using (GUILayout.VerticalScope v = new GUILayout.VerticalScope("Box")) { using (GUILayout.HorizontalScope h1 = new GUILayout.HorizontalScope()) { GUILayout.Label("Name:"); GUI.SetNextControlName("serverNameField"); //120 so users can't go too crazy. serverNameInput = GUILayout.TextField(serverNameInput, 120); } using (GUILayout.HorizontalScope h2 = new GUILayout.HorizontalScope()) { GUILayout.Label("IP:"); GUI.SetNextControlName("serverIpField"); //120 so users can't go too crazy. serverIpInput = GUILayout.TextField(serverIpInput, 120); } if (GUILayout.Button("Add server")) { OnAddServerButtonClicked(); } if (GUILayout.Button("Cancel")) { OnCancelButtonClicked(); } } if (shouldFocus) { GUI.FocusControl("serverNameField"); shouldFocus = false; } }
/// <summary> /// 绘制输入选择 /// </summary> private void DrawSnapshotTab() { using (var scope = new GUILayout.VerticalScope("Box")) { _oldInputTabOption = _inputTabOption; DrawAPPSnapshot(); if (_oldInputTabOption != _inputTabOption) { _snapshotMgr.RefreshSnapshotType(_selectedType); } } }
public override void Draw(int id) { using (var vertical = new GUILayout.VerticalScope()) { DrawTab(); using (var scroll = new GUILayout.ScrollViewScope(scrollPosition)) { scrollPosition = scroll.scrollPosition; using (var horizon = new GUILayout.HorizontalScope()) { GUILayout.Label($" ViewPage : {viewPage.name}", Drawer.bigLableStyle); GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove All Setting")) { viewPage.navigationDatasForViewState.Clear(); } } foreach (var vpi in viewPage.viewPageItems) { DrawItem(vpi); } if (viewState != null) { GUILayout.Space(10); GUILayout.Box("", Drawer.darkBackgroundStyle, GUILayout.Height(5), GUILayout.Width(rect.width * 0.97f)); GUILayout.Space(10); using (var horizon = new GUILayout.HorizontalScope()) { GUILayout.Label($" ViewState : {viewState.name}", Drawer.bigLableStyle); GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove All Setting")) { foreach (var item in viewPage.viewPageItems) { item.navigationDatas.Clear(); } } } foreach (var vpi in viewState.viewPageItems) { DrawItem(vpi, true); } } } } GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Close"))) { show = false; SetViewPage(null, null); } base.Draw(id); }
private void DrawPaintModeInfo() { bool bFillInvoked = false; float uiWidth = _editorUIRect.width * _infoPanelSettingsWidth; using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.MaxWidth(uiWidth))) { // Attribute Selection, and paint values DrawAttributeSelection(); DrawPaintAttributeValues(); SerializedProperty paintMeshProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_paintMeshVisiblity"); if (paintMeshProperty != null) { int currentVisibility = paintMeshProperty.enumValueIndex; EditorGUILayout.PropertyField(paintMeshProperty, new GUIContent("Paint Mesh Visiblity")); if (currentVisibility != paintMeshProperty.enumValueIndex) { ChangePaintMeshVisiblity((HEU_ToolsInfo.PaintMeshVisibility)paintMeshProperty.enumValueIndex); } } } using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox)) { // Tool Settings HEU_EditorUtility.EditorDrawBoolProperty(_toolsInfoSerializedObject, "_liveUpdate", _cookOnMouseReleaseLabel, "Auto-cook on mouse release when painting."); HEU_EditorUtility.EditorDrawFloatProperty(_toolsInfoSerializedObject, "_paintBrushSize", _brushSizeLabel, "Change brush size via Shift + drag or Shift + mouse scroll."); HEU_EditorUtility.EditorDrawFloatProperty(_toolsInfoSerializedObject, "_paintBrushOpacity", _brushOpacityLabel, "Blending factor when merging source and destination colors."); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_paintMergeMode", _brushMergeMode, "How paint color is applied to surface."); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_brushHandleColor", _brushHandleColor, "Color of the brush handle in Scene."); bFillInvoked = GUILayout.Button(_paintFillLabel, GUILayout.Height(_buttonHeight)); } if (_selectedAttributesStore != null) { if (bFillInvoked) { HEU_ToolsInfo toolsInfo = _toolsInfoSerializedObject.targetObject as HEU_ToolsInfo; _selectedAttributesStore.FillAttribute(_selectedAttributeData, toolsInfo); _GUIChanged = true; } } }
public static void Indent(int level, Action action) { const int TAB = 20; using (var h = new GUILayout.HorizontalScope()) { GUILayout.Space(TAB * level); using (var v = new GUILayout.VerticalScope()) { action(); } } }
public void OnGUI() { if (_needUpdate) { _folds = _dic.Values.OrderBy(of => of._order).Select(of => of._fold).ToList(); _needUpdate = false; } using (var v = new GUILayout.VerticalScope()) { _folds.ForEach(fold => fold.OnGUI()); } }