Esempio n. 1
0
        private static void TransitionTools()
        {
            ToolWindow.Header(Strings.get_ToolWindow_Header_Transition_Tools());
            SkillState      selectedState      = SkillEditor.SelectedState;
            SkillTransition selectedTransition = SkillEditor.SelectedTransition;

            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label(Strings.get_Label_Event(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(40f)
            });
            if (GUILayout.Button(Labels.GetEventLabel(selectedTransition), EditorStyles.get_popup(), new GUILayoutOption[0]))
            {
                ToolWindow.editingTransition = selectedTransition;
                SkillEditorGUILayout.GenerateEventSelectionMenu(SkillEditor.SelectedFsm, selectedTransition.get_FsmEvent(), new GenericMenu.MenuFunction2(ToolWindow.SelectEvent), new GenericMenu.MenuFunction(SkillEditor.OpenEventManager)).ShowAsContext();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label(Strings.get_Label_State(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(40f)
            });
            if (GUILayout.Button(Labels.GetStateLabel(selectedTransition.get_ToState()), EditorStyles.get_popup(), new GUILayoutOption[0]))
            {
                ToolWindow.editingTransition = selectedTransition;
                SkillEditorGUILayout.GenerateStateSelectionMenu(SkillEditor.SelectedFsm, selectedTransition.get_ToState(), new GenericMenu.MenuFunction2(ToolWindow.SelectToState)).ShowAsContext();
            }
            GUILayout.EndHorizontal();
            if (GUILayout.Button(Strings.get_Command_Delete(), new GUILayoutOption[0]))
            {
                EditorCommands.DeleteTransition(selectedState, selectedTransition);
                SkillEditor.Selection.SelectTransition(null);
                SkillEditor.RepaintAll();
            }
        }
Esempio n. 2
0
 public static void PreviewVersion()
 {
     if (EditorUtility.DisplayDialog(Strings.get_Dialogs_PREVIEW_VERSION(), Strings.get_Dialogs_PreviewVersion_Note(), "HutongGames.com", Strings.get_Label_OK()))
     {
         EditorCommands.OpenProductWebPage();
     }
 }
Esempio n. 3
0
 public override void DoGUI()
 {
     SkillEditorStyles.Init();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     SkillEditorGUILayout.PlaymakerHeader(this);
     GUILayout.Label(FsmEditorSettings.ProductCopyright, EditorStyles.get_miniLabel(), new GUILayoutOption[0]);
     GUILayout.Label((!EditorApp.IsSourceCodeVersion) ? string.Format(Strings.get_AboutPlaymaker_Version_Info(), VersionInfo.GetAssemblyInformationalVersion()) : "Source Code Version", new GUILayoutOption[0]);
     if (VersionInfo.PlayMakerVersionInfo != "")
     {
         EditorGUILayout.HelpBox(VersionInfo.PlayMakerVersionInfo, 0);
     }
     EditorGUILayout.HelpBox(string.Format(Strings.get_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"), 0);
     if (GUILayout.Button(Strings.get_AboutPlaymaker_Release_Notes(), new GUILayoutOption[0]))
     {
         EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes);
     }
     if (GUILayout.Button(Strings.get_AboutPlaymaker_Hutong_Games_Link(), new GUILayoutOption[0]))
     {
         Application.OpenURL("http://hutonggames.com/");
     }
     GUILayout.Space(5f);
     GUILayout.EndVertical();
     if (!AboutPlaymaker.heightHasBeenSet && Event.get_current().get_type() == 7)
     {
         this.SetWindowHeightToFitContents();
     }
 }
Esempio n. 4
0
        private static void SelectToState(object userdata)
        {
            string toState = userdata as string;

            EditorCommands.SetTransitionTarget(ToolWindow.editingTransition, toState);
            SkillEditor.RepaintAll();
        }
Esempio n. 5
0
        private static void SelectEvent(object userdata)
        {
            SkillEvent fsmEvent = userdata as SkillEvent;

            EditorCommands.SetTransitionEvent(ToolWindow.editingTransition, fsmEvent);
            SkillEditor.RepaintAll();
        }
 public static void ToggleBreakpointOnSelectedState()
 {
     if (SkillEditor.SelectedState == null)
     {
         return;
     }
     EditorCommands.ToggleBreakpoint(SkillEditor.SelectedState);
 }
 public static void Update()
 {
     if (FsmInspector.chooseWatermark)
     {
         FsmInspector.chooseWatermark = false;
         EditorCommands.ChooseWatermark();
     }
 }
Esempio n. 8
0
 private void AddSelectedEventToState()
 {
     if (this.selectedEvent == null || SkillEditor.SelectedFsm == null || SkillEditor.SelectedFsm.HasEvent(this.selectedEvent.get_Name()))
     {
         return;
     }
     EditorCommands.AddEvent(this.selectedEvent.get_Name());
     SkillEditor.Inspector.ResetView();
 }
Esempio n. 9
0
        private static void AddTemplateToFsm()
        {
            if (SkillEditor.SelectedFsm == null)
            {
                return;
            }
            Vector2 viewCenter = FsmGraphView.GetViewCenter();

            EditorCommands.PasteTemplate(viewCenter);
        }
Esempio n. 10
0
        public static bool OpenWikiPage(string topic)
        {
            int wikiPageNumber = EditorCommands.GetWikiPageNumber(topic);

            if (wikiPageNumber > 0)
            {
                EditorCommands.OpenWikiPage(wikiPageNumber);
                return(true);
            }
            return(false);
        }
Esempio n. 11
0
        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();
            }
        }
