コード例 #1
0
 private void DoErrorHierarchyGUI()
 {
     this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[0]);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.GetErrors().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             FsmError current = enumerator.get_Current();
             if (!this.filterByFsm || current.Fsm == SkillEditor.SelectedFsm)
             {
                 GUIStyle gUIStyle = SkillEditorStyles.ActionItem;
                 if (this.selectedError == current)
                 {
                     gUIStyle = SkillEditorStyles.ActionItemSelected;
                 }
                 SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                 if (GUILayout.Button(current.ErrorString, gUIStyle, new GUILayoutOption[0]) || GUILayout.Button(current.ToString(), gUIStyle, new GUILayoutOption[0]))
                 {
                     this.selectedError = current;
                     ErrorSelector.GotoError(this.selectedError);
                 }
             }
         }
     }
     GUILayout.EndVertical();
     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
     GUILayout.EndScrollView();
 }
コード例 #2
0
 private void DoSortedByFSM()
 {
     this.currentFSM    = null;
     this.currentState  = null;
     this.currentAction = null;
     using (List <ActionReport> .Enumerator enumerator = ActionReport.ActionReportList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ActionReport current = enumerator.get_Current();
             if (!(current.fsm == null) && current.state != null && current.action != null)
             {
                 if (current.fsm != this.currentFSM)
                 {
                     this.currentFSM = current.fsm;
                     SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
                     if (GUILayout.Button(Labels.GetFullFsmLabel(current.fsm.get_Fsm()), EditorStyles.get_label(), new GUILayoutOption[0]))
                     {
                         ActionReportWindow.SelectReport(current);
                         break;
                     }
                     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                 }
                 if (current.state != this.currentState)
                 {
                     this.currentState = current.state;
                     SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                     if (GUILayout.Button(Strings.get_Tab() + current.state.get_Name(), EditorStyles.get_label(), new GUILayoutOption[0]))
                     {
                         ActionReportWindow.SelectReport(current);
                         break;
                     }
                     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                 }
                 if (current.action != this.currentAction)
                 {
                     SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                     this.currentAction = current.action;
                     if (GUILayout.Button(Strings.get_Tab2() + Labels.GetActionLabel(current.action), EditorStyles.get_label(), new GUILayoutOption[0]))
                     {
                         ActionReportWindow.SelectReport(current);
                         break;
                     }
                     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                 }
                 ActionReportWindow.DoReportLine(Strings.get_Tab3(), current);
             }
         }
     }
 }
コード例 #3
0
        private void DoGlobalVariablesTable()
        {
            if (SkillSearch.GetGlobalVariablesUsedCount(SkillEditor.SelectedFsm) == 0)
            {
                return;
            }
            GUILayout.Space(10f);
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]);
            GUILayout.Label(SkillEditorContent.GlobalsLabel, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.Label(SkillEditorContent.VariableUseCountLabel, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            List <NamedVariable> globalVariablesUsed = SkillSearch.GetGlobalVariablesUsed(SkillEditor.SelectedFsm);

            using (List <NamedVariable> .Enumerator enumerator = globalVariablesUsed.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    NamedVariable current = enumerator.get_Current();
                    GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]);
                    GUIStyle tableRowText = SkillEditorStyles.TableRowText;
                    if (GUILayout.Button(new GUIContent(current.get_Name(), current.get_Tooltip()), tableRowText, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(155f)
                    }))
                    {
                        Keyboard.ResetFocus();
                        this.Deselect();
                        if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey())
                        {
                            FsmVariablesEditor.DoGlobalVariableContextMenu(current);
                        }
                    }
                    int globalVariablesUsageCount = SkillSearch.GetGlobalVariablesUsageCount(current);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(globalVariablesUsageCount.ToString(CultureInfo.get_CurrentCulture()), tableRowText, new GUILayoutOption[0]);
                    GUILayout.Space(10f);
                    GUILayout.EndHorizontal();
                    if (FsmEditorSettings.DebugVariables)
                    {
                        SkillEditorGUILayout.ReadonlyTextField(current.ToString(), new GUILayoutOption[0]);
                    }
                }
            }
        }
