Beispiel #1
0
        private static void DoDebugControls()
        {
            int    num  = FsmErrorChecker.CountAllErrors();
            string text = Strings.get_DebugToolbar_No_errors();

            if (num > 0)
            {
                text = string.Format("{0} {1}", num, (num > 1) ? Strings.get_DebugToolbar_Label_Errors() : Strings.get_DebugToolbar_Label_Error());
            }
            SkillEditorContent.DebugToolbarErrorCount.set_text(text);
            if (GUILayout.Button(SkillEditorContent.DebugToolbarErrorCount, SkillEditorStyles.ErrorCount, new GUILayoutOption[0]))
            {
                SkillEditor.OpenErrorWindow();
                GUIUtility.ExitGUI();
            }
            if (Event.get_current().get_type() == 7)
            {
                Rect lastRect = GUILayoutUtility.GetLastRect();
                lastRect.set_x(lastRect.get_x() + 4f);
                lastRect.set_y(lastRect.get_y() + 2f);
                float width;
                lastRect.set_height(width = 14f);
                lastRect.set_width(width);
                GUIHelpers.DrawTexture(lastRect, (num > 0) ? SkillEditorStyles.Errors : SkillEditorStyles.NoErrors, Color.get_white(), 0);
            }
            GUILayout.Space(10f);
            if (GUILayout.Button(SkillEditorContent.DebugToolbarDebug, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
            {
                DebugToolbar.DoDebugMenu();
            }
        }
 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();
     }
 }
Beispiel #3
0
        private static void DoToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
            string fullFsmLabel = Labels.GetFullFsmLabel(SkillEditor.SelectedFsm);

            if (GUILayout.Button(fullFsmLabel, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
            {
                SkillEditorGUILayout.GenerateFsmSelectionMenu(true, false).ShowAsContext();
            }
            GUILayout.EndHorizontal();
        }
        private void DoMainToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
            string fullFsmLabel = Labels.GetFullFsmLabel(SkillEditor.SelectedFsm);

            if (GUILayout.Button(fullFsmLabel, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
            {
                SkillEditorGUILayout.GenerateFsmSelectionMenu(false, false).ShowAsContext();
            }
            if (SkillEditorGUILayout.ToolbarSettingsButton())
            {
                SkillLogger.GenerateSettingsMenu().ShowAsContext();
            }
            GUILayout.Space(-5f);
            GUILayout.EndHorizontal();
        }
 private void DoMainToolbar()
 {
     this.filterRect.Set(0f, 0f, this.listWidth, this.toolbarHeight);
     if (GUI.Button(this.filterRect, TimelineWindow.fsmFilterLabels[(int)this.filterMode], EditorStyles.get_toolbarDropDown()))
     {
         this.GenerateFilterMenu().ShowAsContext();
     }
     this.timelineRect.Set(this.listWidth, 0f, base.get_position().get_width() - this.listWidth, base.get_position().get_height());
     this.timelineControl.OnGUI(this.timelineRect);
     if (this.timelineControl.NeedsRepaint)
     {
         base.Repaint();
     }
 }
        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;
            }
        }