protected override void OnWindowGUI() { if (m_script == null) { return; } GUILayout.Space(10); using (new EditorGUILayout.HorizontalScope()) { GUIHelper.FixedLabel(" GameObject", 14, Color.green); m_script.GameObject = EditorGUILayout.ObjectField(m_script.GameObject, typeof(GameObject), true, GUILayout.Width(200)) as GameObject; } GUILayout.Space(10); m_script.NameSpace = EditorGUIHelper.TitleTextField(" NameSpace", 14, Color.white, m_script.NameSpace, true); m_script.ClassName = EditorGUIHelper.TitleTextField(" ClassName", 14, Color.white, m_script.ClassName, true); GUIHelper.HorizontalSplitter(1, 10); DrawHierarchy(); }
public override void OnInspectorGUI() { serializedObject.Update(); // 点击曲线 _pressExpand = EditorGUIHelper.DrawHead("点击曲线", _pressExpand); if (_pressExpand) { EditorGUILayout.BeginVertical("Box"); { DrawPressData(); } EditorGUILayout.EndVertical(); } // 音效 _audioExpand = EditorGUIHelper.DrawHead("音效", _audioExpand); if (_audioExpand) { EditorGUILayout.BeginVertical("Box"); { DrawAudioData(); } EditorGUILayout.EndVertical(); } serializedObject.ApplyModifiedProperties(); }
public override void OnPaint() { if (!value.Override) { PushDisabledStyle(); } float margin = 0.3f; float width = margin * GUI.GetContentRegionAvailable().X - 10.0f; GUI.AlignTextToFramePadding(); GUI.SetNextItemWidth(width); ImGui.LabelText("##" + value.Name, value.Name); GUI.OpenPopupOnItemClick(GetPopupID, 0); GUI.PushMargin(margin); GUI.Indent(); EditorGUIHelper.TryDisplayValue(index, value); GUI.PopMargin(); if (!value.Override) { PopDisabledStyle(); } CheckPopup(); }
public override void Draw(BuildWindowConfig config) { var appManifest = AppTools.GetAppManifest; var appManifestAsset = AppTools.GetAppManifestAsset; EditorGUILayout.BeginVertical("Box"); { EditorGUIHelper.DrawTitle("Publishing Settings"); EditorGUILayout.LabelField( "The App Manifest is how we identify your experiences from other experiences"); _id = EditorGUILayout.IntField("ID", _id); _version = EditorGUILayout.IntField("Version", _version); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); { appManifestAsset = (TextAsset)EditorGUILayout.ObjectField(appManifestAsset, typeof(TextAsset), true); if (GUILayout.Button("Update Manifest")) { if (EnsureManifestFolderExists()) { AppTools.CreateAppManifest(_id, _version); } EditorGUIUtility.PingObject(appManifestAsset); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } }
private string DrawSearchField(Rect innerToolbarArea, string searchText) { (Rect searchFieldArea, Rect buttonRect) = innerToolbarArea.CutVertically(DropdownStyle.IconSize, true); bool keyDown = Event.current.type == EventType.KeyDown; searchText = EditorGUIHelper.FocusedTextField(searchFieldArea, searchText, "Search", DropdownStyle.SearchToolbarStyle, _searchFieldControlName); // When the search field is in focus, it uses the keyDown event on DownArrow while doing nothing. // We need this event for moving through the tree nodes. if (keyDown) { Event.current.type = EventType.KeyDown; } if (GUIHelper.CloseButton(buttonRect)) { searchText = string.Empty; GUI.FocusControl(null); // Without this, the old text does not disappear for some reason. GUI.changed = true; } return(searchText); }
public override void OnInspectorGUI() { MLBooleanGameState state = (MLBooleanGameState)target; EditorGUIHelper.guiColorForState(state.transform, state.param, new Color(.4f, 1f, .2f), new Color(.5f, .7f, .3f)); base.OnInspectorGUI(); }
public override void Draw(BuildWindowConfig config) { EditorGUILayout.BeginVertical("Box"); { EditorGUIHelper.DrawTitle("Experience Settings"); EditorGUILayout.LabelField("This page is used to set the various settings of the experience"); EditorGUILayout.TextArea("", GUI.skin.horizontalSlider); GetConfig(); if (_limappConfig == null) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Create New Config File")) { CreateConfig(); } return; } DrawFields(_limappConfig, "Limapp Config"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Update Config From Project Settings")) { _limappConfig.SaveProjectSettings(); Debug.Log("Config Updated!"); } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { label.tooltip = EditorHelper.GetTooltipFromAttribute( fieldInfo, defaultValue: label.tooltip ); if (property.hasMultipleDifferentValues) { position = EditorGUIHelper.StandardLabel(position, label); position = EditorGUIHelper.CompensateIndentLevel(position); EditorGUIHelper.SinglePopup(position, "Multi-Object Editing Not Supported"); return; } if (!fieldInfo.FieldType.IsEnum) { EditorGUI.PropertyField( position, property, label, includeChildren: true ); return; } // If a single value, property uses EnumValueIndex int enumIndex = property.enumValueIndex; Enum enumVal; if (enumIndex != -1) { Array values = Enum.GetValues(fieldInfo.FieldType); enumVal = (Enum)values.GetValue(enumIndex); } else { int intVal = property.intValue; enumVal = (Enum)Enum.ToObject(fieldInfo.FieldType, intVal); } enumVal = EditorGUI.EnumMaskField(position, label, enumVal); int newIntVal = Convert.ToInt32(enumVal); // Check if a PoT (which would mean a single value) // https://stackoverflow.com/questions/1662144/testing-a-flags-enum-value-for-a-single-value bool isSingleValue = newIntVal != 0 && (newIntVal & (newIntVal - 1)) == 0; if (isSingleValue) { Array values = Enum.GetValues(fieldInfo.FieldType); property.enumValueIndex = Array.IndexOf(values, enumVal); } else { property.intValue = newIntVal; } }
public override void Draw(BuildWindowConfig config) { EditorGUIHelper.DrawTitle("App Preview"); GUILayout.Label("The Preview Scene will load and run your limapp created from the Build Tool"); GUILayout.Space(EditorGUIUtility.singleLineHeight); if (CanDraw) { GUILayout.Label("Select Limapp"); _appPreviewConfig = _previewApp.PreviewConfig; DrawLimappSelection(ref _appPreviewConfig.EmulatorPath, "Emulator"); DrawLimappSelection(ref _appPreviewConfig.AndroidPath, "Android"); CopyAndroidAppToStreamingAssets(); EditorUtility.SetDirty(_previewApp.PreviewConfig); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); { if (EditorApplication.isPlaying) { if (GUILayout.Button(EditorGUIUtility.IconContent("PauseButton"))) { _previewApp.Stop(); } if (GUILayout.Button(EditorGUIUtility.IconContent("PlayButton"))) { _previewApp.Play(); } } else { if (!string.IsNullOrEmpty(config.PreviousScene)) { if (GUILayout.Button("Back")) { EditorSceneManager.OpenScene(config.PreviousScene, OpenSceneMode.Single); } } if (GUILayout.Button("Play")) { EditorApplication.isPlaying = true; } } } GUILayout.EndHorizontal(); } else { GUILayout.FlexibleSpace(); if (GUILayout.Button("Open Preview Scene")) { config.PreviousScene = EditorSceneManager.GetActiveScene().path; EditorSceneManager.OpenScene(BuildWindowConsts.PreviewAppScenePath, OpenSceneMode.Single); } } }
private static void DrawColoredBackground(Rect selectionRect, Folder folder) { var color = folder.folderColor; color.a = 0.3f; EditorGUIHelper.SaveGUIColor(color); GUI.Box(selectionRect, string.Empty); EditorGUIHelper.RestoreGUIColor(); }
public override void OnInspectorGUI() { MLLogicGate state = (MLLogicGate)target; try { EditorGUIHelper.guiColorForState(state.transform, state.state, Color.green, new Color(.3f, .8f, .8f)); } catch (Exception e) { } base.OnInspectorGUI(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { label.tooltip = EditorHelper.GetTooltipFromAttribute(fieldInfo, label.tooltip); bool enabled = GUI.enabled; Color color = GUI.color; if (IsReadOnly(property)) { GUI.enabled = false; } if (!Validate(property)) { GUI.color = errorColor; } using (var titles = TempList <string> .Get()) { GetTitles(property, titles.buffer); string title = JoinTitle(titles.buffer); if (!string.IsNullOrEmpty(title)) { content.text = title; float titleHeight = GetTitleHeight(title); Rect titleRect = position; titleRect.height = titleHeight; EditorGUIHelper.Indent(ref titleRect, steps: EditorGUI.indentLevel); GUI.Label(titleRect, content); position.y += titleHeight; position.height -= titleHeight; } if (!UseObjField(property)) { EditorGUI.PropertyField(position, property, label, includeChildren: true); } else { property.objectReferenceValue = EditorGUI.ObjectField( position, label, property.objectReferenceValue, GetObjRefType(), allowSceneObjects: attribute.objRefRestriction != PropObjRefRestrict.OnlyAsset ); } } GUI.color = color; GUI.enabled = enabled; }
public bool OnGUI(int leftWidth, int height) { //BaseOnGUI(); this.leftWidth = leftWidth; this.height = height; EditorGUIHelper.DrawColums(DrawLeftSide, DrawRightSide); return(isDirty); }
void DrawValue(Rect position, SerializedProperty property) { if (property == null) { position.yMax = position.y + fontSize; GUI.Label(position, "Missing"); return; } EditorGUIHelper.DrawPropertyRecursivly(position, property); }
void DrawWithoutEditor(Rect position, SerializedProperty property) { Rect foldoutRect = position; foldoutRect.width = 20.0f; property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, ""); if (!property.isExpanded) { return; } position.y += position.height; if (property.isArray) { position.height = EditorGUIUtility.singleLineHeight; Rect sizeRect = position; EditorGUIHelper.Indent(ref sizeRect); property.arraySize = EditorGUI.IntField(sizeRect, "Size", property.arraySize); position.y += position.height; } EditorGUIHelper.Indent(ref position); Iterate(property, foreachArrayElem: (SerializedProperty eleProp) => { position.height = EditorGUI.GetPropertyHeight(eleProp); EditorGUI.PropertyField(position, eleProp, includeChildren: false); if (eleProp.objectReferenceValue != null) { foldoutRect = position; foldoutRect.width = 20.0f; eleProp.isExpanded = EditorGUI.Foldout(foldoutRect, eleProp.isExpanded, ""); } position.y += position.height; }, foreachChild: (SerializedProperty prop) => { position.height = EditorGUI.GetPropertyHeight(prop); Rect indented = position; EditorGUIHelper.Indent(ref indented); EditorGUI.PropertyField(indented, prop, includeChildren: true); position.y += position.height; } ); }
public static void Splitter(Rect position) { if (Event.current.type != EventType.Repaint) { return; } EditorGUIHelper.SetColor(splitterColor, () => { bool isHover = false, isActive = false, on = false, hasKeyboardFocus = false; splitter.Draw(position, isHover, isActive, on, hasKeyboardFocus); }); }
// TODO: Might want to use PrefixLabel instead // A rect that should look like a standard Unity EditorGUI label // (i.e. the name before the value) // Returns position with the label's width deducted public static Rect StandardLabel(Rect position, GUIContent label) { EditorGUIHelper.Indent(ref position, EditorGUI.indentLevel); float labelWidth = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH; Rect labelRect = position; labelRect.width = labelWidth; GUI.Label(labelRect, label); position.x += labelWidth; position.width -= labelWidth; return(position); }
private void DisplayUnityEditorTab() { if (!IssuesUtility.HasEditorIssues()) { return; } EditorGUIHelper.DrawTitleFoldout("Unity Editor", ref _showEditor, () => { EditorGUI.indentLevel++; EditorGUIHelper.DrawSpritedLabel("Ensure you are using Unity 2019.1.10f1 as your development environment", ErrorTexture, GUILayout.MaxWidth(16), GUILayout.MaxHeight(16)); GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUI.indentLevel--; }); }
public bool OnGUI(int leftWidth, int height) { BaseOnGUI(); var root = InstanceFinder.DataManager.AudioTree; int id = InstanceFinder.GuiUserPrefs.SelectedAudioNodeID; var selectedNode = UpdateSelectedNode(root, id); InstanceFinder.GuiUserPrefs.SelectedAudioNodeID = selectedNode != null ? selectedNode.ID : 0; this.leftWidth = leftWidth; this.height = height; EditorGUIHelper.DrawColums(DrawLeftSide, DrawRightSide); return(isDirty); }
public override void OnInspectorGUI() { serializedObject.Update(); //绘制元素列表 OnDrawElements(); serializedObject.ApplyModifiedProperties(); //添加自动生成 _expand = EditorGUIHelper.DrawHead("辅助", _expand); if (_expand) { GUILayout.BeginVertical("box"); { _prefix = EditorGUILayout.TextField("引用前缀", _prefix); if (GUILayout.Button("复制节点定义")) { PrefabLink pl = target as PrefabLink; CopyElementDeclare(pl); } if (GUILayout.Button("复制节点初始化")) { PrefabLink pl = target as PrefabLink; CopyElementInitialize(pl); } if (GUILayout.Button("复制节点反初始化")) { PrefabLink pl = target as PrefabLink; CopyElementUnIninitialize(pl); } // if (GUILayout.Button("复制Lua节点定义")) // { // PrefabLink pl = target as PrefabLink; // CopyElementDeclareLua(pl); // } if (GUILayout.Button("复制Lua节点初始化")) { PrefabLink pl = target as PrefabLink; CopyElementInitializeLua(pl); } // if (GUILayout.Button("复制Lua节点反初始化")) // { // PrefabLink pl = target as PrefabLink; // CopyElementUnIninitializeLua(pl); // } } } }
public override void Draw(BuildWindowConfig config) { GUILayout.Label( "In order to build for the Liminal Platform, you need to set up the app scene" + "\nCurrently, we only support 1 Scene"); EditorGUIHelper.DrawTitle("Scene Setup"); GUILayout.Label("1. Open the scene you want to build" + "\n2. Click Setup App Scene"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Setup Scene")) { AppTools.SetupAppScene(); } }
private void DrawContent() { using (new FixedRect(_preventExpandingHeight, position.width)) { using (EditorGUILayoutHelper.VerticalBlock(_preventExpandingHeight, DropdownStyle.BackgroundColor, out float contentHeight)) { _selectionTree.Draw(); if (Event.current.type == EventType.Repaint) { _contentHeight = contentHeight; } } EditorGUIHelper.DrawBorders(position.width, position.height, DropdownStyle.BorderColor); } }
public static void Draw(InAudioBankLink bankLink) { EditorGUILayout.BeginVertical(); InUndoHelper.GUIUndo(bankLink, "Name Change", ref bankLink._name, () => EditorGUILayout.TextField("Name", bankLink._name)); if (bankLink._type == AudioBankTypes.Bank) { EditorGUIHelper.DrawID(bankLink._guid); //UndoHelper.GUIUndo(bankLink, "Load async", ref bankLink.LoadASync, () => // EditorGUILayout.Toggle("Load ASync", bankLink.LoadASync)); bool autoLoad = EditorGUILayout.Toggle("Auto load", bankLink._autoLoad); if (autoLoad != bankLink._autoLoad) //Value has changed { InUndoHelper.RecordObjectFull(bankLink, "Bank Auto Load"); bankLink._autoLoad = autoLoad; } Rect lastArea = GUILayoutUtility.GetLastRect(); lastArea.y += 28; lastArea.width = 200; if (GUI.Button(lastArea, "Find Folders using this bank")) { EditorWindow.GetWindow <InAudioWindow>().Find(audioNode => audioNode.GetBank() != bankLink); } EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); if (Application.isPlaying) { EditorGUILayout.Toggle("Is Loaded", bankLink.IsLoaded); } } EditorGUILayout.EndVertical(); //UndoCheck.Instance.CheckDirty(node); }
private void DisplayRenderingTab() { if (!IssuesUtility.HasRenderingIssues()) { return; } EditorGUIHelper.DrawTitleFoldout("Rendering", ref _showRendering, () => { EditorGUI.indentLevel++; if (!PlayerSettings.virtualRealitySupported) { EditorGUILayout.BeginHorizontal(); EditorGUIHelper.DrawSpritedLabel("Virtual Reality Must Be Supported", ErrorTexture, GUILayout.MaxWidth(16), GUILayout.MaxHeight(16)); if (GUILayout.Button("Enable VR Support")) { PlayerSettings.virtualRealitySupported = true; } EditorGUILayout.EndHorizontal(); GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUI.indentLevel--; } if (PlayerSettings.stereoRenderingPath != StereoRenderingPath.SinglePass) { EditorGUILayout.BeginHorizontal(); EditorGUIHelper.DrawSpritedLabel("Stereo Rendering Mode Must be Set To Single Pass", ErrorTexture, GUILayout.MaxWidth(16), GUILayout.MaxHeight(16)); if (GUILayout.Button("Set To Single Pass")) { PlayerSettings.stereoRenderingPath = StereoRenderingPath.SinglePass; } EditorGUILayout.EndHorizontal(); GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; }); }
public override void Draw(BuildWindowConfig config) { EditorGUIHelper.DrawTitle("Experience Settings"); EditorGUILayout.LabelField("This page is used to set the various settings of the experience"); EditorGUILayout.TextArea("", GUI.skin.horizontalSlider); GUILayout.Space(10); var experienceApp = GameObject.FindObjectOfType <ExperienceApp>(); if (experienceApp == null) { EditorGUILayout.LabelField("Please open the scene you wish to edit the settings of."); return; } var app = UnityEditor.Editor.CreateEditor(experienceApp); app.DrawDefaultInspector(); }
public override void Draw(BuildWindowConfig config) { GUILayout.BeginVertical("Box"); { EditorGUIHelper.DrawTitle("Scene Setup"); GUILayout.Label( "In order to build for the Liminal Platform, you need to set up the app scene" + "\nCurrently, we only support 1 Scene", EditorStyles.boldLabel); GUILayout.Space(4); GUILayout.Label("Setting Up", EditorStyles.boldLabel); var guiStyle = new GUIStyle(EditorStyles.label) { richText = true, wordWrap = true, clipping = TextClipping.Overflow }; GUILayout.Label("<b><size=17>1.</size></b> Click <b>[Generate Scripts]</b> which will provide you with methods to override basic implementation such as Pause, Resume and how the app ends.", guiStyle); GUILayout.Space(2); GUILayout.Label("<b><size=17>2.</size></b> Open the scene you want to create your experience in.", guiStyle); GUILayout.Space(2); GUILayout.Label("<b><size=17>3.</size></b> Click <b>[Setup Scene]</b> which will setup the scene to work with the Limapp system. When it comes time to build, only things under the [ExperienceApp] object will be included.", guiStyle); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); using (new EditorGUI.DisabledScope(_generated)) { if (GUILayout.Button("Generate Scripts")) { AppTools.GenerateScripts(); } } using (new EditorGUI.DisabledScope(!_generated)) { if (GUILayout.Button("Setup Scene")) { AppTools.SetupAppScene(); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } }
private static void OnHierarchyGUI(int instanceID, Rect selectionRect) { var obj = EditorUtility.InstanceIDToObject(instanceID) as GameObject; var note = obj.GetAsNote(); if (obj == null) { return; } if (note != null || obj.GetComponentInChildren <Note>() != null) { var parents = GetParents(obj.transform); var noteIconRect = new Rect(selectionRect); noteIconRect.x = (selectionRect.width - 18) + (parents.Length * 14); noteIconRect.width = 20; var maxCharacters = 200; var text = string.Empty; if (note != null) { text = note.text.Length > maxCharacters?note.text.Substring(0, maxCharacters - 3) + "..." : note.text; } else { text = string.Format("Child '{0}' has note", obj.GetComponentInChildren <Note>().name); EditorGUIHelper.SaveGUIColor(new Color(1f, 1f, 1f, 0.4f)); } if (GUI.Button(noteIconRect, new GUIContent(hNote16, text), GUIStyle.none) && note == null) { Selection.activeObject = obj.GetComponentInChildren <Note>(); EditorGUIUtility.PingObject(Selection.activeObject); } if (note == null) { EditorGUIHelper.RestoreGUIColor(); } } }
public override void OnInspectorGUI() { EditorGUILayout.HelpBox("This effect adds fog compatibility to the deferred rendering path; Allows to override fog color with gradient; Rest of fog settings should be set in the Lighting panel.", MessageType.Info); EditorGUILayout.PropertyField(m_ExcludeSkybox, EditorGUIHelper.GetContent("Exclude Skybox (deferred only)")); EditorGUILayout.PropertyField(m_TopColor, EditorGUIHelper.GetContent("Top Fog Color (deferred only)")); EditorGUILayout.PropertyField(m_MidColor, EditorGUIHelper.GetContent("Mid Fog Color (deferred only)")); EditorGUILayout.PropertyField(m_BottomColor, EditorGUIHelper.GetContent("Bottom Fog Color (deferred only)")); EditorGUILayout.PropertyField(m_Middle, EditorGUIHelper.GetContent("Blend factor (deferred only)")); float min = m_Min.floatValue; float max = m_Max.floatValue; EditorGUILayout.MinMaxSlider( EditorGUIHelper.GetContent("Gradient size | Values between which middle section is placed."), ref min, ref max, 0.001f, 0.999f ); m_Min.floatValue = Mathf.Min(min, max - 0.001f); m_Max.floatValue = Mathf.Max(max, min + 0.001f); }
// ------------------------------------------------------------------------------- #if UNITY_EDITOR public override bool OnGUI() { if (ConditionToWaitFor == null) { EditorGUIHelper.CreateConditionButton((condition) => { ConditionToWaitFor = condition; }); } else { EditorGUIHelper.ShowConditionInspector(ConditionToWaitFor); if (GUILayout.Button("Delete Condition")) { ConditionToWaitFor = null; } InvertCondition = EditorGUILayout.Toggle("Invert Condition", InvertCondition); } return(true); }
public bool OnGUI(int leftWidth, int height) { BaseOnGUI(); var dataManager = InstanceFinder.DataManager; if (dataManager != null) { Undo.ClearSnapshotTarget(); var root = dataManager.BankLinkTree; int id = InstanceFinder.GuiUserPrefs.SelectedBusID; var selectedNode = UpdateSelectedNode(root, id); InstanceFinder.GuiUserPrefs.SelectedBusID = selectedNode != null ? selectedNode.ID : 0; } this.leftWidth = leftWidth; this.height = height; EditorGUIHelper.DrawColums(DrawLeftSide, DrawRightSide); return(isDirty); }