Esempio n. 12
0
 private void AddEvent(string eventName)
 {
     if (eventName.Replace(" ", "") == "")
     {
         EditorApplication.Beep();
         EditorUtility.DisplayDialog(Strings.get_Label_Add_Event(), Strings.get_Error_Invalid_Name(), Strings.get_OK());
         return;
     }
     EditorCommands.AddEvent(eventName);
     this.Reset();
 }
Esempio n. 13
0
        private void DoBottomPanel()
        {
            SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
            if (this.selectedAction != null)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(Labels.GetActionLabel(this.selectedAction), SkillEditorStyles.ActionPreviewTitle, new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(base.get_position().get_width() - 30f)
                });
                GUILayout.FlexibleSpace();
                if (SkillEditorGUILayout.HelpButton("Online Help"))
                {
                    EditorCommands.OpenWikiPage(this.previewAction);
                }
                GUILayout.EndHorizontal();
                string tooltip = Actions.GetTooltip(this.selectedAction);
                GUILayout.Box(tooltip, SkillEditorStyles.LabelWithWordWrap, new GUILayoutOption[0]);
                if (Event.get_current().get_type() == 7)
                {
                    this.descriptionHeight = GUILayoutUtility.GetLastRect().get_height();
                }
                ActionEditor.PreviewMode = true;
                EditorGUILayout.Space();
                SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
                if (FsmEditorSettings.ShowActionPreview)
                {
                    this.DoSelectedActionPreview();
                }
                ActionEditor.PreviewMode = false;
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool flag = GUILayout.Toggle(FsmEditorSettings.ShowActionPreview, Strings.get_ActionSelector_Preview(), new GUILayoutOption[0]);

            if (flag != FsmEditorSettings.ShowActionPreview)
            {
                FsmEditorSettings.ShowActionPreview = flag;
                FsmEditorSettings.SaveSettings();
            }
            EditorGUI.BeginDisabledGroup(SkillEditor.SelectedState == null || this.selectedAction == null || FsmGraphView.EditingDisable);
            if (GUILayout.Button(new GUIContent(Strings.get_ActionSelector_Add_Action_To_State(), Strings.get_ActionSelector_Add_Action_To_State_Tooltip()), new GUILayoutOption[0]))
            {
                this.AddSelectedActionToState();
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }
Esempio n. 14
0
        public static void OpenWikiPage(SkillStateAction action)
        {
            HelpUrlAttribute attribute = CustomAttributeHelpers.GetAttribute <HelpUrlAttribute>(action.GetType());

            if (attribute != null)
            {
                Application.OpenURL(attribute.get_Url());
                return;
            }
            string topic = Labels.StripNamespace(action.ToString());

            if (!EditorCommands.OpenWikiPage(topic))
            {
                EditorCommands.SearchWikiHelp(action);
            }
        }