コード例 #4
0
        private void DoVariableTable()
        {
            this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[0]);
            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(Strings.get_Hint_Variable_Panel(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            if (this.fsmVariables.get_Count() == 0)
            {
                GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]);
                GUILayout.Label(Strings.get_Label_None_In_Table(), new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
            }
            else
            {
                if (this.filteredVariables.get_Count() == 0)
                {
                    GUILayout.Label("No search results for: " + this.searchString, new GUILayoutOption[0]);
                }
            }
            int num = 0;

            for (int i = 0; i < this.filteredVariables.get_Count(); i++)
            {
                SkillVariable fsmVariable = this.filteredVariables.get_Item(i);
                int           categoryID  = fsmVariable.CategoryID;
                if (categoryID > 0 && categoryID != num)
                {
                    num = categoryID;
                    this.categoryLabels.get_Item(num).OnGUI(new GUILayoutOption[0]);
                    SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                }
                bool flag = fsmVariable == this.selectedFsmVariable;
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(flag ? SkillEditorStyles.SelectedEventBox : (FsmEditorSettings.DebugVariables ? SkillEditorStyles.TableRowBoxNoDivider : SkillEditorStyles.TableRowBox), new GUILayoutOption[0]);
                GUIStyle gUIStyle = flag ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText;
                if (GUILayout.Button(new GUIContent(fsmVariable.Name, fsmVariable.Tooltip), gUIStyle, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(155f)
                }))
                {
                    this.SelectVariable(fsmVariable);
                    if ((Event.get_current().get_button() == 1 || EditorGUI.get_actionKey()) && this.VariableContextClicked != null)
                    {
                        this.VariableContextClicked(fsmVariable);
                    }
                }
                GUILayout.FlexibleSpace();
                int usedCount = this.GetUsedCount(fsmVariable.NamedVar);
                GUILayout.Label((usedCount >= 0) ? usedCount.ToString(CultureInfo.get_CurrentCulture()) : "-", gUIStyle, new GUILayoutOption[0]);
                GUILayout.Space(10f);
                bool changed = GUI.get_changed();
                GUI.set_changed(false);
                VariableType newType = EditorGUILayout.Popup(fsmVariable.Type, SkillVariable.VariableTypeNames, new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(114f)
                });
                if (GUI.get_changed())
                {
                    this.ChangeVariableType(fsmVariable, newType);
                    GUIUtility.ExitGUI();
                    return;
                }
                GUI.set_changed(changed);
                if (SkillEditorGUILayout.DeleteButton())
                {
                    this.DeleteVariable(fsmVariable, true, true);
                    GUIUtility.ExitGUI();
                    return;
                }
                GUILayout.EndHorizontal();
                if (FsmEditorSettings.DebugVariables)
                {
                    SkillEditorGUILayout.ReadonlyTextField(fsmVariable.NamedVar.ToString(), new GUILayoutOption[0]);
                }
                GUILayout.EndVertical();
                if (flag)
                {
                    this.selectedIndex = i;
                    if (Event.get_current().get_type() == 7)
                    {
                        this.selectedRect = GUILayoutUtility.GetLastRect();
                        this.selectedRect.set_y(this.selectedRect.get_y() - this.scrollPosition.y);
                    }
                }
            }
            Rect lastRect = GUILayoutUtility.GetLastRect();

            this.mouseOverTable = (Event.get_current().get_mousePosition().y < lastRect.get_y() + lastRect.get_height());
            if (this.fsmOwner != null)
            {
                this.DoGlobalVariablesTable();
            }
            GUILayout.Space(20f);
            GUILayout.FlexibleSpace();
            GUILayout.EndScrollView();
            this.DoAutoScroll();
            GUILayout.EndVertical();
            if (Event.get_current().get_type() == 7)
            {
                FsmVariablesEditor.tableHeight = GUILayoutUtility.GetLastRect().get_height() + GUI.get_skin().get_horizontalScrollbar().get_fixedHeight() + EditorStyles.get_toolbar().get_fixedHeight();
            }
        }
