Esempio n. 1
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. 2
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();
                }
            }
        }
 public static void PasteStates()
 {
     EditorCommands.PasteStates(FsmGraphView.GetViewCenter());
 }