/// <summary> /// Render the guidedTour /// </summary> protected void DoGuidedTourGUI() { FsmEditorStyles.Init(); HandleKeyboardInput(); DoSplitter(); // Hints if (FsmEditorSettings.ShowHints) { GUILayout.Box("Click Topics to highlight UI and show more info.\nClick Help Button to open online help.", FsmEditorStyles.HintBox); } DoTopicsList(); GUILayout.FlexibleSpace(); DoBottomPanel(); // mouse event not used by other UI // so must have clicked on empty area if (Event.current.type == EventType.MouseDown && Event.current.mousePosition.y < position.height - helpHeight) { ClearHighlight(); } }
public override void OnInspectorGUI() { FsmEditorStyles.Init(); EditorGUILayout.Space(); try { controlsPanel.OnGUI(); } catch (Exception e) { if (e is ExitGUIException) { throw; } // FSMs might have been edited invalidating our controls, // so we have to InitControls again InitControls(); // ExitGUI to avoid layout errors GUIUtility.ExitGUI(); } GUILayout.Space(4); }
protected override void OnGUI() { if (shouldRefresh) { Repaint(); } FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard"); GUILayout.Space(_topSpace); EditorGUIUtility.LookLikeControls(200); // check pun version support if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported()) { GUI.color = PlayMakerPhotonEditorUtility.lightOrange; GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true)); GUI.color = Color.white; } bool hasPro = UnityEditorInternal.InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(EditorUserBuildSettings.activeBuildTarget); if (!hasPro) { GUI.color = PlayMakerPhotonEditorUtility.lightOrange; GUILayout.Label("WARNING: Photon requires " + EditorUserBuildSettings.activeBuildTarget + " Pro to make an " + EditorUserBuildSettings.activeBuildTarget + " build.", "box", GUILayout.ExpandWidth(true)); GUI.color = Color.white; } // custom layout (other parts can be overridden as well) // GUILayout.Label("My Custom Editor"); base.OnGUI(); }
public override void DoGUI() { FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Update Tools"); OnGUI_ToolBar(); }
public void OnGUI() { FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Upgrade Guide"); // Hack fix needed in 1.7.8 (fixed in 1.8.0) GUILayout.Space(20); scrollPosition = GUILayout.BeginScrollView(scrollPosition); EditorGUILayout.HelpBox("Always BACKUP projects before updating!", MessageType.Error); GUILayout.Label("Version 1.7.8", EditorStyles.boldLabel); #if (UNITY_5_0 || UNITY_5) EditorGUILayout.HelpBox("Update PlayMaker for Unity 5 compatibility!" + "\nUpdate in the Unity 5 Asset store, or " + "download from the Hutong Games store.", MessageType.Error); #else EditorGUILayout.HelpBox("This is a maintainance release for Unity 5 compatibility. " + "\nFor full Unity 5 compatibility please update PlayMaker in the Unity 5 Asset Store and re-import. " + "", MessageType.Info); #endif GUILayout.Label("Unity 5 Upgrade Notes", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Unity 5 removed component property shortcuts from GameObject. " + "\n\nThe Unity auto update process replaces these properties with GetComponent calls. " + "In many cases this is fine, but some third party actions and addons might need manual updating! " + "Please post on the PlayMaker forums and contact the original authors for help." + "\n\nIf you used these GameObject properties in Get Property or Set Property actions " + "they are no longer valid, and you need to instead point to the Component directly. " + "E.g., Drag the Component (NOT the GameObject) into the Target Object field." + "\n", MessageType.Warning); GUILayout.Label("Unity 4.6 Upgrade Notes", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Find support for the new Unity GUI online in our Addons page.", MessageType.Info); EditorGUILayout.HelpBox("PlayMakerGUI is only needed if you use OnGUI Actions. " + "If you don't use OnGUI actions un-check Auto-Add PlayMakerGUI in PlayMaker Preferences.", MessageType.Info); GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); var dontShowAgain = GUILayout.Toggle(!showOnLoad, "Don't Show Again Until Next Update"); if (EditorGUI.EndChangeCheck()) { showOnLoad = !dontShowAgain; EditorPrefs.SetBool("Playmaker.ShowUpgradeGuide", showOnLoad); } if (GUILayout.Button("Online Release Notes")) { Application.OpenURL(urlReleaseNotes); } }
public override void DoGUI() { FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Guided Tour"); EditorGUIUtility.labelWidth = 200; //EditorGUILayout.HelpBox("NOTE: This is a BETA feature, please give feedback on the Playmaker Forums. Thanks!", MessageType.Info); DoGuidedTourGUI(); }
public override void DoGUI() { FsmEditorStyles.Init(); GUILayout.BeginVertical(); FsmEditorGUILayout.PlaymakerHeader(this); GUILayout.Space(10); GUILayout.Label("© Hutong Games LLC. All Rights Reserved.", EditorStyles.miniLabel); GUILayout.Label("Version 1.7.8.4"); if (VersionInfo.PlayMakerVersionInfo != "") { EditorGUILayout.HelpBox(VersionInfo.PlayMakerVersionInfo, MessageType.None); } #if (UNITY_5_0 || UNITY_5) if (showUpdateWarning) { EditorGUILayout.HelpBox("Update PlayMaker for Unity 5!" + "\nUpdate in the Unity 5 Asset store, or " + "download from the Hutong Games store.", MessageType.Error); } #endif EditorGUILayout.HelpBox(string.Format(Strings.AboutPlaymaker_Special_Thanks, "Erin Ko, Kemal Amarasingham, Bruce Blumberg, Steve Gargolinski, Lee Hepler, Bart Simon, " + "Lucas Meijer, Joachim Ante, Jaydee Alley, James Murchison, XiaoHang Zheng, Andrzej Łukasik, " + "Vanessa Wesley, Marek Ledvina, Bob Berkebile, Jean Fabre, MaDDoX, gamesonytablet, " + "Marc 'Dreamora' Schaerer, Eugenio 'Ryo567' Martínez, Steven 'Nightreaver' Barthen, " + "Damiangto, VisionaiR3D, 黄峻, Nilton Felicio, Andre Dantas Lima, " + "Ramprasad Madhavan, and the PlayMaker Community!\r\n"), MessageType.None); if (GUILayout.Button(Strings.AboutPlaymaker_Release_Notes)) { EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes); } if (GUILayout.Button(Strings.AboutPlaymaker_Hutong_Games_Link)) { Application.OpenURL("http://www.hutonggames.com/"); } GUILayout.Space(5); GUILayout.EndVertical(); if (!heightHasBeenSet && Event.current.type == EventType.repaint) { SetWindowHeightToFitContents(); } }
public void OnGUI() { FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Upgrade Guide"); // Hack fix needed in 1.7.8 (fixed in 1.8.0) GUILayout.Space(20); scrollPosition = GUILayout.BeginScrollView(scrollPosition); EditorGUILayout.HelpBox("Always BACKUP projects before updating!", MessageType.Error); GUILayout.Label("Version 1.7.8", EditorStyles.boldLabel); EditorGUILayout.HelpBox("This is a maintainance release for Unity 5 compatibility. " + "\nNew features and bug fixes coming soon in 1.8.0", MessageType.Info); EditorGUILayout.HelpBox("The Playmaker About Window still says 1.7.7 since the dlls were not recompiled for this version.", MessageType.Info); GUILayout.Label("Unity 5 Upgrade Notes", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Unity 5 removed component property shortcuts from GameObject. " + "\n\nThe Unity auto update process replaces these properties with GetComponent calls. " + "In many cases this is fine, but some third party actions and addons might need manual updating! " + "Please post on the PlayMaker forums and contact the original authors for help." + "\n\nIf you used these GameObject properties in Get Property or Set Property actions " + "they will be gone, and you need to reset them to point to the component directly. " + "E.g., Drag the component into the property field instead of the GameObject." + "\n", MessageType.Warning); GUILayout.Label("Unity 4.6 Upgrade Notes", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Find support for the new Unity GUI online in our Addons page.", MessageType.Info); EditorGUILayout.HelpBox("PlayMakerGUI is only needed if you use OnGUI Actions. " + "If you don't use OnGUI actions un-check Auto-Add PlayMakerGUI in PlayMaker Preferences.", MessageType.Info); GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); var dontShowAgain = GUILayout.Toggle(!showOnLoad, "Don't Show Again Until Next Update"); if (EditorGUI.EndChangeCheck()) { showOnLoad = !dontShowAgain; EditorPrefs.SetBool("Playmaker.ShowUpgradeGuide", showOnLoad); } if (GUILayout.Button("Online Release Notes")) { Application.OpenURL(urlReleaseNotes); } }
public void OnGUI() { FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Event Proxy Creator"); GUILayout.Label(" "); GUILayout.Label("This Proxy lets you create a Component with a public method.\n" + "That method will send a PlayMaker event.\n" + "Use this when you expect Unity or third party assets to fire messages\n" + "and you want to catch that message as a PlayMaker Event"); OnGUI_DoEnumDefinitionForm(); }
protected override void OnGUI() { if (shouldRefresh) { Repaint(); } FsmEditorStyles.Init(); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard"); GUILayout.Space(_topSpace); #if UNITY_3_5 EditorGUIUtility.LookLikeControls(200); #endif // check pun version support if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported()) { GUI.color = PlayMakerPhotonEditorUtility.lightOrange; GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true)); GUI.color = Color.white; } #if PLAYMAKER_1_9_OR_NEWER if (!FsmEditorSettings.UseLegacyNetworking || !FsmEditorSettings.ShowNetworkSync) { FsmEditorSettings.UseLegacyNetworking = true; FsmEditorSettings.ShowNetworkSync = true; } // doesn't work, we need to check with PLAYMAKER_LEGACY_NETWORK compile flag //EditorStartupPrefs.UseLegacyNetworking = GUILayout.Toggle(EditorStartupPrefs.UseLegacyNetworking,"enabled"); // #if !PLAYMAKER_LEGACY_NETWORK // GUI.color = PlayMakerPhotonEditorUtility.lightOrange; // GUILayout.Label("WARNING: PlayMaker needs to have its network UI system enabled","box",GUILayout.ExpandWidth(true)); // GUI.color = Color.white; // // if (GUILayout.Button(new GUIContent("Enable PlayMaker Network UI", "Displays the network sync property for Fsm Variables"))) // { // PlayMakerEditorUtils.MountScriptingDefineSymbolToAllTargets("PLAYMAKER_LEGACY_NETWORK"); // } // // #endif #endif base.OnGUI(); }
public override void OnInspectorGUI() { EditorGUIUtility.hierarchyMode = false; FsmVariableEditor.UnityInspectorMode = true; FsmEditorStyles.Init(); DoGlobalVariablesGUI(); GUILayout.Space(20); DoGlobalEventsGUI(); GUILayout.Space(10); //DoImportExportGUI(); }
public override void OnInspectorGUI() { FsmEditorStyles.Init(); DoGlobalVariablesGUI(); DoGlobalEventsGUI(); GUILayout.Space(5); if (GUILayout.Button("Refresh")) { Refresh(); } GUILayout.Space(10); DoImportExportGUI(); }
public override void OnInspectorGUI() { FsmEditorStyles.Init(); serializedObject.Update(); EditorGUI.BeginChangeCheck(); GUILayout.Label("Category - used in Template Browser and menus"); EditorGUILayout.PropertyField(categoryProperty, GUIContent.none); if (multiline == null) { multiline = new GUIStyle(EditorStyles.textField) { wordWrap = true }; } descriptionProperty.stringValue = EditorGUILayout.TextArea(descriptionProperty.stringValue, multiline, GUILayout.MinHeight(60)); FsmEditorGUILayout.DrawHintText(descriptionProperty.stringValue, "Description"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); FsmTemplateSelector.Refresh(); } GUILayout.BeginHorizontal(); //GUILayout.FlexibleSpace(); if (GUILayout.Button(findInBrowser)) { FsmTemplateSelector.FindTemplateInBrowser((FsmTemplate)target); } if (GUILayout.Button(editButton)) { FsmEditorWindow.OpenWindow((FsmTemplate)target); } GUILayout.EndHorizontal(); EditorGUILayout.HelpBox(Strings.Hint_Exporting_Templates, MessageType.None); }
public void OnGUI() { FsmEditorStyles.Init(); // set style ot use rich text. if (labelStyle == null) { labelStyle = GUI.skin.GetStyle("Label"); labelStyle.richText = true; } // unfocus invisible field GUI.SetNextControlName(_unfocusControlName); GUI.TextField(new Rect(0, -100, 100, 20), ""); FsmEditorGUILayout.ToolWindowLargeTitle(this, "Enum Creator"); OnGUI_HorizontalSplitView(); }
public override void OnInspectorGUI() { //EditorGUIUtility.LookLikeControls(); // can happen when playmaker is updated...? if (fsmComponent == null) { return; } if (!FsmEditorStyles.IsInitialized()) { FsmEditorStyles.Init(); } if (textAreaStyle == null) { textAreaStyle = new GUIStyle(EditorStyles.textField) { wordWrap = true }; } EditorGUILayout.BeginHorizontal(); fsmComponent.FsmName = EditorGUILayout.TextField(fsmComponent.FsmName); //fsmComponent.Fsm.ShowStateLabel = GUILayout.Toggle(fsmComponent.Fsm.ShowStateLabel, new GUIContent("i", "Show active state label in game view. NOTE: Requires PlayMakerGUI in scene"), "Button", GUILayout.MaxWidth(40)); if (GUILayout.Button(new GUIContent("Edit", "Edit in the PlayMaker FSM Editor"), GUILayout.MaxWidth(45))) { FsmEditorWindow.OpenWindow(fsmComponent); GUIUtility.ExitGUI(); } //showInfo = GUILayout.Toggle(showInfo, new GUIContent("Info","Show overview of States, Events and Variables"), "Button", GUILayout.MaxWidth(50)); EditorGUILayout.EndHorizontal(); fsmComponent.FsmDescription = EditorGUILayout.TextArea(fsmComponent.FsmDescription, textAreaStyle); fsmComponent.Fsm.ShowStateLabel = GUILayout.Toggle(fsmComponent.Fsm.ShowStateLabel, new GUIContent("Show State Label", "Show active state label in game view.\nNOTE: Requires PlayMakerGUI in scene")); // VARIABLES FsmEditorGUILayout.LightDivider(); showControls = EditorGUILayout.Foldout(showControls, new GUIContent("Controls", "FSM Variables and Events exposed in the Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { //EditorGUIUtility.LookLikeInspector(); BuildFsmVariableList(); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? ":\n" + fsmVar.Tooltip : ""))); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } // EVENTS //FsmEditorGUILayout.LightDivider(); //showExposedEvents = EditorGUILayout.Foldout(showExposedEvents, new GUIContent("Events", "To expose events here:\nIn PlayMaker Editor, Events tab, select an event and check Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { EditorGUI.indentLevel = 1; //GUI.enabled = Application.isPlaying; foreach (var fsmEvent in fsmComponent.Fsm.ExposedEvents) { if (GUILayout.Button(fsmEvent.Name)) { fsmComponent.Fsm.Event(fsmEvent); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } //GUI.enabled = true; //INFO EditorGUI.indentLevel = 0; FsmEditorGUILayout.LightDivider(); showInfo = EditorGUILayout.Foldout(showInfo, "Info", FsmEditorStyles.CategoryFoldout); if (showInfo) { EditorGUI.indentLevel = 1; //FsmEditorGUILayout.LightDivider(); //GUILayout.Label("Summary", EditorStyles.boldLabel); showStates = EditorGUILayout.Foldout(showStates, "States [" + fsmComponent.FsmStates.Length + "]"); if (showStates) { string states = ""; if (fsmComponent.FsmStates.Length > 0) { foreach (var state in fsmComponent.FsmStates) { states += "\t\t" + state.Name + "\n"; } states = states.Substring(0, states.Length - 1); } else { states = "\t\t[none]"; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, "Events [" + fsmComponent.FsmEvents.Length + "]"); if (showEvents) { string events = ""; if (fsmComponent.FsmEvents.Length > 0) { foreach (var fsmEvent in fsmComponent.FsmEvents) { events += "\t\t" + fsmEvent.Name + "\n"; } events = events.Substring(0, events.Length - 1); } else { events = "\t\t[none]"; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, "Variables [" + fsmVariables.Count + "]"); if (showVariables) { string variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += "\t\t" + fsmVar.Name + "\n"; } variables = variables.Substring(0, variables.Length - 1); } else { variables = "\t\t[none]"; } GUILayout.Label(variables); } } }
public override void OnInspectorGUI() { // can happen when playmaker is updated...? if (fsmComponent == null) { return; } // Make sure common PlayMaker styles are initialized FsmEditorStyles.Init(); // Begin GUI var fsm = fsmComponent.Fsm; fsm.Owner = fsmComponent; // since Owner is no longer serialized if (fsm.States.Length > 100) { EditorGUILayout.HelpBox("NOTE: Collapse this inspector for better editor performance with large FSMs.", MessageType.None); } // FSM Name EditorGUILayout.BeginHorizontal(); fsm.Name = EditorGUILayout.TextField(fsm.Name); if (GUILayout.Button(new GUIContent(Strings.Label_Edit, Strings.Tooltip_Edit_in_the_PlayMaker_Editor), GUILayout.MaxWidth(45))) { OpenInEditor(fsmComponent); GUIUtility.ExitGUI(); } EditorGUILayout.EndHorizontal(); // FSM Template EditorGUILayout.BeginHorizontal(); var template = (FsmTemplate) EditorGUILayout.ObjectField(new GUIContent(Strings.Label_Use_Template, Strings.Tooltip_Use_Template), fsmComponent.FsmTemplate, typeof(FsmTemplate), false); if (template != fsmComponent.FsmTemplate) { fsmComponent.SetFsmTemplate(template); } if (GUILayout.Button(new GUIContent(Strings.Label_Browse, Strings.Tooltip_Browse_Templates), GUILayout.MaxWidth(45))) { DoSelectTemplateMenu(); } EditorGUILayout.EndHorizontal(); if (!Application.isPlaying && fsmComponent.FsmTemplate != null) { template = fsmComponent.FsmTemplate; fsm = template.fsm; GUI.enabled = false; } // Description fsm.Description = FsmEditorGUILayout.TextAreaWithHint(fsm.Description, Strings.Label_Description___, GUILayout.MinHeight(60)); // Help Url EditorGUILayout.BeginHorizontal(); fsm.DocUrl = FsmEditorGUILayout.TextFieldWithHint(fsm.DocUrl, Strings.Tooltip_Documentation_Url); var guiEnabled = GUI.enabled; GUI.enabled = !string.IsNullOrEmpty(fsm.DocUrl); if (FsmEditorGUILayout.HelpButton()) { Application.OpenURL(fsm.DocUrl); } EditorGUILayout.EndHorizontal(); GUI.enabled = guiEnabled; // Basic Settings fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, new GUIContent(Strings.Label_Reset_On_Disable, Strings.Tooltip_Reset_On_Disable)); fsm.ShowStateLabel = GUILayout.Toggle(fsm.ShowStateLabel, new GUIContent(Strings.Label_Show_State_Label, Strings.Tooltip_Show_State_Label)); fsm.EnableDebugFlow = GUILayout.Toggle(fsm.EnableDebugFlow, new GUIContent(Strings.FsmEditorSettings_Enable_DebugFlow, Strings.FsmEditorSettings_Enable_DebugFlow_Tooltip)); if (GUI.changed) { EditorUtility.SetDirty(fsmComponent); } GUI.enabled = true; // VARIABLES FsmEditorGUILayout.LightDivider(); showControls = EditorGUILayout.Foldout(showControls, new GUIContent(Strings.Label_Controls, Strings.Tooltip_Controls), FsmEditorStyles.CategoryFoldout); if (showControls) { //EditorGUIUtility.LookLikeInspector(); BuildFsmVariableList(); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { const string next = ":\n"; fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? next + fsmVar.Tooltip : ""))); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } // EVENTS if (showControls) { foreach (var fsmEvent in fsm.ExposedEvents) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(fsmEvent.Name); if (GUILayout.Button(fsmEvent.Name)) { fsm.Event(fsmEvent); FsmEditor.RepaintAll(); } GUILayout.EndHorizontal(); } } //INFO EditorGUI.indentLevel = 0; FsmEditorGUILayout.LightDivider(); showInfo = EditorGUILayout.Foldout(showInfo, Strings.Label_Info, FsmEditorStyles.CategoryFoldout); if (showInfo) { EditorGUI.indentLevel = 1; showStates = EditorGUILayout.Foldout(showStates, string.Format(Strings.Label_States_Count, fsm.States.Length)); if (showStates) { string states = ""; if (fsm.States.Length > 0) { foreach (var state in fsm.States) { states += FsmEditorStyles.tab2 + state.Name + FsmEditorStyles.newline; } states = states.Substring(0, states.Length - 1); } else { states = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, string.Format(Strings.Label_Events_Count, fsm.Events.Length)); if (showEvents) { var events = ""; if (fsm.Events.Length > 0) { foreach (var fsmEvent in fsm.Events) { events += FsmEditorStyles.tab2 + fsmEvent.Name + FsmEditorStyles.newline; } events = events.Substring(0, events.Length - 1); } else { events = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, string.Format(Strings.Label_Variables_Count, fsmVariables.Count)); if (showVariables) { var variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += FsmEditorStyles.tab2 + fsmVar.Name + FsmEditorStyles.newline; } variables = variables.Substring(0, variables.Length - 1); } else { variables = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(variables); } } }
public override void OnInspectorGUI() { LinkerData _target = target as LinkerData; FsmEditorStyles.Init(); //GUILayout.Box("Hello",FsmEditorStyles.LargeTitleWithLogo,GUILayout.Height(42f)); GUI.Box(new Rect(0f, 0f, Screen.width, 42f), "Linker Wizard", FsmEditorStyles.LargeTitleWithLogo); GUILayout.Label("1: Make sure you installed them actions"); if (GUILayout.Button("Install Actions")) { Debug.Log("importing package " + Application.dataPath + "/" + ActionsPackagePath); AssetDatabase.ImportPackage(Application.dataPath + "/" + ActionsPackagePath, true); } GUILayout.Label("2: Check 'debug' for tracking all reflections"); EditorGUI.indentLevel++; bool _debug = EditorGUILayout.Toggle("Debug", _target.debug); EditorGUI.indentLevel--; if (_debug != _target.debug) { _target.debug = _debug; EditorUtility.SetDirty(_target); } GUILayout.Label("3: Run your scenes from start to finish"); GUILayout.Label(" Check the preview below for usages as they come "); if (_target.linkerEntries.Count > 0) { GUILayout.Label("4: Update Linker xml file"); if (GUILayout.Button("Update Linker content")) { UpdateLinkerContent(_target); GUIUtility.ExitGUI(); } if (_target.LinkContentUpdateDone) { GUILayout.Label("5: You can now publish and test on device"); GUILayout.BeginHorizontal(); if (GUILayout.Button("Ping link.xml")) { EditorGUIUtility.PingObject(_target.Asset); } if (GUILayout.Button("Select link.xml")) { Selection.activeObject = _target.Asset; EditorGUIUtility.PingObject(_target.Asset); } GUILayout.EndHorizontal(); } } GUILayout.BeginHorizontal(GUILayout.Height(25)); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); FsmEditorGUILayout.Divider(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.Label("preview", GUILayout.ExpandWidth(false)); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); FsmEditorGUILayout.Divider(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); foreach (KeyValuePair <string, List <string> > entry in _target.linkerEntries) { GUILayout.Label(entry.Key); foreach (string _item in entry.Value) { GUILayout.Label(" " + _item); } } }
public override void OnInspectorGUI() { EditorGUIUtility.labelWidth = 210; FsmEditorStyles.Init(); GUILayout.Label(Strings.Label_NOTES, FsmEditorStyles.InspectorHeader); GUILayout.Label(Strings.Hint_PlayMakerGUI_Notes); GUILayout.Label(Strings.Label_General, FsmEditorStyles.InspectorHeader); guiComponent.enableGUILayout = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Enable_GUILayout, Strings.Tooltip_Enable_GUILayout), guiComponent.enableGUILayout); guiComponent.controlMouseCursor = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Control_Mouse_Cursor, Strings.Tooltip_Control_Mouse_Cursor), guiComponent.controlMouseCursor); guiComponent.previewOnGUI = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Preview_GUI_Actions_While_Editing, Strings.Tooltip_Preview_GUI_Actions_While_Editing), guiComponent.previewOnGUI); GUILayout.Label(Strings.Label_Debugging, FsmEditorStyles.InspectorHeader); var drawStateLabels = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Draw_Active_State_Labels, Strings.Tooltip_Draw_Active_State_Labels), guiComponent.drawStateLabels); if (drawStateLabels != guiComponent.drawStateLabels) { guiComponent.drawStateLabels = drawStateLabels; FsmEditorSettings.ShowStateLabelsInGameView = drawStateLabels; FsmEditorSettings.SaveSettings(); } GUI.enabled = guiComponent.drawStateLabels; var enableStateLabelsInBuilds = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Enable_State_Labels_in_Builds, Strings.Tooltip_Show_State_Labels_in_Standalone_Builds), guiComponent.enableStateLabelsInBuilds); if (enableStateLabelsInBuilds != guiComponent.enableStateLabelsInBuilds) { guiComponent.enableStateLabelsInBuilds = enableStateLabelsInBuilds; FsmEditorSettings.ShowStateLabelsInBuild = enableStateLabelsInBuilds; FsmEditorSettings.SaveSettings(); } #if !UNITY_2019_3_OR_NEWER guiComponent.GUITextureStateLabels = EditorGUILayout.Toggle(new GUIContent(Strings.Label_GUITexture_State_Labels, Strings.Tooltip_GUITexture_State_Labels), guiComponent.GUITextureStateLabels); guiComponent.GUITextStateLabels = EditorGUILayout.Toggle(new GUIContent(Strings.Label_GUIText_State_Labels, Strings.Tooltip_GUIText_State_Labels), guiComponent.GUITextStateLabels); #endif GUI.enabled = true; guiComponent.filterLabelsWithDistance = EditorGUILayout.Toggle(new GUIContent(Strings.Label_Filter_State_Labels_With_Distance, Strings.Tooltip_Filter_State_Labels_With_Distance), guiComponent.filterLabelsWithDistance); GUI.enabled = guiComponent.filterLabelsWithDistance; guiComponent.maxLabelDistance = EditorGUILayout.FloatField(new GUIContent(Strings.Label_Camera_Distance, Strings.Tooltip_Camera_Distance), guiComponent.maxLabelDistance); GUI.enabled = true; guiComponent.labelScale = EditorGUILayout.FloatField(new GUIContent(Strings.Label_State_Label_Scale, Strings.Tooltip_State_Label_Scale), guiComponent.labelScale); if (guiComponent.labelScale < 0.1f) { guiComponent.labelScale = 0.1f; } if (guiComponent.labelScale > 10f) { guiComponent.labelScale = 10f; } if (GUI.changed) { CheckForDuplicateComponents(); } }
public void OnGUI() { wantsMouseMove = true; if (Event.current.type == EventType.MouseMove) { Repaint(); } if (isCompiling != EditorApplication.isCompiling) { isCompiling = EditorApplication.isCompiling; } FsmEditorStyles.Init(); // set style ot use rich text. if (labelStyle == null) { labelStyle = GUI.skin.GetStyle("Label"); labelStyle.richText = true; } FsmEditorGUILayout.ToolWindowLargeTitle(this, "Event Proxy Creator"); // for the banner odd bug on height GUILayout.Space(15); GUILayout.Label("This wizard lets you create a Component with a public method.\n" + "When this method is called, it will send a PlayMaker event.\n" + "You can define this PlayMaker event in the component Inspector.\n" + "\nUse this when you expect Unity or third parties to fire messages\n" + "and you want to catch that message as a PlayMaker Event"); FsmEditorGUILayout.Divider(); OnGUI_DoDefinitionForm(); FsmEditorGUILayout.Divider(); OnGUI_DoProxyList(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (isCompiling) { GUILayout.Label("Unity is compiling, please wait"); } else { GUILayout.Label(" "); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { if (fsmComponent == null) { return; // shouldn't happen } FsmEditorStyles.Init(); var fsm = fsmComponent.Fsm; // grab Fsm for convenience if (fsm.States.Length > 100) // a little arbitrary, but better than nothing! { EditorGUILayout.HelpBox("NOTE: Collapse this inspector for better editor performance with large FSMs.", MessageType.None); } // Edit FSM name EditorGUILayout.BeginHorizontal(); fsm.Name = EditorGUILayout.TextField(fsm.Name); if (GUILayout.Button(new GUIContent(Strings.Label_Edit, Strings.Tooltip_Edit_in_the_PlayMaker_Editor), GUILayout.MaxWidth(45))) { OpenInEditor(fsmComponent); GUIUtility.ExitGUI(); } EditorGUILayout.EndHorizontal(); // Edit FSM Template EditorGUILayout.BeginHorizontal(); var template = (FsmTemplate) EditorGUILayout.ObjectField(new GUIContent(Strings.Label_Use_Template, Strings.Tooltip_Use_Template), fsmComponent.FsmTemplate, typeof(FsmTemplate), false); if (template != fsmComponent.FsmTemplate) { SelectTemplate(template); } if (GUILayout.Button(new GUIContent(Strings.Label_Browse, Strings.Tooltip_Browse_Templates), GUILayout.MaxWidth(45))) { DoSelectTemplateMenu(); } EditorGUILayout.EndHorizontal(); // Disable GUI that can't be edited if referencing a template if (!Application.isPlaying && fsmComponent.FsmTemplate != null) { template = fsmComponent.FsmTemplate; fsm = template.fsm; GUI.enabled = false; } // Edit Description fsm.Description = FsmEditorGUILayout.TextAreaWithHint(fsm.Description, Strings.Label_Description___, GUILayout.MinHeight(60)); // Edit Help Url (lets the user link to documentation for the FSM) EditorGUILayout.BeginHorizontal(); fsm.DocUrl = FsmEditorGUILayout.TextFieldWithHint(fsm.DocUrl, Strings.Tooltip_Documentation_Url); var guiEnabled = GUI.enabled; GUI.enabled = !string.IsNullOrEmpty(fsm.DocUrl); if (FsmEditorGUILayout.HelpButton()) { Application.OpenURL(fsm.DocUrl); } EditorGUILayout.EndHorizontal(); GUI.enabled = guiEnabled; // Edit FSM Settings fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, new GUIContent(Strings.Label_Reset_On_Disable, Strings.Tooltip_Reset_On_Disable)); fsm.ShowStateLabel = GUILayout.Toggle(fsm.ShowStateLabel, new GUIContent(Strings.Label_Show_State_Label, Strings.Tooltip_Show_State_Label)); fsm.EnableDebugFlow = GUILayout.Toggle(fsm.EnableDebugFlow, new GUIContent(Strings.FsmEditorSettings_Enable_DebugFlow, Strings.FsmEditorSettings_Enable_DebugFlow_Tooltip)); // The rest of the GUI is readonly so we can check for changes here if (GUI.changed) { EditorUtility.SetDirty(fsmComponent); } // Controls Section GUI.enabled = true; // Show FSM variables with Inspector option checked FsmEditorGUILayout.LightDivider(); showControls = EditorGUILayout.Foldout(showControls, new GUIContent(Strings.Label_Controls, Strings.Tooltip_Controls), FsmEditorStyles.CategoryFoldout); if (showControls) { //EditorGUIUtility.LookLikeInspector(); BuildFsmVariableList(); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { EditorGUI.BeginChangeCheck(); fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? ":\n" + fsmVar.Tooltip : ""))); if (EditorGUI.EndChangeCheck()) { fsmVar.UpdateVariableValue(); } } } if (GUI.changed) { FsmEditor.RepaintAll(); } } // Show events with Inspector option checked // These become buttons that the user can press to send the events if (showControls) { foreach (var fsmEvent in fsm.ExposedEvents) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(fsmEvent.Name); if (GUILayout.Button(fsmEvent.Name)) { fsm.Event(fsmEvent); FsmEditor.RepaintAll(); } GUILayout.EndHorizontal(); } } // Show general info about the FSM EditorGUI.indentLevel = 0; FsmEditorGUILayout.LightDivider(); showInfo = EditorGUILayout.Foldout(showInfo, Strings.Label_Info, FsmEditorStyles.CategoryFoldout); if (showInfo) { EditorGUI.indentLevel = 1; showStates = EditorGUILayout.Foldout(showStates, string.Format(Strings.Label_States_Count, fsm.States.Length)); if (showStates) { string states = ""; if (fsm.States.Length > 0) { foreach (var state in fsm.States) { states += FsmEditorStyles.tab2 + state.Name + FsmEditorStyles.newline; } states = states.Substring(0, states.Length - 1); } else { states = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, string.Format(Strings.Label_Events_Count, fsm.Events.Length)); if (showEvents) { var events = ""; if (fsm.Events.Length > 0) { foreach (var fsmEvent in fsm.Events) { events += FsmEditorStyles.tab2 + fsmEvent.Name + FsmEditorStyles.newline; } events = events.Substring(0, events.Length - 1); } else { events = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, string.Format(Strings.Label_Variables_Count, fsmVariables.Count)); if (showVariables) { var variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += FsmEditorStyles.tab2 + fsmVar.Name + FsmEditorStyles.newline; } variables = variables.Substring(0, variables.Length - 1); } else { variables = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; } GUILayout.Label(variables); } } // Manual refresh if template has been edited if (fsmTemplate != null) { if (GUILayout.Button(new GUIContent("Refresh Template", "Use this if you've updated the template but don't see the changes here."))) { RefreshTemplate(); } } }
public override void DoGUI() { FsmEditorStyles.Init(); GUILayout.BeginVertical(); FsmEditorGUILayout.PlaymakerHeader(this); GUILayout.Label(FsmEditorSettings.ProductCopyright, EditorStyles.miniLabel); GUILayout.Label(!EditorApp.IsSourceCodeVersion ? string.Format(Strings.AboutPlaymaker_Version_Info, VersionInfo.GetAssemblyInformationalVersion()) : "Source Code Version"); if (VersionInfo.PlayMakerVersionInfo != "") { EditorGUILayout.HelpBox(VersionInfo.PlayMakerVersionInfo, MessageType.None); } // Some actions use render pipeline defines // E.g., Set Material Color uses _BaseColor instead of _Color #if PLAYMAKER_URP GUILayout.Label("Render Pipeline: URP"); #elif PLAYMAKER_HDRP GUILayout.Label("Render Pipeline: HDRP"); #else GUILayout.Label("Render Pipeline: Built-in"); #endif #if PLAYMAKER_TMPRO // Some actions use this define to support TextMeshPro features. GUILayout.Label("TextMeshPro support enabled."); #endif EditorGUILayout.HelpBox(string.Format(Strings.AboutPlaymaker_Special_Thanks, "Erin Ko, Jean Fabre, DjayDino, Lane Fox, Stephen Scott Day, Kemal Amarasingham, Bruce Blumberg, " + "Steve Gargolinski, Lee Hepler, Bart Simon, Lucas Meijer, Joachim Ante, " + "Jaydee Alley, James Murchison, XiaoHang Zheng, Andrzej Łukasik, " + "Vanessa Wesley, Marek Ledvina, Bob Berkebile, MaDDoX, gamesonytablet, " + "Marc 'Dreamora' Schaerer, Eugenio 'Ryo567' Martínez, Steven 'Nightreaver' Barthen, " + "Damiangto, VisionaiR3D, 黄峻, Nilton Felicio, Andre Dantas Lima, " + "Ramprasad Madhavan, and the PlayMaker Community!\r\n"), MessageType.None); if (GUILayout.Button(Strings.AboutPlaymaker_Release_Notes)) { EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes); } if (GUILayout.Button(Strings.AboutPlaymaker_Hutong_Games_Link)) { Application.OpenURL(FsmEditorSettings.ProductUrl); } GUILayout.Space(5); GUILayout.EndVertical(); if (!heightHasBeenSet && Event.current.type == EventType.Repaint) { SetWindowHeightToFitContents(); } }
public override void OnInspectorGUI() { //EditorGUIUtility.LookLikeControls(); // can happen when playmaker is updated...? if (fsmComponent == null) { return; } var fsm = fsmComponent.Fsm; // Make sure common PlayMaker styles are initialized // TODO: Remove this dependency so Inspector is lighter weight? if (!FsmEditorStyles.IsInitialized()) { FsmEditorStyles.Init(); } // Begin GUI EditorGUILayout.BeginHorizontal(); // Edit FSM name fsm.Name = EditorGUILayout.TextField(fsm.Name); // Open PlayMaker editor button if (GUILayout.Button(new GUIContent("Edit", "Edit in the PlayMaker FSM Editor"), GUILayout.MaxWidth(45))) { OpenInEditor(fsmComponent); GUIUtility.ExitGUI(); } EditorGUILayout.EndHorizontal(); // Description fsm.Description = FsmEditorGUILayout.TextAreaWithHint(fsm.Description, "Description...", GUILayout.MinHeight(60)); // Help Url EditorGUILayout.BeginHorizontal(); fsm.DocUrl = FsmEditorGUILayout.TextFieldWithHint(fsm.DocUrl, "Documentation Url..."); var guiEnabled = GUI.enabled; if (string.IsNullOrEmpty(fsm.DocUrl)) { GUI.enabled = false; } if (FsmEditorGUILayout.HelpButton()) { Application.OpenURL(fsm.DocUrl); } EditorGUILayout.EndHorizontal(); GUI.enabled = guiEnabled; // Basic Settings /* if (GUILayout.Button(WatermarkLabel, EditorStyles.popup)) * { * GenerateWatermarkMenu().ShowAsContext(); * } */ fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, new GUIContent("Reset On Disable", "Should the FSM reset or keep its current state on Enable/Disable. Uncheck this if you want to pause an FSM by enabling/disabling the PlayMakerFSM component.")); fsm.ShowStateLabel = GUILayout.Toggle(fsm.ShowStateLabel, new GUIContent("Show State Label", "Show active state label in game view.\nNOTE: Requires PlayMakerGUI in scene")); fsm.EnableDebugFlow = GUILayout.Toggle(fsm.EnableDebugFlow, new GUIContent("Enable Debug Flow", "Enable caching of variables and other state info while the game is running. NOTE: Disabling this can improve performance in the editor (it is always disabled in standalone builds).")); // VARIABLES FsmEditorGUILayout.LightDivider(); showControls = EditorGUILayout.Foldout(showControls, new GUIContent("Controls", "FSM Variables and Events exposed in the Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { //EditorGUIUtility.LookLikeInspector(); BuildFsmVariableList(); foreach (var fsmVar in fsmVariables) { if (fsmVar.ShowInInspector) { fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? ":\n" + fsmVar.Tooltip : ""))); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } // EVENTS //FsmEditorGUILayout.LightDivider(); //showExposedEvents = EditorGUILayout.Foldout(showExposedEvents, new GUIContent("Events", "To expose events here:\nIn PlayMaker Editor, Events tab, select an event and check Inspector."), FsmEditorStyles.CategoryFoldout); if (showControls) { EditorGUI.indentLevel = 1; //GUI.enabled = Application.isPlaying; foreach (var fsmEvent in fsm.ExposedEvents) { if (GUILayout.Button(fsmEvent.Name)) { fsm.Event(fsmEvent); } } if (GUI.changed) { FsmEditor.RepaintAll(); } } //GUI.enabled = true; //INFO EditorGUI.indentLevel = 0; FsmEditorGUILayout.LightDivider(); showInfo = EditorGUILayout.Foldout(showInfo, "Info", FsmEditorStyles.CategoryFoldout); if (showInfo) { EditorGUI.indentLevel = 1; //FsmEditorGUILayout.LightDivider(); //GUILayout.Label("Summary", EditorStyles.boldLabel); showStates = EditorGUILayout.Foldout(showStates, "States [" + fsmComponent.FsmStates.Length + "]"); if (showStates) { string states = ""; if (fsmComponent.FsmStates.Length > 0) { foreach (var state in fsmComponent.FsmStates) { states += "\t\t" + state.Name + "\n"; } states = states.Substring(0, states.Length - 1); } else { states = "\t\t[none]"; } GUILayout.Label(states); } showEvents = EditorGUILayout.Foldout(showEvents, "Events [" + fsmComponent.FsmEvents.Length + "]"); if (showEvents) { string events = ""; if (fsmComponent.FsmEvents.Length > 0) { foreach (var fsmEvent in fsmComponent.FsmEvents) { events += "\t\t" + fsmEvent.Name + "\n"; } events = events.Substring(0, events.Length - 1); } else { events = "\t\t[none]"; } GUILayout.Label(events); } showVariables = EditorGUILayout.Foldout(showVariables, "Variables [" + fsmVariables.Count + "]"); if (showVariables) { string variables = ""; if (fsmVariables.Count > 0) { foreach (var fsmVar in fsmVariables) { variables += "\t\t" + fsmVar.Name + "\n"; } variables = variables.Substring(0, variables.Length - 1); } else { variables = "\t\t[none]"; } GUILayout.Label(variables); } } }
public override void OnInspectorGUI() { if (fsmComponent == null) { return; // shouldn't happen } if (!initialized) { Initialize(); } if (!fsmComponent.Fsm.Initialized) { // Note: cannot do this in OnEnable since is breaks FSMs in editor // Safe to do now since FSM would already have initialized itself fsmComponent.Fsm.Init(fsmComponent); } FsmEditorStyles.Init(); var fsm = fsmComponent.Fsm; // grab Fsm for convenience if (fsm.States.Length > 50) // a little arbitrary, but better than nothing! { EditorGUILayout.HelpBox("NOTE: Collapse this inspector for better editor performance with large FSMs.", MessageType.None); } // Edit FSM name EditorGUILayout.BeginHorizontal(); var foldoutRect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.foldout, GUILayout.Width(0)); fsm.NameIsExpanded = EditorGUI.Foldout(foldoutRect, fsm.NameIsExpanded, GUIContent.none); EditorGUI.BeginChangeCheck(); fsm.Name = EditorGUILayout.TextField(fsm.Name); if (EditorGUI.EndChangeCheck()) { Labels.Update(fsm); } // Edit FSM Button if (GUILayout.Button(FsmEditorContent.EditFsmButton, GUILayout.MaxWidth(45))) { OpenInEditor(fsmComponent); GUIUtility.ExitGUI(); } EditorGUILayout.EndHorizontal(); if (fsm.NameIsExpanded) { // Edit FSM Template EditorGUILayout.BeginHorizontal(); var template = (FsmTemplate)EditorGUILayout.ObjectField(FsmEditorContent.UseTemplateLabel, fsmComponent.FsmTemplate, typeof(FsmTemplate), false); if (template != fsmComponent.FsmTemplate) { SelectTemplate(template); } if (GUILayout.Button(FsmEditorContent.BrowseTemplateButton, GUILayout.MaxWidth(45))) { DoSelectTemplateMenu(); } EditorGUILayout.EndHorizontal(); // Disable GUI that can't be edited if referencing a template EditorGUI.BeginDisabledGroup(!Application.isPlaying && fsmComponent.FsmTemplate != null); if (fsmComponent.FsmTemplate != null) { // next few fields should show template values template = fsmComponent.FsmTemplate; fsm = template.fsm; } // Edit Description fsm.Description = FsmEditorGUILayout.TextAreaWithHint(fsm.Description, Strings.Label_Description___, GUILayout.MinHeight(60)); // Edit Help Url (lets the user link to documentation for the FSM) EditorGUILayout.BeginHorizontal(); fsm.DocUrl = FsmEditorGUILayout.TextFieldWithHint(fsm.DocUrl, Strings.Tooltip_Documentation_Url); EditorGUI.BeginDisabledGroup(!string.IsNullOrEmpty(fsm.DocUrl)); if (FsmEditorGUILayout.HelpButton()) { Application.OpenURL(fsm.DocUrl); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); // Settings EditorGUI.BeginDisabledGroup(!Application.isPlaying && FsmEditor.SelectedFsmUsesTemplate); fsm.MaxLoopCountOverride = EditorGUILayout.IntField(FsmEditorContent.MaxLoopOverrideLabel, fsm.MaxLoopCountOverride); fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, FsmEditorContent.ResetOnDisableLabel); EditorGUI.EndDisabledGroup(); // Settings EditorGUI.EndDisabledGroup(); // Uses template // stop showing template values fsm = fsmComponent.Fsm; } // Controls Section // Show FSM variables with Inspector option checked FsmEditorGUILayout.LightDivider(); fsm.ControlsIsExpanded = EditorGUILayout.Foldout(fsm.ControlsIsExpanded, FsmEditorContent.FsmControlsLabel, FsmEditorStyles.CategoryFoldout); if (fsm.ControlsIsExpanded) { BuildFsmVariableList(); var currentCategory = 0; for (var index = 0; index < fsmVariables.Count; index++) { var fsmVariable = fsmVariables[index]; if (fsmVariable.ShowInInspector) { var categoryID = fsmVariable.CategoryID; if (categoryID > 0 && categoryID != currentCategory) { currentCategory = categoryID; GUILayout.Label(fsmComponent.Fsm.Variables.Categories[categoryID], EditorStyles.boldLabel); FsmEditorGUILayout.LightDivider(); } fsmVariable.DoInspectorGUI(FsmEditorContent.TempContent(fsmVariable.Name, fsmVariable.Name + (!string.IsNullOrEmpty(fsmVariable.Tooltip) ? ":\n" + fsmVariable.Tooltip : ""))); } } } // Show events with Inspector option checked // These become buttons that the user can press to send the events if (fsm.ControlsIsExpanded) { foreach (var fsmEvent in fsm.ExposedEvents) { //GUILayout.BeginHorizontal(); //EditorGUILayout.PrefixLabel(fsmEvent.Name); if (GUILayout.Button(fsmEvent.Name)) { fsm.Event(fsmEvent); FsmEditor.RepaintAll(); } //GUILayout.EndHorizontal(); } } // DEBUG FsmEditorGUILayout.LightDivider(); fsm.DebugIsExpanded = EditorGUILayout.Foldout(fsm.DebugIsExpanded, "Debug", FsmEditorStyles.CategoryFoldout); if (fsm.DebugIsExpanded) { fsm.ShowStateLabel = GUILayout.Toggle(fsm.ShowStateLabel, FsmEditorContent.ShowStateLabelsLabel); } // Experimental // Hide for now /* * FsmEditorGUILayout.LightDivider(); * fsm.ExperimentalIsExpanded = EditorGUILayout.Foldout(fsm.ExperimentalIsExpanded, "Experimental", FsmEditorStyles.CategoryFoldout); * if (fsm.ExperimentalIsExpanded) * { * fsm.KillDelayedEventsOnStateExit = GUILayout.Toggle(fsm.KillDelayedEventsOnStateExit, FsmEditorContent.KillDelayedEvents); * }*/ #region INFO // Show general info about the FSM /* Is this useful...? * EditorGUI.indentLevel = 0; * FsmEditorGUILayout.LightDivider(); * showInfo = EditorGUILayout.Foldout(showInfo, Strings.Label_Info, FsmEditorStyles.CategoryFoldout); * if (showInfo) * { * EditorGUI.indentLevel = 1; * * showStates = EditorGUILayout.Foldout(showStates, string.Format(Strings.Label_States_Count, fsm.States.Length)); * if (showStates) * { * string states = ""; * * if (fsm.States.Length > 0) * { * foreach (var state in fsm.States) * { * states += FsmEditorStyles.tab2 + state.Name + FsmEditorStyles.newline; * } * states = states.Substring(0, states.Length - 1); * } * else * { * states = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; * } * GUILayout.Label(states); * } * * showEvents = EditorGUILayout.Foldout(showEvents, string.Format(Strings.Label_Events_Count, fsm.Events.Length)); * if (showEvents) * { * var events = ""; * * if (fsm.Events.Length > 0) * { * foreach (var fsmEvent in fsm.Events) * { * events += FsmEditorStyles.tab2 + fsmEvent.Name + FsmEditorStyles.newline; * } * events = events.Substring(0, events.Length - 1); * } * else * { * events = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; * } * GUILayout.Label(events); * } * * showVariables = EditorGUILayout.Foldout(showVariables, string.Format(Strings.Label_Variables_Count, fsmVariables.Count)); * if (showVariables) * { * var variables = ""; * * if (fsmVariables.Count > 0) * { * foreach (var fsmVar in fsmVariables) * { * variables += FsmEditorStyles.tab2 + fsmVar.Name + FsmEditorStyles.newline; * } * variables = variables.Substring(0, variables.Length - 1); * } * else * { * variables = FsmEditorStyles.tab2 + Strings.Label_None_In_Table; * } * GUILayout.Label(variables); * } * }*/ #endregion // Manual refresh if template has been edited if (fsmTemplate != null) { if (GUILayout.Button(FsmEditorContent.RefreshTemplateLabel)) { RefreshTemplate(); } } if (GUI.changed) { EditorUtility.SetDirty(fsmComponent); FsmEditor.RepaintAll(); } }