Exemple #1
0
        private static void DoPlaybackControls()
        {
            Color contentColor = GUI.get_contentColor();

            GUI.set_contentColor((!SkillEditorStyles.UsingProSkin()) ? Color.get_black() : EditorStyles.get_label().get_normal().get_textColor());
            EditorGUI.BeginChangeCheck();
            bool isPlaying = GUILayout.Toggle(EditorApplication.get_isPlayingOrWillChangePlaymode(), SkillEditorContent.Play, EditorStyles.get_toolbarButton(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(40f)
            });

            if (EditorGUI.EndChangeCheck())
            {
                EditorApplication.set_isPlaying(isPlaying);
            }
            EditorGUI.BeginChangeCheck();
            bool isPaused = GUILayout.Toggle(EditorApplication.get_isPaused(), SkillEditorContent.Pause, EditorStyles.get_toolbarButton(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(40f)
            });

            if (EditorGUI.EndChangeCheck())
            {
                EditorApplication.set_isPaused(isPaused);
            }
            if (GUILayout.Button(SkillEditorContent.Step, EditorStyles.get_toolbarButton(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(40f)
            }))
            {
                FsmDebugger.Instance.Step();
                GUIUtility.ExitGUI();
            }
            GUI.set_contentColor(contentColor);
        }
 public static bool ToolbarDeleteButton()
 {
     SkillEditorContent.DeleteButton.set_tooltip((DragAndDropManager.mode == DragAndDropManager.DragMode.None) ? Strings.get_Command_Delete() : null);
     return(GUILayout.Button(SkillEditorContent.DeleteButton, EditorStyles.get_toolbarButton(), new GUILayoutOption[]
     {
         GUILayout.MaxWidth(24f)
     }));
 }
 private static void DoFsmSelectorGUI()
 {
     SkillEditorContent.MainToolbarSelectedGO.set_text((SkillEditor.SelectedFsmGameObject == null) ? Strings.get_Label_None() : SkillEditor.SelectedFsmGameObject.get_name());
     SkillEditorContent.MainToolbarSelectedGO.set_tooltip(Strings.get_Hint_Select_Game_Object());
     EditorGUI.BeginDisabledGroup(!SkillEditor.SelectionHistory.CanMoveBack());
     if (GUILayout.Button(SkillEditorContent.BackButton, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
     {
         SkillEditor.SelectFsm(SkillEditor.SelectionHistory.MoveBack());
     }
     EditorGUI.EndDisabledGroup();
     EditorGUI.BeginDisabledGroup(!SkillEditor.SelectionHistory.CanMoveForward());
     if (GUILayout.Button(SkillEditorContent.ForwardButton, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
     {
         SkillEditor.SelectFsm(SkillEditor.SelectionHistory.MoveForward());
     }
     EditorGUI.EndDisabledGroup();
     EditorGUI.BeginDisabledGroup(SkillEditor.SelectionHistory.RecentlySelectedCount <= 0);
     if (GUILayout.Button(SkillEditorContent.RecentButton, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
     {
         GenericMenu  genericMenu          = new GenericMenu();
         List <Skill> recentlySelectedFSMs = SkillEditor.SelectionHistory.GetRecentlySelectedFSMs();
         using (List <Skill> .Enumerator enumerator = recentlySelectedFSMs.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Skill current = enumerator.get_Current();
                 genericMenu.AddItem(new GUIContent(Labels.GetFullFsmLabel(current)), current == SkillEditor.SelectedFsm, new GenericMenu.MenuFunction2(SkillEditor.SelectFsm), current);
             }
         }
         genericMenu.ShowAsContext();
         return;
     }
     EditorGUI.EndDisabledGroup();
     if (GUILayout.Button(SkillEditorContent.MainToolbarSelectedGO, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[]
     {
         GUILayout.MinWidth(100f)
     }))
     {
         SkillEditorGUILayout.GenerateFsmGameObjectSelectionMenu(true).ShowAsContext();
     }
     SkillEditorContent.MainToolbarSelectedFSM.set_text((SkillEditor.SelectedFsm == null) ? "" : SkillEditor.SelectedFsm.get_Name());
     SkillEditorContent.MainToolbarSelectedFSM.set_tooltip(Strings.get_Tooltip_Select_FSM());
     if (GUILayout.Button(SkillEditorContent.MainToolbarSelectedFSM, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[]
     {
         GUILayout.MinWidth(100f)
     }))
     {
         SkillEditorGUILayout.GenerateGameObjectFsmSelectionMenu().ShowAsContext();
     }
     FsmEditorSettings.LockGraphView = GUILayout.Toggle(FsmEditorSettings.LockGraphView, SkillEditorContent.MainToolbarLock, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
     if (GUI.get_changed())
     {
         FsmEditorSettings.SaveSettings();
     }
 }
 private void DoBottomToolbar()
 {
     GUI.set_enabled(true);
     GUI.set_backgroundColor(Color.get_white());
     GUI.set_color(Color.get_white());
     GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
     if (GUILayout.Button(Strings.get_FsmLog_Clear(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
     {
         this.ClearLog();
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
Exemple #5
0
 private void DoToolbar()
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
     if (GUILayout.Button(Strings.get_ErrorSelector_Refresh(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
     {
         FsmErrorChecker.Refresh();
     }
     GUILayout.FlexibleSpace();
     this.filterByFsm = GUILayout.Toggle(this.filterByFsm, new GUIContent(Strings.get_ErrorSelector_Filter_Selected_FSM_Only(), Strings.get_ErrorSelector_Filter_Selected_FSM()), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
     GUILayout.Space(5f);
     if (SkillEditorGUILayout.ToolbarSettingsButton())
     {
         ErrorSelector.GenerateSettingsMenu().ShowAsContext();
     }
     GUILayout.Space(-5f);
     EditorGUILayout.EndHorizontal();
 }
Exemple #6
0
 private static void DoDebugFlowControls()
 {
     if (GameStateTracker.CurrentState == GameState.Stopped)
     {
         GUILayout.FlexibleSpace();
         return;
     }
     if (DebugFlow.Active)
     {
         GUI.set_contentColor(Color.get_yellow());
         GUILayout.Label(Labels.FormatTime(DebugFlow.CurrentDebugTime), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
         GUI.set_contentColor(Color.get_white());
         GUILayout.Space(10f);
         if (GUILayout.Button(SkillEditorContent.DebugToolbarPrev, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
         {
             DebugFlow.SelectPrevTransition();
         }
         if (GUILayout.Button(SkillEditorContent.DebugToolbarNext, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
         {
             DebugFlow.SelectNextTransition();
         }
         GUILayout.FlexibleSpace();
         if (GUILayout.Button(Strings.get_DebugToolbar_Button_Open_Log(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
         {
             SkillEditor.OpenFsmLogWindow();
             GUIUtility.ExitGUI();
             return;
         }
     }
     else
     {
         GUILayout.FlexibleSpace();
         if (GUILayout.Button(Strings.get_DebugToolbar_Button_Open_Log(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
         {
             SkillEditor.OpenFsmLogWindow();
             GUIUtility.ExitGUI();
         }
     }
 }
        private void DoBottomToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
            bool flag = GUILayout.Toggle(FsmEditorSettings.ShowHints, Strings.get_Command_Toggle_Hints(), EditorStyles.get_toolbarButton(), new GUILayoutOption[]
            {
                GUILayout.MaxWidth(100f)
            });

            if (flag != FsmEditorSettings.ShowHints)
            {
                FsmEditorSettings.ShowHints = flag;
                FsmEditorSettings.SaveSettings();
                SkillEditor.RepaintAll();
            }
            if (GUILayout.Button(Strings.get_Command_Preferences(), EditorStyles.get_toolbarButton(), new GUILayoutOption[]
            {
                GUILayout.MinWidth(150f)
            }))
            {
                this.inspectorMode = InspectorMode.Preferences;
            }
            GUILayout.EndHorizontal();
        }
 private void DoListView()
 {
     this.listArea.Set(0f, this.toolbarHeight, this.listWidth, base.get_position().get_height() - this.toolbarHeight - this.scrollbarHeight);
     this.listItemArea.Set(0f, 0f, this.listWidth, 20f);
     if (this.autoScroll)
     {
         float num = (float)this.selectedIndex * 20f;
         if (num < this.scrollPosition.y)
         {
             this.scrollPosition.y = num;
         }
         else
         {
             if (num > this.scrollPosition.y + this.listArea.get_height() - 20f)
             {
                 this.scrollPosition.y = (float)(this.selectedIndex + 1) * 20f - this.listArea.get_height();
             }
         }
         this.autoScroll = false;
     }
     GUI.BeginGroup(this.listArea);
     if (this.FsmList.get_Count() == 0)
     {
         GUILayout.Label(Strings.get_Label_None(), new GUILayoutOption[0]);
     }
     this.firstVisibleItem = Mathf.FloorToInt(this.scrollPosition.y / 20f);
     this.firstVisibleItem = Mathf.Clamp(this.firstVisibleItem, 0, this.FsmList.get_Count());
     this.lastVisibleItem  = this.firstVisibleItem + Mathf.CeilToInt(this.listArea.get_height() / 20f) + 1;
     this.lastVisibleItem  = Mathf.Clamp(this.lastVisibleItem, 0, this.FsmList.get_Count());
     this.listItemArea.set_y((float)this.firstVisibleItem * 20f - this.scrollPosition.y);
     for (int i = this.firstVisibleItem; i < this.lastVisibleItem; i++)
     {
         Skill fsm  = this.FsmList.get_Item(i);
         bool  flag = SkillEditor.SelectedFsm == fsm;
         if (flag)
         {
             if (this.eventType == 7)
             {
                 GUI.DrawTexture(this.listItemArea, SkillEditorStyles.SelectedBG);
             }
             if (this.selectedIndex != i)
             {
                 this.autoScroll = true;
             }
             this.selectedIndex = i;
         }
         if (GUI.Button(this.listItemArea, Labels.GetRuntimeFsmLabelToFit(fsm, this.listWidth, SkillEditorStyles.TableRowText), flag ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText))
         {
             this.SelectFsm(fsm);
         }
         this.listItemArea.set_y(this.listItemArea.get_y() + 20f);
         this.line.SetColor(SkillEditorStyles.LabelTextColor);
         this.line.DrawLine(0.05f, 0f, this.listItemArea.get_y() - 1f, this.listWidth, this.listItemArea.get_y() - 1f);
     }
     GUI.EndGroup();
     if (this.listArea.Contains(this.currentEvent.get_mousePosition()) && this.eventType == 6)
     {
         this.scrollPosition.y = this.scrollPosition.y + this.currentEvent.get_delta().y;
         base.Repaint();
     }
     this.listArea.Set(0f, base.get_position().get_height() - this.scrollbarHeight, this.listWidth, this.scrollbarHeight);
     GUI.Box(this.listArea, GUIContent.none, EditorStyles.get_toolbar());
     if (GUI.Button(this.listArea, Strings.get_Label_Refresh(), EditorStyles.get_toolbarButton()))
     {
         this.RefreshList();
     }
 }
        public void OnGUI()
        {
            float num = SkillEditor.Window.get_position().get_width() - 350f;

            EditorGUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[]
            {
                GUILayout.Width(num)
            });
            MainToolbar.DoFsmSelectorGUI();
            MainToolbar.DoPrefabTypeGUI();
            GUILayout.FlexibleSpace();
            bool flag = GUILayout.Toggle(FsmEditorSettings.GraphViewShowMinimap, SkillEditorContent.MainToolbarShowMinimap, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);

            if (flag != FsmEditorSettings.GraphViewShowMinimap)
            {
                FsmEditorSettings.GraphViewShowMinimap = flag;
                FsmEditorSettings.SaveSettings();
            }
            EditorGUILayout.EndHorizontal();
        }
        private static void DoPrefabTypeGUI()
        {
            if (SkillEditor.SelectedFsmGameObject == null || SkillEditor.SelectedTemplate != null)
            {
                return;
            }
            bool   isModifiedPrefabInstance = SkillEditor.SelectedFsm.get_IsModifiedPrefabInstance();
            string text = "";

            if (isModifiedPrefabInstance)
            {
                text = Strings.get_Label_Modified_postfix();
            }
            switch (SkillEditor.Selection.ActiveFsmPrefabType)
            {
            case 0:
                if (GUILayout.Button(SkillEditorContent.MainToolbarPrefabTypeNone, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
                {
                    SkillEditor.SelectFsmGameObject();
                    return;
                }
                break;

            case 1:
                if (GUILayout.Button(Strings.get_Label_Prefab(), EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu = new GenericMenu();
                    genericMenu.AddItem(new GUIContent(Strings.get_Menu_Select_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    genericMenu.AddItem(new GUIContent(Strings.get_Menu_Make_Instance()), false, new GenericMenu.MenuFunction(SkillEditor.InstantiatePrefab));
                    genericMenu.ShowAsContext();
                    return;
                }
                break;

            case 2:
                if (GUILayout.Button(Strings.get_Label_Model_Prefab(), EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu2 = new GenericMenu();
                    genericMenu2.AddItem(new GUIContent(Strings.get_Menu_Select_GameObject()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    genericMenu2.AddItem(new GUIContent(Strings.get_Menu_Make_Instance()), false, new GenericMenu.MenuFunction(SkillEditor.InstantiatePrefab));
                    genericMenu2.ShowAsContext();
                    return;
                }
                break;

            case 3:
                if (GUILayout.Button(Strings.get_Label_Prefab_Instance() + text, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu3 = new GenericMenu();
                    genericMenu3.AddItem(new GUIContent(Strings.get_Menu_Select_GameObject()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    if (isModifiedPrefabInstance)
                    {
                        genericMenu3.AddItem(new GUIContent(Strings.get_Menu_Revert_To_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.ResetToPrefabState));
                    }
                    else
                    {
                        genericMenu3.AddDisabledItem(new GUIContent(Strings.get_Menu_Revert_To_Prefab()));
                    }
                    genericMenu3.AddItem(new GUIContent(Strings.get_Menu_Select_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.SelectPrefabParent));
                    genericMenu3.ShowAsContext();
                    return;
                }
                break;

            case 4:
                if (GUILayout.Button(Strings.get_Label_Model_Prefab_Instance(), EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu4 = new GenericMenu();
                    genericMenu4.AddItem(new GUIContent(Strings.get_Menu_Select_GameObject()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    if (isModifiedPrefabInstance)
                    {
                        genericMenu4.AddItem(new GUIContent(Strings.get_Menu_Revert_To_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.ResetToPrefabState));
                    }
                    else
                    {
                        genericMenu4.AddDisabledItem(new GUIContent(Strings.get_Menu_Revert_To_Prefab()));
                    }
                    genericMenu4.AddItem(new GUIContent(Strings.get_Menu_Select_Prefab_Parent()), false, new GenericMenu.MenuFunction(SkillEditor.SelectPrefabParent));
                    genericMenu4.ShowAsContext();
                    return;
                }
                break;

            case 5:
                break;

            case 6:
                if (GUILayout.Button(Strings.get_Label_Prefab_Instance_disconnected(), EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu5 = new GenericMenu();
                    genericMenu5.AddItem(new GUIContent(Strings.get_Menu_Select_GameObject()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    genericMenu5.AddItem(new GUIContent(Strings.get_Menu_Reconnect_to_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.ReconnectToLastPrefab));
                    genericMenu5.ShowAsContext();
                    return;
                }
                break;

            case 7:
                if (GUILayout.Button(Strings.get_Label_Model_Prefab_Instance_disconnected(), EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu6 = new GenericMenu();
                    genericMenu6.AddItem(new GUIContent(Strings.get_Menu_Select_GameObject()), false, new GenericMenu.MenuFunction(SkillEditor.SelectFsmGameObject));
                    genericMenu6.AddItem(new GUIContent(Strings.get_Menu_Reconnect_to_Prefab()), false, new GenericMenu.MenuFunction(SkillEditor.ReconnectToLastPrefab));
                    genericMenu6.ShowAsContext();
                }
                break;

            default:
                return;
            }
        }