private void DrawPoint(Rect position, SerializedProperty property) { var isReadOnlyProp = property.FindPropertyRelative(ChronoPoint.kIsReadOnlyPropName); var valueProp = property.FindPropertyRelative(ChronoPoint.kValuePropName); bool isReadOnly = isReadOnlyProp != null ? isReadOnlyProp.boolValue : false; position.y += kHeightReduction * 0.5f; position.height -= kHeightReduction; float valueRectWidth = position.width - kValueRectWidth - kGapWidth - kMarginWidth; var valueRect = new Rect(position) { width = kValueRectWidth, x = position.x + kMarginWidth }; var displayRect = new Rect(position) { width = valueRectWidth, x = valueRect.x + kValueRectWidth + kGapWidth }; using (var group = new EditorGUI.DisabledGroupScope(isReadOnly)) { float value = valueProp.floatValue; string displayValue = GetDisplayValue(value); valueProp.floatValue = EditorGUI.DelayedFloatField(valueRect, GUIContent.none, value, _styles.chronoValueField); EditorGUI.LabelField(displayRect, displayValue); } }
public override void OnInspectorGUI() { so.Update(); using (var change = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.PropertyField(s_SaveData); if (change.changed) { EditorUtility.SetDirty(viewController); } } serializedObject.ApplyModifiedProperties(); showDebugView.target = EditorGUILayout.Foldout(showDebugView.target, "Debug"); using (var disable = new EditorGUI.DisabledGroupScope(true)) { using (var fade = new EditorGUILayout.FadeGroupScope(showDebugView.faded)) { if (fade.visible) { EditorGUILayout.PropertyField(s_vs, true); EditorGUILayout.PropertyField(s_vp, true); EditorGUILayout.PropertyField(s_current_element_vs, true); EditorGUILayout.PropertyField(s_current_element_vp, true); } } } }
private void OnGUI() { using (var horizon = new GUILayout.HorizontalScope()) { if (GUILayout.Button(new GUIContent("Open with Unity Doc Generator", "Open Unity Doc Generator for more detail settings"))) { DocGeneratorWindow.OpenWindow(); DocGeneratorWindow.currentSelectPath = packagePath; } string p1 = System.IO.Path.Combine(packagePath, DocGeneratorWindow.settingFile); string p2 = System.IO.Path.Combine(packagePath, DocGeneratorWindow.DocFxProject); bool isSettingExsit = System.IO.File.Exists(p1); bool isDocFxDocumentExsit = System.IO.Directory.Exists(p2); bool buildDirectAvailable = !(isSettingExsit && isDocFxDocumentExsit); using (var disable = new EditorGUI.DisabledGroupScope(buildDirectAvailable)) { if (GUILayout.Button(new GUIContent("Generate Doc with last setting", "Require the package has generate document using UnityDocGenerator before"))) { DocGeneratorWindow.OpenWindow(); DocGeneratorWindow.currentSelectPath = System.IO.Path.GetFullPath(packageInfo.assetPath); DocGeneratorWindow.Instance.Docfx(); } } } }
public override void OnGUIFamily(ShaderGUITreeView treeView) { if (!this.isVisible) { return; } using (var dis = new EditorGUI.DisabledGroupScope(this.isDisabled)) { if (!this.hasChildren) { return; } using (var chk = new EditorGUI.ChangeCheckScope()) { foreach (var it in this.children) { it.OnGUIFamily(treeView); } var data = new EventData(this, chk.changed); afterCallback.Invoke(data); data.Dispose(); } } }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_event); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(m_playOnStart); EditorGUILayout.PropertyField(m_destroyOnComplete); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Emitter Properties", EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_overrideEmitterProperties); EditorGUILayout.Separator(); using (var disabled = new EditorGUI.DisabledGroupScope(!m_overrideEmitterProperties.boolValue)) { EditorGUILayout.PropertyField(m_emitterProperties); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }
private void DrawDictionaryButton(Rect rect, SerializedProperty dictionary, TranslationDictionary translationDictionary) { using (EditorGUI.DisabledGroupScope scope = new EditorGUI.DisabledGroupScope(translationDictionary.IsAllTranslationsSerialized)) { // Draw update button rect.width += EditorHelpers.VerticalMargin; rect.width /= 2f; GUI.SetNextControlName("Apply"); if (GUI.Button(rect, "Apply Changes") == true) { // Apply changes to the dictionary translationDictionary.UpdateSerializedTranslations(); // Save these changes to the file UnityEditor.EditorUtility.SetDirty(translationDictionary); AssetDatabase.SaveAssets(); // Change focus GUI.FocusControl("Apply"); } // Draw revert button rect.x += EditorHelpers.VerticalMargin; rect.x += rect.width; GUI.SetNextControlName("Revert"); if (GUI.Button(rect, "Revert Changes") == true) { // Revert the dictionary translationDictionary.RepopulateAllTranslations(); // Change focus GUI.FocusControl("Revert"); } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { using (var scope = new EditorGUI.DisabledGroupScope(true)) { EditorGUI.PropertyField(position, property, label, true); } }
internal void OnGUI() { float width = this.position.width; EditorGUILayout.BeginVertical(); this.scrollPos = EditorGUILayout.BeginScrollView(this.scrollPos, false, false); using (var disableGroup = new EditorGUI.DisabledGroupScope(EditorApplication.isPlaying)) { GUILayout.Label("Scenes In Build Settings", EditorStyles.boldLabel); for (var i = 0; i < EditorBuildSettings.scenes.Length; i++) { var scene = EditorBuildSettings.scenes[i]; using (var horizontalScope = new EditorGUILayout.HorizontalScope()) { var bgCol = GUI.backgroundColor; GUI.backgroundColor = SceneManager.GetActiveScene().path == scene.path ? Color.green : bgCol; var sceneName = Path.GetFileNameWithoutExtension(scene.path); var loadPressed = GUILayout.Button(sceneName, new GUIStyle(GUI.skin.GetStyle("Button")) { alignment = TextAnchor.MiddleCenter }); if (loadPressed) { if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { EditorSceneManager.OpenScene(scene.path); } } GUI.backgroundColor = EditorApplication.isPlaying && SceneManager.GetActiveScene().path == scene.path ? Color.green : bgCol; var playPressed = GUILayout.Button("Play", new GUIStyle(GUI.skin.GetStyle("Button")) { alignment = TextAnchor.MiddleCenter }, GUILayout.Width(width * 0.2f)); if (playPressed) { play(i); } GUI.backgroundColor = bgCol; } } } if (EditorApplication.isPlaying) { if (GUILayout.Button("Stop", new GUIStyle(GUI.skin.GetStyle("Button")))) { stop(); } } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }
void DrawElement(Rect oriRect, int index, bool isActive, bool isFocused) { var item = (ViewElementPropertyOverrideData)reorderableList.list[index]; var rootObjectName = viewElement != null ? viewElement.name : "{RootObject}"; var btnRect = oriRect; btnRect.width = 26; btnRect.height = EditorGUIUtility.singleLineHeight; btnRect.x = oriRect.width; using (var disable = new EditorGUI.DisabledGroupScope(viewElement == null)) { if (GUI.Button(btnRect, new GUIContent(EditorGUIUtility.FindTexture("d_Search Icon")))) { PopupWindow.Show(btnRect, new OverridePopup(item, viewElement)); } } var rect = oriRect; rect.y += EditorGUIUtility.singleLineHeight * 0.5f; rect.height = EditorGUIUtility.singleLineHeight; if (viewElement == null) { GUI.Label(rect, new GUIContent("", "Root Object is not a ViewElement")); } var targetTransformPath = item.targetTransformPath; var targetComponentType = item.targetComponentType; var targetPropertyName = item.targetPropertyName; if (string.IsNullOrEmpty(targetComponentType) || string.IsNullOrEmpty(targetPropertyName)) { rect.y += EditorGUIUtility.singleLineHeight; GUI.Label(rect, new GUIContent("Nothing select", Drawer.miniInfoIcon, "Nothing select")); } else { float paddind = 20; GUI.Label(rect, new GUIContent((string.IsNullOrEmpty(targetTransformPath) ? rootObjectName : rootObjectName + "/") + targetTransformPath, Drawer.prefabIcon, targetTransformPath)); rect.y += EditorGUIUtility.singleLineHeight; var arrowRect = rect; arrowRect.width = paddind; GUI.Label(arrowRect, EditorGUIUtility.FindTexture("tab_next@2x")); var rectComponent = rect; rectComponent.x += paddind; rectComponent.width = oriRect.width - paddind; var componentContent = new GUIContent(EditorGUIUtility.ObjectContent(null, Utility.GetType(targetComponentType))); GUI.Label(rectComponent, new GUIContent($"{targetTransformPath.Split('/').LastOrDefault()} ({targetComponentType.Split('.').LastOrDefault()})", componentContent.image)); rect.y += EditorGUIUtility.singleLineHeight; if (VS_EditorUtility.SmartOverrideField(rect, new GUIContent(targetPropertyName), item.Value, out float lh)) { propertySource.serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(viewElement); } } }
public override void OnInspectorGUI() { using (var disable = new EditorGUI.DisabledGroupScope(true)) { GUILayout.Label($"Current ApplicationState: {applicationController.CurrentApplicationState}"); GUILayout.Label($"Current GameState: {applicationController.CurrentGameState}"); } base.OnInspectorGUI(); }
private void OnGUI() { using (var horizontalScope = new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) { if (GUILayout.Button(CONTENT_BUTTON_REVERT, EditorStyles.toolbarButton)) { UpdateScriptDefineSymbolsParameters(); } using (var disableScope = new EditorGUI.DisabledGroupScope(!isDirty)) { if (GUILayout.Button(CONTENT_BUTTON_APPLY, EditorStyles.toolbarButton)) { ApplyChangesScriptingDefineSymbols(); } } GUILayout.FlexibleSpace(); using (var changeScope = new EditorGUI.ChangeCheckScope()) { inspectorBuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(GUIContent.none, buildTargetGroup, EditorStyles.toolbarDropDown, GUILayout.Width(100.0f)); if (changeScope.changed && buildTargetGroup != inspectorBuildTargetGroup) { if (isDirty) { if (EditorUtility.DisplayDialog("Warning", "All changes on current active build target will be revert. Do you want to apply change?", "Yes", "No")) { ApplyChangesScriptingDefineSymbols(); } } buildTargetGroup = inspectorBuildTargetGroup; UpdateScriptDefineSymbolsParameters(); } } } if (buildTargetGroup == BuildTargetGroup.Unknown) { EditorGUILayout.HelpBox("Scripting Define Symbols is disabled on this build target group.", MessageType.Info, true); } else { using (var changeScope = new EditorGUI.ChangeCheckScope()) { listMain.DoLayoutList(); if (changeScope.changed) { if (!isDirty) { isDirty = true; } } } } }
public void OnGUI() { maxSize = new Vector2(600, 400); using (var horizon = new GUILayout.HorizontalScope(new GUIStyle("AnimationKeyframeBackground"), GUILayout.Height(24))) { GUILayout.Label(new GUIContent(lable, icon), new GUIStyle("AM MixerHeader2")); } using (var scroll = new GUILayout.ScrollViewScope(scrollPos)) { scrollPos = scroll.scrollPosition; OnDrawScrollArea(); } using (var horizon = new GUILayout.HorizontalScope(new GUIStyle("AnimationKeyframeBackground"), GUILayout.Height(18))) { if (GUILayout.Button("All")) { OnAllClick?.Invoke(); } if (GUILayout.Button("None")) { OnNoneClick?.Invoke(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel")) { OnCancelClick?.Invoke(); Close(); } using (var disable = new EditorGUI.DisabledGroupScope(CheckBeforeApply())) { if (GUILayout.Button("Apply")) { if (CheckBeforeApply()) { if (!EditorUtility.DisplayDialog( "Something goes wrong!", "There are nothing selected to apply are you sure you have setting correct?", "Yes", "Not")) { return; } } OnApplyClick?.Invoke(); OnComplete?.Invoke(); Close(); } } } }
public override void OnInspectorGUI() { serializedObject.Update(); using (var scope = new EditorGUI.DisabledGroupScope(EditorApplication.isPlayingOrWillChangePlaymode)) { EditorGUILayout.Separator(); partsArray.DoLayoutList(); EditorGUILayout.Separator(); decalsArray.DoLayoutList(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); using (var disable = new EditorGUI.DisabledGroupScope(true)) { GUILayout.Label($"Current ApplicationState: {applicationController.CurrentApplicationState}"); GUILayout.Label($"Current GameState: {applicationController.CurrentGameState}"); GUILayout.Label($"ScriptableObjectLifeCycle Runtime Instances"); foreach (var item in applicationController.scriptableObjectLifeCycleInstances) { EditorGUILayout.ObjectField(item, typeof(ScriptableObjectLifeCycle), false); } } }
private void DrawToolbar() { using (var horizontalScope = new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) { if (GUILayout.Button(RevertButtonContent, EditorStyles.toolbarButton)) { UpdateScriptDefineSymbolsParameters(); } using (var disableScope = new EditorGUI.DisabledGroupScope(!isDirty)) { if (GUILayout.Button(ApplyButtonContent, EditorStyles.toolbarButton)) { ApplyChangesScriptingDefineSymbols(); } } GUILayout.FlexibleSpace(); DrawBuildTargetsDropdown(); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { bool disableNow = true; switch (Atr.Option) { case ReadOnlyOption.EditMode: disableNow = !Application.isPlaying; break; case ReadOnlyOption.PlayMode: disableNow = Application.isPlaying; break; } using (var scope = new EditorGUI.DisabledGroupScope(disableNow)) { EditorGUI.PropertyField(position, property, label, true); } }
void DrawHosting() { using (var vertical = new GUILayout.VerticalScope("box")) { DrawLabel("Hosting"); using (var disable = new EditorGUI.DisabledGroupScope(!Directory.Exists(DocWebPath))) { using (var horizon = new GUILayout.HorizontalScope()) { string url = $"http://127.0.0.1:{httpPort}/index.html"; EditorGUILayout.HelpBox( hosting ? $"Go {url} to preview your document \nCurrent hosting root: {httpServer.GetRootDirectory()}" : "Hosting is not running", MessageType.Warning); using (var vertical2 = new GUILayout.VerticalScope("box", GUILayout.Width(100))) { using (var check = new EditorGUI.ChangeCheckScope()) { var t = EditorGUILayout.TextField("Port", httpPort.ToString()); if (check.changed) { if (int.TryParse(t, out int r)) { httpPort = r; } } } if (GUILayout.Button("Open preview")) { Application.OpenURL(url); } using (var check = new EditorGUI.ChangeCheckScope()) { hosting = GUILayout.Toggle(hosting, hosting ? "Hosting..." : "Start Hosting", EditorStyles.toolbarButton); if (check.changed) { SwitchHosting(); } } } } } } }
public override void OnGUIFamily(ShaderGUITreeView treeView) { if (!this.isVisible) { return; } using (var dis = new EditorGUI.DisabledGroupScope(this.isDisabled)) { OnGUIRow(treeView); if (this.isExpanded && hasChildren) { foreach (var it in this.children) { it.OnGUIFamily(treeView); } } } }
void DrawSelectionMode() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); _selectPropertyMode = EditorGUILayout.Toggle("Select Mode", _selectPropertyMode); using (var disabledScope = new EditorGUI.DisabledGroupScope(!_selectPropertyMode)) { int selectionCount = _selectedProperties.Count; int copiedPropCount = _copiedProperties.Count; GUILayout.Label("Selected items: " + _currentMaterialSelectedProps.Count + " / " + _selectablePropertyCount); GUILayout.Label("Items on clipboard: " + copiedPropCount); } EditorGUILayout.EndVertical(); _selectionMode = SelectionMode.None; using (var disabledScope = new EditorGUI.DisabledGroupScope(!_selectPropertyMode)) { EditorGUILayout.BeginVertical(); if (GUILayout.Button("Select All")) { _selectedProperties.Clear(); _selectionMode = SelectionMode.SelectAll; } if (GUILayout.Button("Select None")) { _selectedProperties.Clear(); } if (GUILayout.Button("Copy")) { _selectionMode = SelectionMode.Copy; } if (GUILayout.Button("Paste")) { _selectionMode = SelectionMode.Paste; } if (GUILayout.Button("Clear")) { _selectionMode = SelectionMode.Clear; } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); }
public override void OnGUIFamily(ShaderGUITreeView treeView) { if (!this.isVisible) { return; } using (var dis = new EditorGUI.DisabledGroupScope(this.isDisabled)) { this.isExpanded = treeView.materialEditor.EmissionEnabledProperty(); if (!this.isExpanded || !this.hasChildren) { return; } foreach (var it in this.children) { it.OnGUIFamily(treeView); } } }
public override void OnInspectorGUI() { defaultEditor.OnInspectorGUI(); if (viewElement?.currentViewPageItem == null) { return; } EditorGUILayout.HelpBox( $"ViewSystem Info: \n ViewPage: {viewElement.currentViewPage.name} \n ViewPageItem: {viewElement.currentViewPageItem.Id}", MessageType.Info); using (var disable = new EditorGUI.DisabledGroupScope(!ViewSystemVisualEditor.Instance.EditMode)) { if (GUILayout.Button("Copy value to ViewSystem")) { if (viewElement.currentViewPageItem.breakPointViewElementTransforms == null || viewElement.currentViewPageItem.breakPointViewElementTransforms.Count == 0) { CopyValue(viewElement?.currentViewPageItem.defaultTransformDatas, rectTransform); } else { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent($"Copy to Default BreakPoint"), false, () => { CopyValue(viewElement?.currentViewPageItem.defaultTransformDatas, rectTransform); }); foreach (var item in viewElement.currentViewPageItem.breakPointViewElementTransforms) { menu.AddItem(new GUIContent($"Copy to {item.breakPointName} BreakPoint"), false, () => { CopyValue(item.transformData, rectTransform); }); } menu.ShowAsContext(); } } } }
void DrawValue(SerializedPropertyType type, ViewElementPropertyOverrideData overrideData) { if (type != SerializedPropertyType.Generic) { Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor *= new Color(1f, 1f, 1f, 0.5f); switch (type) { case SerializedPropertyType.Vector2: GUILayout.Box($"Vector2 {overrideData.Value.GetValue().ToString()}", Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.Vector3: GUILayout.Box($"Vector3 {overrideData.Value.GetValue().ToString()}", Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.Float: GUILayout.Box(overrideData.Value.GetValue().ToString(), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.Integer: GUILayout.Box(overrideData.Value.GetValue().ToString(), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.String: GUILayout.Box(new GUIContent("\"" + overrideData.Value.StringValue + "\"", overrideData.Value.StringValue), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.Boolean: GUILayout.Box(overrideData.Value.GetValue().ToString(), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.Color: using (var disable = new EditorGUI.DisabledGroupScope(true)) { EditorGUILayout.ColorField((Color)overrideData.Value.GetValue(), GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); } break; case SerializedPropertyType.LayerMask: GUILayout.Box(overrideData.Value.GetValue().ToString(), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; case SerializedPropertyType.ObjectReference: if (overrideData.Value.ObjectReferenceValue == null) { GUILayout.Box("Null", Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); } else { using (var disable = new EditorGUI.DisabledGroupScope(true)) { EditorGUILayout.ObjectField(overrideData.Value.ObjectReferenceValue, overrideData.Value.ObjectReferenceValue.GetType(), false, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); } } //GUILayout.Box(overrideData.Value.IntValue.ToString(), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(150)); break; default: GUILayout.Box(new GUIContent(type.ToString(), type.ToString()), Drawer.valueBoxStyle, GUILayout.Height(16), GUILayout.Width(vauleBoxWidth)); break; } GUI.backgroundColor = backgroundColor; } }
private void DrawMenuBar() { menuBar = new Rect(0, 0, position.width, menuBarHeight); using (var area = new GUILayout.AreaScope(menuBar, "", EditorStyles.toolbar)) { using (var horizon = new GUILayout.HorizontalScope()) { using (var disable = new EditorGUI.DisabledGroupScope(!CanEnterEditMode)) { using (var changed = new EditorGUI.ChangeCheckScope()) { EditMode = GUILayout.Toggle(EditMode, new GUIContent("Edit Mode"), EditorStyles.toolbarButton, GUILayout.Height(menuBarHeight)); if (changed.changed == true) { if (EditMode) { dataReader.EditStart(); } else { dataReader.EditEnd(); } } } } GUILayout.Space(5); if (GUILayout.Button(new GUIContent($"Save{(((ViewSystemDataReaderV2)dataReader).isDirty ? "*" : "")}", EditorGUIUtility.FindTexture("d_SaveAs@2x")), EditorStyles.toolbarButton, GUILayout.Width(50))) { if (isInit == false) { #if UNITY_2019_1_OR_NEWER ViewSystemLog.ShowNotification(this, new GUIContent("Editor is not Initial."), 2); #else ViewSystemLog.ShowNotification(this, new GUIContent("Editor is not Initial.")); #endif return; } if (EditorUtility.DisplayDialog("Save", "Save action will also delete all ViewElement in scene. \nDo you really want to continue?", "Yes", "No")) { if (dataReader.GetSaveData().globalSetting.UIRootScene == null) { ViewSystemLog.LogWarning("There is no UIRoot in edit, will ignore the saving of UIRoot Prefab."); } dataReader.Save(viewPageList, viewStateList); } } if (GUILayout.Button(new GUIContent("Reload", Drawer.refreshIcon, "Reload data"), EditorStyles.toolbarButton, GUILayout.Width(80))) { if (overridePopupWindow != null) { overridePopupWindow.show = false; } RefreshData(); } if (GUILayout.Button(new GUIContent("Clear Preview", "Clear all preview item"), EditorStyles.toolbarButton)) { ((ViewSystemDataReaderV2)dataReader).ClearAllViewElementInScene(); } if (GUILayout.Button(new GUIContent("Normalized", "Normalized all item (Will Delete the Canvas Root Object in Scene)"), EditorStyles.toolbarButton)) { overridePopupWindow.show = false; dataReader.Normalized(); inspector.Normalized(); } GUILayout.Space(5); using (var check = new EditorGUI.ChangeCheckScope()) { inspector.show = GUILayout.Toggle(inspector.show, new GUIContent(Drawer.inspectorIcon, "Show Inspector"), EditorStyles.toolbarButton, GUILayout.Height(menuBarHeight), GUILayout.Width(25)); if (check.changed) { inspectorContianer.parent.style.display = inspector.show ? DisplayStyle.Flex : DisplayStyle.None; } } GUILayout.Space(5); if (globalSettingWindow != null) { globalSettingWindow.show = GUILayout.Toggle(globalSettingWindow.show, new GUIContent("Global Setting", EditorGUIUtility.FindTexture("SceneViewTools")), EditorStyles.toolbarButton, GUILayout.Height(menuBarHeight)); } GUILayout.Space(5); if (viewPageOrderWindow != null) { viewPageOrderWindow.show = GUILayout.Toggle(viewPageOrderWindow.show, new GUIContent("Overlay Order", EditorGUIUtility.FindTexture("CustomSorting"), "Batch modify Overlay Pager Sorting Order"), EditorStyles.toolbarButton, GUILayout.Height(menuBarHeight)); } GUILayout.Space(5); if (GUILayout.Button(new GUIContent("Verifiers"), EditorStyles.toolbarDropDown, GUILayout.Height(menuBarHeight))) { GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("Verify GameObjects"), false, () => { viewSystemVerifier.VerifyGameObject(ViewSystemVerifier.VerifyTarget.All); } ); genericMenu.AddItem(new GUIContent("Verify Overrides"), false, () => { viewSystemVerifier.VerifyComponent(ViewSystemVerifier.VerifyTarget.Override); } ); genericMenu.AddItem(new GUIContent("Verify Events"), false, () => { viewSystemVerifier.VerifyComponent(ViewSystemVerifier.VerifyTarget.Event); } ); genericMenu.AddItem(new GUIContent("Verify Pages and States"), false, () => { viewSystemVerifier.VerifyPagesAndStates(); } ); genericMenu.ShowAsContext(); } using (var check = new EditorGUI.ChangeCheckScope()) { search = EditorGUILayout.TextField(search, new GUIStyle("SearchTextField")); } GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent(Drawer.zoomIcon, "Zoom"), GUIStyle.none); zoomScale = EditorGUILayout.Slider(zoomScale, zoomScaleMinMax.x, zoomScaleMinMax.y, GUILayout.Width(120)); if (GUILayout.Button(new GUIContent(EditorGUIUtility.FindTexture("AvatarCompass"), "Reset viewport to (0,0)"), EditorStyles.toolbarButton, GUILayout.Width(30))) { viewPortScroll = Vector2.zero; } if (GUILayout.Button(new GUIContent(Drawer.bakeScritpIcon, "Bake ViewPage and ViewState to script"), EditorStyles.toolbarButton, GUILayout.Width(50))) { ViewSystemScriptBaker.BakeAllViewPageName( viewPageList.Select(m => m.viewPage).ToList(), viewStateList.Select(m => m.viewState).ToList(), saveData.globalSetting.breakPoints.ToList()); } if (GUILayout.Button("Options", EditorStyles.toolbarDropDown)) { UnityEditor.PopupWindow.Show(popupBtnRect, new EditorPopupSetting()); } if (Event.current.type == EventType.Repaint) { popupBtnRect = GUILayoutUtility.GetLastRect(); } } } }
/// <summary> /// Draws the style sheet toolbar. /// </summary> /// <param name="behavior">Target behavior.</param> /// <param name="styleSheetAsset">Style sheet asset.</param> void DrawToggleToolbar() { bool changed = GUI.changed; EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); // Save style property from target behavior. using (var cc = new EditorGUI.DisabledGroupScope(!current || ValueType.Index < current.valueType)) { if (GUILayout.Button(new GUIContent("Save"), EditorStyles.toolbarButton)) { foreach (var property in current.toggleProperties) { property.parameterList.FitSize(current.count); PropertyEditor.FillArgumentsByGetter(current, property.methodInfo, property.parameterList, current.indexValue); } } if (GUILayout.Button(new GUIContent("Load"), EditorStyles.toolbarButton)) { ResetToggleValue(); } } GUILayout.Space(8); GUILayout.FlexibleSpace(); if (GUILayout.Button("Bake", EditorStyles.toolbarButton)) { PropertyEditor.Bake(current.toggleProperties); } if (GUILayout.Button("Add Property", EditorStyles.toolbarPopup)) { var menu = PropertyEditor.CreateTargetMenu(current, current.toggleProperties, current.count); AppendAvailableOptionToMenu(menu).ShowAsContext(); } //自動構築ボタン. EditorGUI.BeginDisabledGroup(spGroupToggles.arraySize == 0 && spActivations.arraySize == 0); if (GUILayout.Button(contentHierarchy, EditorStyles.toolbarButton)) { int count = current.count; var sb = new StringBuilder("Are you sure you want to reconstruct toggles based on child transforms as following?\n"); var transform = current.transform; var children = Enumerable.Range(0, transform.childCount) .Select(i => transform.GetChild(i)) .ToList(); var childToggles = children .Select(trans => trans.GetComponent <CompositeToggle>()) .Where(toggle => toggle != null) .ToList(); if (0 < spActivations.arraySize) { count = Mathf.Max(count, children.Count); sb.AppendFormat("\n{0} GameObjects for 'Set Activation' :\n{1}", children.Count, children.Aggregate(new StringBuilder(), (a, b) => a.AppendFormat(" - {0}\n", b.name)) ); } if (0 < spGroupToggles.arraySize) { count = Mathf.Max(count, childToggles.Count); sb.AppendFormat("\n{0} CompositeToggles for 'Toggle Grouping' :\n{1}", childToggles.Count, childToggles.Aggregate(new StringBuilder(), (a, b) => a.AppendFormat(" - {0}\n", b.name)) ); } if (EditorUtility.DisplayDialog("Auto-Construction Based on Children", sb.ToString(), "Yes", "No")) { current.count = count; serializedObject.Update(); for (int i = 0; i < Mathf.Min(spGroupToggles.arraySize, childToggles.Count); i++) { spGroupToggles.GetArrayElementAtIndex(i).objectReferenceValue = childToggles[i]; } for (int i = 0; i < Mathf.Min(spActivations.arraySize, children.Count); i++) { spActivations.GetArrayElementAtIndex(i).objectReferenceValue = children[i].gameObject; } } } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); GUI.changed = changed; }
void OnGUI() { using (var horizon = new EditorGUILayout.HorizontalScope()) { ndkPath = EditorGUILayout.TextField("NDK Path", ndkPath); if (GUILayout.Button("Use")) { ndkPath = EditorUtility.OpenFolderPanel("Select NDK", "", ""); } } addr2linePath = ndkPath + addr2linePathSubFix + addr2lineExculde; _platform = (Platform)EditorGUILayout.EnumPopup("Platform", _platform); _lib = (Lib)EditorGUILayout.EnumPopup("Symbols", _lib); using (var disable = new EditorGUI.DisabledGroupScope(_lib != Lib.il2cpp)) { using (var horizon = new EditorGUILayout.HorizontalScope()) { il2cppSymbolsPath = EditorGUILayout.TextField("il2cppSymbolsPath", il2cppSymbolsPath); if (GUILayout.Button("select")) { il2cppSymbolsPath = EditorUtility.OpenFilePanel("Select Symbols", "", ""); } } } switch (_lib) { case Lib.libUnity: unityPath = unityEditorPath + "PlaybackEngines/" + libUnityPathSubFix.Replace("{platform}", GetPlatformPath(_platform)); break; case Lib.il2cpp: unityPath = il2cppSymbolsPath; break; } EditorGUILayout.LabelField("addr2linePath path :", addr2linePath); EditorGUILayout.LabelField("unityPath path :", unityPath); using (var horizon = new EditorGUILayout.HorizontalScope()) { EditorGUILayout.HelpBox("One line per address", MessageType.Info); if (GUILayout.Button("Run", GUILayout.Width(80))) { var lines = crashLogs.Split('\n', '\r'); MakeCommand(lines); } } using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosInput, GUILayout.Height(200))) { scrollPosInput = scroll.scrollPosition; crashLogs = EditorGUILayout.TextArea(crashLogs); } using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosResult, GUILayout.Height(200))) { scrollPosResult = scroll.scrollPosition; EditorGUILayout.LabelField("Result"); EditorGUILayout.TextArea(string.Join("\n", result)); } }
public override void OnInspectorGUI() { serializedObject.Update(); var tprop = serializedObject.FindProperty("_type"); var iprop = serializedObject.FindProperty("_instantiateOnAwake"); var bprop = serializedObject.FindProperty("_propertyBinding"); if (_autoSuggestField == null) { _suggestionProvider = new TypeSuggestionProvider(); _autoSuggestField = new AutoSuggestField( _suggestionProvider, new GUIContent(SearchFieldLabel), new AutoSuggestField.Options { DisplayMode = DisplayMode.Inline, }); } if (_searchString == null) { // On first frame, _searchString will be null. // After block line, it will be non-null. _tval = Type.GetType(tprop.stringValue); _searchString = _tval?.FullName ?? string.Empty; } _searchString = _autoSuggestField.OnGUI(_searchString); if (_suggestionProvider.SelectedTypeIsValid && Event.current.type == EventType.Layout) { _tval = _suggestionProvider.SelectedType; tprop.stringValue = _tval?.AssemblyQualifiedName; } if (_tval != null) { if (typeof(UnityEngine.Object).IsAssignableFrom(_tval)) { GUILayout.Label("Auto-instantiation not possible with UnityEngine.Object types"); } else { EditorGUILayout.PropertyField(iprop); EditorGUILayout.PropertyField(bprop); } } serializedObject.ApplyModifiedProperties(); var dc = target as DataContext; if (dc != null) { using (var disabledGroupScope = new EditorGUI.DisabledGroupScope(true)) { EditorGUILayout.Toggle("Value is non-null?", dc.Value != null); } } }
void OnGUI() { //using (var scope = new EditorGUI.ChangeCheckScope()) //{ // if (scope.changed) // { // SceneView.RepaintAll(); // } //} if (EnableEdit == false) { var warningTxTstyle = new GUIStyle("HelpBox"); warningTxTstyle.richText = true; GUILayout.Label(warningTxT, warningTxTstyle); } using (var EnableEditscop = new EditorGUI.DisabledGroupScope(!EnableEdit)) { using (var scope = new EditorGUI.ChangeCheckScope()) { EditMod = GUILayout.Toggle(EditMod, "Edit Mod", new GUIStyle("button")); if (scope.changed) { if (EditMod) { RecordcurrentSetting(); string instanceIDName = transform.gameObject.GetInstanceID().ToString(); if (mesh.name.Contains(instanceIDName) == false) { meshFilter.sharedMesh = Instantiate(mesh); meshFilter.sharedMesh.name = instanceIDName; } } else { ResumePreviouseSetting(); } SceneView.RepaintAll(); } } GUILayout.Space(20); using (var scope = new EditorGUI.DisabledGroupScope(!EditMod)) { SnapMod = GUILayout.Toggle(SnapMod, snapTxT, new GUIStyle("button")); GUILayout.Space(10); if (GUILayout.Button(AlignTxT)) { GenericMenu a = new GenericMenu(); a.AddItem(new GUIContent(DirTxT[0]), false, () => AlignTo(bounds.center)); a.AddItem(new GUIContent(DirTxT[1]), false, () => AlignTo(bounds.Top())); a.AddItem(new GUIContent(DirTxT[2]), false, () => AlignTo(bounds.Buttom())); a.AddItem(new GUIContent(DirTxT[3]), false, () => AlignTo(bounds.Left())); a.AddItem(new GUIContent(DirTxT[4]), false, () => AlignTo(bounds.Right())); a.AddItem(new GUIContent(DirTxT[5]), false, () => AlignTo(bounds.Front())); a.AddItem(new GUIContent(DirTxT[6]), false, () => AlignTo(bounds.Back())); a.ShowAsContext(); } } } }
private void CopyListPanel(BuildTarget buildTarget, ref string directoryRegex, ref string fileRegex) { switch (buildTarget) { case BuildTarget.Android: copyList = G.Module.UserConfig.Json.PlayerSettings.Android.CopyList; break; case BuildTarget.iOS: copyList = G.Module.UserConfig.Json.PlayerSettings.IOS.CopyList; break; default: break; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Copy Directory", EditorStyles.boldLabel); GUILayout.Label("Active/Revert"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Copy Now")) { CopyNow(buildTarget); } if (GUILayout.Button("Revert Now")) { RevertNow(); } if (GUILayout.Button("+")) { copyList.Add(new Configs.UserConfig.PlayerSettings.CopyItem()); OnValueChanged(); } //EBPEditorGUILayout.TextField(" Directory Regex:", ref directoryRegex, OnValueChanged, GUILayout.MaxWidth(100000)); //EBPEditorGUILayout.TextField(" File Regex:", ref fileRegex, OnValueChanged, GUILayout.MaxWidth(100000)); //GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); for (int i = 0; i < copyList.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("-"); EBPEditorGUILayout.Toggle(null, ref copyList[i].Active, OnValueChanged); using (var scope = new EditorGUI.DisabledGroupScope(!copyList[i].Active)) { EBPEditorGUILayout.Toggle(null, ref copyList[i].Revert, OnValueChanged); EBPEditorGUILayout.TextField(null, ref copyList[i].SourcePath, OnValueChanged, GUILayout.MaxWidth(100000)); EditorGUILayout.LabelField("→", GUILayout.Width(15)); EBPEditorGUILayout.TextField(null, ref copyList[i].TargetPath, OnValueChanged, GUILayout.MaxWidth(100000)); copyList[i].CopyMode = (CopyMode)EBPEditorGUILayout.EnumPopup(null, copyList[i].CopyMode, OnValueChanged, GUILayout.Width(70)); } if (GUILayout.Button("-") && ((string.IsNullOrEmpty(copyList[i].SourcePath) && string.IsNullOrEmpty(copyList[i].TargetPath)) || G.Module.DisplayDialog("确定删除该项?", "确定", "取消"))) { copyList.RemoveAt(i); OnValueChanged(); EditorGUIUtility.editingTextField = false; } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } }
public override void OnDrawScrollArea() { GUILayout.Label(new GUIContent($"Event fixer will replace all saved EventData please be careful", EditorGUIUtility.FindTexture("console.erroricon"))); foreach (var item in needFixEventData) { using (var horizon = new EditorGUILayout.HorizontalScope("box")) { item.fix = EditorGUILayout.ToggleLeft(GUIContent.none, item.fix, GUILayout.Width(20)); using (var vertical = new EditorGUILayout.VerticalScope()) { using (var horizon2 = new EditorGUILayout.HorizontalScope()) { GUILayout.Label($"Method : [{item.originalMethodName}] in Script : [{item.originalScriptName}]"); using (var disable = new EditorGUI.DisabledGroupScope(!classMethodInfo.ContainsKey(item.originalScriptName))) { if (GUILayout.Button("Apply Origin Data")) { item.modifyScriptName = item.originalScriptName; item.modifyMethodName = item.originalMethodName; } } } int currentSelectClass = string.IsNullOrEmpty(item.modifyScriptName) ? 0 : classMethodInfo.Values.ToList().IndexOf(classMethodInfo[item.modifyScriptName]); using (var check = new EditorGUI.ChangeCheckScope()) { currentSelectClass = EditorGUILayout.Popup("Event Script", currentSelectClass, classMethodInfo.Select(m => m.Key).ToArray()); if (check.changed) { ViewSystemLog.Log(currentSelectClass); if (currentSelectClass != 0) { var c = classMethodInfo.ElementAt(currentSelectClass); item.modifyScriptName = c.Key; item.modifyMethodName = ""; } else { item.modifyScriptName = ""; item.modifyMethodName = ""; } } } if (currentSelectClass != 0) { using (var check = new EditorGUI.ChangeCheckScope()) { using (var horizon2 = new EditorGUILayout.HorizontalScope()) { var c = classMethodInfo.ElementAt(currentSelectClass).Value; var current = c.SingleOrDefault(m => m.name == item.modifyMethodName); CMEditorLayout.GroupedPopupField(item.GetHashCode(), new GUIContent("Event Method"), c, current, (select) => { item.modifyMethodName = select.name; } ); } } } } } } }
void OnGUI() { using (var vertical = new GUILayout.VerticalScope("box")) { DrawLabel("Enviromnent"); using (var disable = new EditorGUI.DisabledGroupScope(Application.platform != RuntimePlatform.OSXEditor)) { using (var horizon = new EditorGUILayout.HorizontalScope()) { MonoPath = EditorGUILayout.TextField("Mono Path", MonoPath); // if (GUILayout.Button("Get", GUILayout.Width(80))) // { // var result = $"which mono".Bash(); // Debug.Log(result.result); // } } // EditorGUILayout.SelectableLabel("Run 'which mono' to get the full mono path which install in your computer"); EditorGUILayout.HelpBox("Run 'which mono' to get the full mono path which installed in your computer \n (Only required on macOS or Linux)", MessageType.Info); } using (var horizon = new GUILayout.HorizontalScope()) { EditorGUILayout.TextField("Working Folder", currentSelectPath); if (GUILayout.Button("Select Folder", GUILayout.Width(150))) { currentSelectPath = EditorUtility.OpenFolderPanel("Select Folder", "", ""); } } if (Directory.Exists(currentSelectPath) && !Directory.Exists(DocFxProjectPath)) { EditorGUILayout.HelpBox("No DocFx Project Found", MessageType.Error); if (GUILayout.Button("Generate Document Project From sample")) { GenerateDocumentProject();; } } } using (var disable = new EditorGUI.DisabledGroupScope(!isGenerateAvailable)) { DrawLabel("Settings"); using (var horizon = new GUILayout.HorizontalScope()) { if (settings != null) { using (var vertical = new GUILayout.VerticalScope("box")) { DrawLabel("Metadata"); settings.copyReadmeToDocfxIndex = GUILayout.Toggle(settings.copyReadmeToDocfxIndex, "Copy Readme to Docfx index"); settings.disableDefaultFilter = GUILayout.Toggle(settings.disableDefaultFilter, "Disable Default Filter"); settings.disableGitFeatures = GUILayout.Toggle(settings.disableGitFeatures, "Disable Git Features"); } using (var vertical = new GUILayout.VerticalScope("box")) { DrawLabel("Copy Folder To Document"); GUILayout.Label("Path is relative to Working Folder, will copy to generated document folder"); list.DoLayoutList(); } } else { EditorGUILayout.HelpBox("No working folder is selected :)", MessageType.Warning); } } using (var vertical = new GUILayout.VerticalScope("box")) { DrawLabel("Assembly definitions"); if (csprojFiles == null || csprojFiles.Count == 0) { EditorGUILayout.HelpBox("No Asmdef find in target Folder", MessageType.Error); } else { GUILayout.Label($"Found {csprojFiles.Count} asmdef file{(csprojFiles.Count > 1 ? "s" : "")}"); using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.Height(120))) { scrollPosition = scroll.scrollPosition; foreach (var item in csprojFiles) { GUILayout.Label($"- {item}"); } } } } if (GUILayout.Button("Generate Document")) { SaveSetting(); Docfx(); } } GUILayout.FlexibleSpace(); DrawHosting(); }