Ejemplo n.º 1
0
 public override void DoGUI()
 {
     if (Event.get_current().get_type() == null && Event.get_current().get_button() == 0 && GUIUtility.get_hotControl() == 0)
     {
         GUIUtility.set_keyboardControl(0);
     }
     StateSelector.HandleKeyboardInput();
     StateSelector.DoToolbar();
     if (FsmEditorSettings.ShowHints)
     {
         GUILayout.Box(Strings.get_Hint_State_Selector(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
     }
     StateSelector.scrollPosition = GUILayout.BeginScrollView(StateSelector.scrollPosition, new GUILayoutOption[0]);
     if (SkillEditor.SelectedFsm != null)
     {
         SkillState[] states = SkillEditor.SelectedFsm.get_States();
         for (int i = 0; i < states.Length; i++)
         {
             SkillState state = states[i];
             StateSelector.DoStateRow(state);
         }
     }
     GUILayout.EndScrollView();
     this.DoAutoScroll();
     SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     EditorGUILayout.Space();
 }
Ejemplo n.º 2
0
        private static void SelectPrevious()
        {
            if (SkillEditor.SelectedState == null)
            {
                return;
            }
            int num = Array.IndexOf <SkillState>(SkillEditor.SelectedFsm.get_States(), SkillEditor.SelectedState);

            if (num > 0)
            {
                StateSelector.SelectState(SkillEditor.SelectedFsm.get_States()[num - 1]);
            }
            StateSelector.autoScroll = true;
        }
Ejemplo n.º 3
0
        private static void SelectNext()
        {
            if (SkillEditor.SelectedState == null)
            {
                return;
            }
            int num = Array.IndexOf <SkillState>(SkillEditor.SelectedFsm.get_States(), SkillEditor.SelectedState);

            if (num < SkillEditor.SelectedFsm.get_States().Length - 1)
            {
                StateSelector.SelectState(SkillEditor.SelectedFsm.get_States()[num + 1]);
            }
            StateSelector.autoScroll = true;
        }
Ejemplo n.º 4
0
        private static void DoStateRow(SkillState state)
        {
            GUIContent gUIContent = new GUIContent(state.get_Name(), state.get_Name());

            if (SkillEditorGUILayout.TableRow(new GUIContent[]
            {
                gUIContent
            }, new float[]
            {
                1f
            }, SkillEditor.SelectedState == state, FsmErrorChecker.StateHasErrors(state), new GUILayoutOption[0]) >= 0)
            {
                StateSelector.SelectState(state);
                GUIUtility.ExitGUI();
            }
            if (state == SkillEditor.SelectedState && Event.get_current().get_type() == 7)
            {
                StateSelector.selectedRect = GUILayoutUtility.GetLastRect();
                StateSelector.selectedRect.set_y(StateSelector.selectedRect.get_y() - StateSelector.scrollPosition.y);
            }
        }
Ejemplo n.º 5
0
        private static void HandleKeyboardInput()
        {
            if (!Keyboard.IsGuiEventKeyboardShortcut())
            {
                return;
            }
            switch (Event.get_current().get_keyCode())
            {
            case 273:
                StateSelector.SelectPrevious();
                break;

            case 274:
                StateSelector.SelectNext();
                break;

            default:
                return;
            }
            Event.get_current().Use();
            GUIUtility.ExitGUI();
        }