Esempio n. 15
0
 private static void FsmTools()
 {
     ToolWindow.Header(Strings.get_ToolWindow_Header_FSM_Tools());
     if (GUILayout.Button(Strings.get_Command_Add_New_State(), new GUILayoutOption[0]))
     {
         SkillEditor.GraphView.AddState(FsmGraphView.GetViewCenter());
         SkillEditor.RepaintAll();
     }
     EditorGUI.BeginDisabledGroup(!SkillEditor.Builder.CanPaste());
     if (GUILayout.Button(Strings.get_Command_Paste_States(), new GUILayoutOption[0]))
     {
         EditorCommands.PasteStates(FsmGraphView.GetViewCenter());
         SkillEditor.RepaintAll();
     }
     EditorGUI.EndDisabledGroup();
 }
Esempio n. 16
0
        public static void CaptureStateInspectorAction(Rect region, string actionName, int actionIndex)
        {
            if (DocHelpers.sw == null)
            {
                Debug.LogError("Must call StartStateActionListCapture first!");
                return;
            }
            Debug.Log("CaptureStateInspectorAction: " + actionName);
            string text = Labels.StripNamespace(actionName);

            actionName = string.Concat(new object[]
            {
                SkillEditor.SelectedFsmGameObject.get_name(),
                "_",
                SkillEditor.SelectedFsm.get_Name(),
                "_",
                SkillEditor.SelectedState.get_Name(),
                "_",
                actionIndex,
                "_",
                text
            });
            region.set_x(region.get_x() + (SkillEditor.Window.get_position().get_x() + SkillEditor.Inspector.View.get_x()));
            region.set_y(region.get_y() + (SkillEditor.Window.get_position().get_y() + SkillEditor.Inspector.View.get_y() + 43f));
            DocHelpers.CaptureRegion(region, "C:\\ActionScreens\\SampleScreens\\", actionName);
            DocHelpers.sw.WriteLine("<tr>");
            string text2          = "https://hutonggames.fogbugz.com/default.asp?";
            int    wikiPageNumber = EditorCommands.GetWikiPageNumber(text);

            if (wikiPageNumber > 0)
            {
                text2 = text2 + "W" + wikiPageNumber;
            }
            else
            {
                text2 = text2 + "ixWiki=1&pg=pgSearchWiki&qWiki=" + text;
            }
            DocHelpers.sw.WriteLine("<td width=\"301px\"><a href = \"" + text2 + "\">");
            DocHelpers.sw.WriteLine("<div id=\"actionSample\"><img src=\"http://hutonggames.com/docs/img/" + actionName + ".png\" title=\"\" /></div>");
            DocHelpers.sw.WriteLine("</a></td>");
            DocHelpers.sw.WriteLine("<td><p><strong>" + Labels.NicifyVariableName(text) + "</strong></p>");
            DocHelpers.sw.WriteLine("<p>TODO</p></td>");
            DocHelpers.sw.WriteLine("</tr>");
        }