コード例 #5
0
        private void DoSortedByAction()
        {
            List <Type> list = new List <Type>();

            using (List <ActionReport> .Enumerator enumerator = ActionReport.ActionReportList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ActionReport current = enumerator.get_Current();
                    Type         type    = current.action.GetType();
                    if (!list.Contains(type))
                    {
                        list.Add(type);
                    }
                }
            }
            this.currentAction = null;
            using (List <Type> .Enumerator enumerator2 = list.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    Type current2 = enumerator2.get_Current();
                    SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
                    GUILayout.Label(Labels.GetActionLabel(current2), EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
                    this.currentFSM   = null;
                    this.currentState = null;
                    List <SkillState>   list2 = new List <SkillState>();
                    List <ActionReport> list3 = new List <ActionReport>();
                    List <string>       list4 = new List <string>();
                    SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                    GUILayout.Label(Strings.get_ActionReportWindow_Action_Changes_Title(), EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
                    using (List <ActionReport> .Enumerator enumerator3 = ActionReport.ActionReportList.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            ActionReport current3 = enumerator3.get_Current();
                            Type         type2    = current3.action.GetType();
                            if (type2 == current2)
                            {
                                if (!list2.Contains(current3.state))
                                {
                                    list3.Add(current3);
                                    list2.Add(current3.state);
                                }
                                if (!list4.Contains(current3.logText))
                                {
                                    ActionReportWindow.DoReportLine(Strings.get_Tab(), current3);
                                    list4.Add(current3.logText);
                                }
                            }
                        }
                    }
                    SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                    GUILayout.Label(Strings.get_ActionReportWindow_Effected_States_Title(), EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
                    using (List <ActionReport> .Enumerator enumerator4 = list3.GetEnumerator())
                    {
                        while (enumerator4.MoveNext())
                        {
                            ActionReport current4 = enumerator4.get_Current();
                            if (current4.state != null && !(current4.fsm == null))
                            {
                                if (GUILayout.Button(Strings.get_Tab() + Labels.GetFullStateLabel(current4.state), EditorStyles.get_label(), new GUILayoutOption[0]))
                                {
                                    ActionReportWindow.SelectReport(current4);
                                    return;
                                }
                                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
        public static void OnGUI()
        {
            EditorGUI.BeginChangeCheck();
            Skill fsm = SkillEditor.SelectedFsm;

            if (fsm == null)
            {
                GUILayout.FlexibleSpace();
                return;
            }
            if (!FsmInspector.isInitialized)
            {
                FsmInspector.isInitialized = true;
                FsmInspector.Init();
            }
            FsmInspector.scrollViewPosition = GUILayout.BeginScrollView(FsmInspector.scrollViewPosition, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            fsm.set_Name(EditorGUILayout.TextField(fsm.get_Name(), new GUILayoutOption[0]));
            if (EditorGUI.EndChangeCheck())
            {
                Labels.Update(fsm);
            }
            if (fsm.get_Owner() != null)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                SkillTemplate fsmTemplate = (SkillTemplate)EditorGUILayout.ObjectField(FsmInspector.SelectedTemplate, typeof(SkillTemplate), false, new GUILayoutOption[0]);
                if (fsmTemplate != FsmInspector.SelectedTemplate)
                {
                    FsmInspector.SelectTemplate(fsmTemplate);
                }
                if (GUILayout.Button(SkillEditorContent.BrowseTemplateButton, new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(30f),
                    GUILayout.Height(16f)
                }))
                {
                    Templates.DoSelectTemplateMenu(FsmInspector.SelectedTemplate, new GenericMenu.MenuFunction(FsmInspector.ClearTemplate), new GenericMenu.MenuFunction2(FsmInspector.SelectTemplate));
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.BeginDisabledGroup(!Application.get_isPlaying() && SkillEditor.SelectedFsmUsesTemplate);
            if (fsm.get_Template() != null)
            {
                fsm = fsm.get_Template().fsm;
            }
            fsm.set_Description(SkillEditorGUILayout.TextAreaWithHint(fsm.get_Description(), Strings.get_Label_Description___(), new GUILayoutOption[]
            {
                GUILayout.MinHeight(80f)
            }));
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            fsm.set_DocUrl(SkillEditorGUILayout.TextFieldWithHint(fsm.get_DocUrl(), Strings.get_Tooltip_Documentation_Url(), new GUILayoutOption[0]));
            EditorGUI.BeginDisabledGroup(!string.IsNullOrEmpty(fsm.get_DocUrl()));
            if (SkillEditorGUILayout.HelpButton("Online Help"))
            {
                Application.OpenURL(fsm.get_DocUrl());
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginDisabledGroup(!Application.get_isPlaying() && SkillEditor.SelectedFsmUsesTemplate);
            fsm.set_MaxLoopCountOverride(EditorGUILayout.IntField(SkillEditorContent.MaxLoopOverrideLabel, fsm.get_MaxLoopCountOverride(), new GUILayoutOption[0]));
            fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, SkillEditorContent.ResetOnDisableLabel, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();
            fsm = SkillEditor.SelectedFsm;
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label(SkillEditorContent.FsmControlsLabel, EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            if (fsm.ExposedEvents.get_Count() + FsmInspector.fsmVariables.get_Count() == 0)
            {
                SkillEditorGUILayout.DisabledLabel(Strings.get_Label_None_In_Table());
            }
            else
            {
                SkillEditorGUILayout.LabelWidth(100f);
                int num = 0;
                for (int i = 0; i < FsmInspector.fsmVariables.get_Count(); i++)
                {
                    SkillVariable fsmVariable = FsmInspector.fsmVariables.get_Item(i);
                    if (fsmVariable.ShowInInspector)
                    {
                        int categoryID = fsmVariable.CategoryID;
                        if (categoryID > 0 && categoryID != num)
                        {
                            num = categoryID;
                            GUILayout.Label(SkillEditor.SelectedFsm.get_Variables().get_Categories()[categoryID], EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
                            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                        }
                        fsmVariable.DoInspectorGUI(SkillEditorContent.TempContent(fsmVariable.Name, fsmVariable.Name + ((!string.IsNullOrEmpty(fsmVariable.Tooltip)) ? (":\n" + fsmVariable.Tooltip) : "")), false);
                    }
                }
                using (List <SkillEvent> .Enumerator enumerator = fsm.ExposedEvents.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        SkillEvent current = enumerator.get_Current();
                        if (GUILayout.Button(current.get_Name(), new GUILayoutOption[0]))
                        {
                            fsm.Event(current);
                        }
                    }
                }
                if (GUI.get_changed())
                {
                    SkillEditor.RepaintAll();
                }
            }
            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(Strings.get_Hint_Expose_Events_and_Variables(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label(SkillEditorContent.NetworkSyncLabel, EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            int num2 = 0;

            SkillBool[] boolVariables = fsm.get_Variables().get_BoolVariables();
            for (int j = 0; j < boolVariables.Length; j++)
            {
                SkillBool fsmBool = boolVariables[j];
                if (fsmBool.get_NetworkSync())
                {
                    GUILayout.Label(fsmBool.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillFloat[] floatVariables = fsm.get_Variables().get_FloatVariables();
            for (int k = 0; k < floatVariables.Length; k++)
            {
                SkillFloat fsmFloat = floatVariables[k];
                if (fsmFloat.get_NetworkSync())
                {
                    GUILayout.Label(fsmFloat.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillInt[] intVariables = fsm.get_Variables().get_IntVariables();
            for (int l = 0; l < intVariables.Length; l++)
            {
                SkillInt fsmInt = intVariables[l];
                if (fsmInt.get_NetworkSync())
                {
                    GUILayout.Label(fsmInt.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillQuaternion[] quaternionVariables = fsm.get_Variables().get_QuaternionVariables();
            for (int m = 0; m < quaternionVariables.Length; m++)
            {
                SkillQuaternion fsmQuaternion = quaternionVariables[m];
                if (fsmQuaternion.get_NetworkSync())
                {
                    GUILayout.Label(fsmQuaternion.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillVector3[] vector3Variables = fsm.get_Variables().get_Vector3Variables();
            for (int n = 0; n < vector3Variables.Length; n++)
            {
                SkillVector3 fsmVector = vector3Variables[n];
                if (fsmVector.get_NetworkSync())
                {
                    GUILayout.Label(fsmVector.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            if (num2 == 0)
            {
                SkillEditorGUILayout.DisabledLabel(Strings.get_Label_None_In_Table());
            }
            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(Strings.get_Hint_Network_Sync_Variables(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label("Debug", EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            fsm.set_ShowStateLabel(GUILayout.Toggle(fsm.get_ShowStateLabel(), SkillEditorContent.ShowStateLabelsLabel, new GUILayoutOption[0]));
            fsm.EnableBreakpoints = GUILayout.Toggle(fsm.EnableBreakpoints, SkillEditorContent.EnableBreakpointsLabel, new GUILayoutOption[0]);
            fsm.EnableDebugFlow   = GUILayout.Toggle(fsm.EnableDebugFlow, SkillEditorContent.EnableDebugFlowLabel, new GUILayoutOption[0]);
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label("Experimental", EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            EditorGUILayout.HelpBox(Strings.get_Help_Experimental_Warning(), 0);
            fsm.set_KeepDelayedEventsOnStateExit(GUILayout.Toggle(fsm.get_KeepDelayedEventsOnStateExit(), SkillEditorContent.KeepDelayedEvents, new GUILayoutOption[0]));
            fsm.set_ManualUpdate(GUILayout.Toggle(fsm.get_ManualUpdate(), SkillEditorContent.ManualUpdate, new GUILayoutOption[0]));
            GUILayout.EndScrollView();
            EventType arg_641_0 = Event.get_current().get_type();

            if (EditorGUI.EndChangeCheck())
            {
                SkillEditor.SetFsmDirty(false, false);
            }
            if (Event.get_current().get_type() == null)
            {
                GUIUtility.set_keyboardControl(0);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(true);
            GUILayout.Label("Data Version: " + fsm.get_DataVersion(), EditorStyles.get_miniLabel(), new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            SkillEditorGUILayout.LockFsmGUI(fsm);
        }