Esempio n. 17
0
        private void DoEventLine(SkillEvent fsmEvent)
        {
            int eventUseCount = SkillSearch.GetEventUseCount(SkillEditor.SelectedFsm, fsmEvent.get_Name());

            GUILayout.BeginHorizontal((this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.SelectedEventBox : SkillEditorStyles.TableRowBox, new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent());
            bool flag = GUILayout.Toggle(fsmEvent.get_IsGlobal(), SkillEditorContent.GlobalEventTooltipLabel, SkillEditorStyles.TableRowCheckBox, new GUILayoutOption[]
            {
                GUILayout.MaxWidth(17f),
                GUILayout.MinWidth(17f)
            });

            if (flag != fsmEvent.get_IsGlobal())
            {
                SkillEditor.Builder.SetEventIsGlobal(SkillEditor.SelectedFsm, fsmEvent, flag);
                GlobalEventsWindow.ResetView();
            }
            EditorGUI.EndDisabledGroup();
            GUIStyle gUIStyle = (this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText;

            if (GUILayout.Button(fsmEvent.get_Name(), gUIStyle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(244f)
            }))
            {
                this.SelectEvent(fsmEvent, true);
                GUIUtility.set_keyboardControl(0);
                if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey())
                {
                    this.GenerateStateListMenu(this.selectedEvent).ShowAsContext();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.Label(eventUseCount.ToString(CultureInfo.get_CurrentCulture()), gUIStyle, new GUILayoutOption[0]);
            GUILayout.Space(5f);
            if (SkillEditorGUILayout.DeleteButton())
            {
                EditorCommands.DeleteEvent(fsmEvent);
                this.Reset();
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 18
0
        private void DoBottomPanel()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool enabled = GUI.get_enabled();

            if (SkillEditor.SelectedFsm == null || this.selectedEvent == null || SkillEditor.SelectedFsm.HasEvent(this.selectedEvent.get_Name()))
            {
                GUI.set_enabled(false);
            }
            if (GUILayout.Button(Strings.get_Command_Add_Selected_Event_To_FSM(), new GUILayoutOption[0]))
            {
                this.AddSelectedEventToState();
            }
            GUI.set_enabled(enabled);
            if (SkillEditorGUILayout.HelpButton("Online Help"))
            {
                EditorCommands.OpenWikiPage(WikiPages.EventBrowser);
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }
Esempio n. 19
0
        private static NamedVariable VariableToggle(NamedVariable variable, string label)
        {
            bool flag = VariableEditor.VariableToggle(variable.get_UseVariable());

            if (flag != variable.get_UseVariable())
            {
                if (!flag)
                {
                    return(SkillVariable.GetNewVariableOfSameType(variable));
                }
                variable.set_UseVariable(true);
                variable.set_Name(null);
                if (EditorGUI.get_actionKey())
                {
                    return(EditorCommands.AddVariable(SkillVariable.GetVariableType(variable), label.Trim(new char[]
                    {
                        '*'
                    }).ToCamelCase()));
                }
            }
            return(variable);
        }
 public static bool ToolWindowsCommonGUI(EditorWindow window)
 {
     if (SkillEditor.Instance == null)
     {
         window.Close();
         return(false);
     }
     if (SkillEditorGUILayout.DoToolWindowsDisabledGUI())
     {
         return(false);
     }
     if (EditorApplication.get_isCompiling())
     {
         GUI.set_enabled(false);
     }
     SkillEditorStyles.Init();
     if (Event.get_current().get_type() == 4 && Event.get_current().get_keyCode() == 282)
     {
         EditorCommands.ToggleShowHints();
         return(false);
     }
     EditorGUI.set_indentLevel(0);
     return(true);
 }
Esempio n. 21
0
 private static void OpenOnlineHelp()
 {
     EditorCommands.OpenWikiPage(WikiPages.VariableManager);
 }
Esempio n. 22
0
        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();
            }
        }
Esempio n. 23
0
        private static void StateTools()
        {
            ToolWindow.Header(Strings.get_ToolWindow_Header_State_Tools());
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (GUILayout.Button(Strings.get_Command_Copy(), new GUILayoutOption[0]))
            {
                EditorCommands.CopyStateSelection();
            }
            EditorGUI.BeginDisabledGroup(!SkillEditor.Builder.CanPaste());
            if (GUILayout.Button(Strings.get_Command_Paste(), new GUILayoutOption[0]))
            {
                EditorCommands.PasteStates(FsmGraphView.GetViewCenter());
                SkillEditor.RepaintAll();
            }
            EditorGUI.EndDisabledGroup();
            if (GUILayout.Button(Strings.get_Command_Delete(), new GUILayoutOption[0]))
            {
                SkillEditor.RepaintAll();
                EditorCommands.DeleteMultiSelection();
            }
            GUILayout.EndHorizontal();
            if (GUILayout.Button(Strings.get_Command_Save_Selection_as_Template(), new GUILayoutOption[0]))
            {
                EditorCommands.SaveSelectionAsTemplate();
            }
            if (GUILayout.Button(Strings.get_Command_Set_As_Start_State(), new GUILayoutOption[0]))
            {
                EditorCommands.SetSelectedStateAsStartState();
                SkillEditor.RepaintAll();
            }
            if (GUILayout.Button(Strings.get_Command_Toggle_Breakpoint(), new GUILayoutOption[0]))
            {
                EditorCommands.ToggleBreakpointOnSelectedState();
                SkillEditor.RepaintAll();
            }
            ToolWindow.Divider(Strings.get_ToolWindow_Header_Transitions());
            if (GUILayout.Button(Strings.get_Command_Add_Transition(), new GUILayoutOption[0]))
            {
                EditorCommands.AddTransitionToSelectedState();
                SkillEditor.RepaintAll();
            }
            if (GUILayout.Button(Strings.get_Command_Add_Global_Transition(), new GUILayoutOption[0]))
            {
                EditorCommands.AddGlobalTransitionToSelectedState();
                SkillEditor.RepaintAll();
            }
            if (!SkillEditor.Builder.HasGlobalTransition(SkillEditor.SelectedState))
            {
                return;
            }
            ToolWindow.Divider(Strings.get_ToolWindow_Header_Global_Transitions());
            SkillState selectedState = SkillEditor.SelectedState;

            SkillTransition[] globalTransitions = SkillEditor.SelectedFsm.get_GlobalTransitions();
            for (int i = 0; i < globalTransitions.Length; i++)
            {
                SkillTransition fsmTransition = globalTransitions[i];
                if (!(fsmTransition.get_ToState() != selectedState.get_Name()))
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    if (GUILayout.Button(Labels.GetEventLabel(fsmTransition), EditorStyles.get_popup(), new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(140f)
                    }))
                    {
                        ToolWindow.editingTransition = fsmTransition;
                        SkillEditorGUILayout.GenerateEventSelectionMenu(SkillEditor.SelectedFsm, fsmTransition.get_FsmEvent(), new GenericMenu.MenuFunction2(ToolWindow.SelectGlobalTransitionEvent), new GenericMenu.MenuFunction(SkillEditor.OpenEventManager)).ShowAsContext();
                    }
                    if (SkillEditorGUILayout.DeleteButton())
                    {
                        EditorCommands.DeleteGlobalTransition(fsmTransition);
                        SkillEditor.RepaintAll();
                    }
                    GUILayout.EndHorizontal();
                }
            }
        }
Esempio n. 24
0
 public static void ToggleIsSequence(object userData)
 {
     EditorCommands.ToggleIsSequence(userData as SkillState);
 }
Esempio n. 25
0
 public static void CutStateSelection()
 {
     SkillEditor.Builder.CopyStatesToClipboard(SkillEditor.SelectedStates);
     EditorCommands.DeleteMultiSelection();
 }
Esempio n. 26
0
 private static void SelectState(object userdata)
 {
     EditorCommands.SelectState(userdata);
     SkillEditor.Inspector.SetMode(InspectorMode.StateInspector);
 }
Esempio n. 27
0
 public static void OpenWikiHelp()
 {
     EditorCommands.OpenWikiPage(WikiPages.Home);
 }
Esempio n. 28
0
        private void DoEventLine(SkillEvent fsmEvent)
        {
            int num;

            this.usageCount.TryGetValue(fsmEvent, ref num);
            if (num == 0 && FsmEditorSettings.HideUnusedEvents)
            {
                return;
            }
            GUILayout.BeginHorizontal((this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.SelectedEventBox : SkillEditorStyles.TableRowBox, new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent());
            bool flag = GUILayout.Toggle(fsmEvent.get_IsGlobal(), new GUIContent("", Strings.get_Label_Global()), SkillEditorStyles.TableRowCheckBox, new GUILayoutOption[]
            {
                GUILayout.MaxWidth(17f),
                GUILayout.MinWidth(17f)
            });

            if (flag != fsmEvent.get_IsGlobal())
            {
                SkillEditor.Builder.SetEventIsGlobal(null, fsmEvent, flag);
            }
            EditorGUI.EndDisabledGroup();
            GUIStyle gUIStyle = (this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText;

            if (GUILayout.Button(fsmEvent.get_Name(), gUIStyle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(base.get_position().get_width() - 100f)
            }))
            {
                this.SelectEvent(fsmEvent);
                if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey())
                {
                    this.GenerateUsageContextMenu(this.selectedEvent).ShowAsContext();
                }
                if (EditorApplication.get_timeSinceStartup() - this.clickTime < 0.3)
                {
                    this.AddSelectedEventToState();
                }
                this.clickTime = EditorApplication.get_timeSinceStartup();
            }
            GUILayout.FlexibleSpace();
            GUILayout.Label(num.ToString(CultureInfo.get_CurrentCulture()), gUIStyle, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent());
            if (SkillEditorGUILayout.DeleteButton() && Dialogs.YesNoDialog(Strings.get_Dialog_Delete_Event(), string.Format(Strings.get_Dialog_Delete_Event_Are_you_sure(), (num > 0) ? string.Concat(new object[]
            {
                "\n\n",
                Strings.get_Dialog_Delete_Event_Used_By(),
                num,
                (num > 1) ? Strings.get_Label_Postfix_FSMs_Plural() : Strings.get_Label_Postfix_FSM()
            }) : "")))
            {
                EditorCommands.DeleteEventFromAll(fsmEvent);
                SkillEditor.EventManager.Reset();
                SkillEvent.RemoveEventFromEventList(fsmEvent);
                if (fsmEvent.get_IsGlobal())
                {
                    SkillEvent.get_globalEvents().RemoveAll((string r) => r == fsmEvent.get_Name());
                    SkillEditor.SaveGlobals();
                }
                this.BuildFilteredList();
                base.Repaint();
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
        }
Esempio n. 29
0
 public static void OpenWikiPage(WikiPages page)
 {
     EditorCommands.OpenWikiPage((int)page);
 }
Esempio n. 30
0
        private void DoEventEditor()
        {
            if (EditorWindow.get_focusedWindow() != SkillEditor.Window)
            {
                return;
            }
            SkillEditorGUILayout.LabelWidth(86f);
            bool flag = !SkillEvent.IsNullOrEmpty(this.selectedEvent);

            SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
            if (flag && FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(this.selectedEvent.get_IsSystemEvent() ? Strings.get_Hint_System_Events_cannot_be_renamed() : Strings.get_Hint_Use_Event_Browser_to_rename_globally(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            if (flag && this.selectedEvent.get_IsGlobal())
            {
                SkillEditorGUILayout.ReadonlyTextField(SkillEditorContent.GlobalEventName, 82f, this.newEventName, new GUILayoutOption[0]);
            }
            else
            {
                if (!flag || !this.selectedEvent.get_IsSystemEvent())
                {
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.Label(flag ? SkillEditorContent.EditEventNameLabel : SkillEditorContent.AddEventLabel, new GUILayoutOption[]
                    {
                        GUILayout.MaxWidth(80f)
                    });
                    this.newEventName = EditorGUILayout.TextField(this.newEventName, new GUILayoutOption[0]);
                    string text = SkillEditorGUILayout.FsmEventListPopup();
                    if (text != "")
                    {
                        this.AddEvent(text);
                        return;
                    }
                    EditorGUILayout.EndHorizontal();
                    if (!flag && FsmEditorSettings.ShowHints)
                    {
                        GUILayout.Box(Strings.get_Tooltip_EventManager_Add_Event(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
                    }
                }
            }
            if (flag)
            {
                bool flag2 = false;
                using (List <SkillEvent> .Enumerator enumerator = SkillEditor.SelectedFsm.ExposedEvents.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        SkillEvent current = enumerator.get_Current();
                        if (current.get_Name() == this.selectedEvent.get_Name())
                        {
                            flag2 = true;
                            break;
                        }
                    }
                }
                bool flag3 = EditorGUILayout.Toggle(SkillEditorContent.EventInspectorLabel, flag2, new GUILayoutOption[0]);
                if (flag2 != flag3)
                {
                    if (!flag3)
                    {
                        EditorCommands.RemoveExposedEvent(SkillEditor.SelectedFsm, this.selectedEvent);
                    }
                    else
                    {
                        EditorCommands.AddExposedEvent(SkillEditor.SelectedFsm, this.selectedEvent);
                    }
                    SkillEditor.SetFsmDirty(false, false);
                }
                if (FsmEditorSettings.ShowHints)
                {
                    GUILayout.Box(Strings.get_Hint_EventManager_Expose_Events(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
                }
            }
            string text2 = this.ValidateEventName(flag);
            bool   flag4 = string.IsNullOrEmpty(text2);

            if (!flag4)
            {
                GUILayout.Box(text2, SkillEditorStyles.ErrorBox, new GUILayoutOption[0]);
            }
            if (Event.get_current().get_isKey())
            {
                if (flag4 && Keyboard.EnterKeyPressed())
                {
                    if (!flag)
                    {
                        this.AddEvent(this.newEventName);
                    }
                    else
                    {
                        this.RenameEvent(this.selectedEvent, this.newEventName);
                    }
                    Event.get_current().Use();
                    GUIUtility.ExitGUI();
                    return;
                }
                if (Event.get_current().get_keyCode() == 27)
                {
                    this.Reset();
                }
            }
        }