コード例 #1
0
    /// <summary>
    /// Adds a Stacked Menu to the Hierarchy
    /// </summary>
    /// <param name="menu">FluxMenu to Add to the Hierarchy</param>
    public void AddStackedMenu(FluxMenu menu)
    {
        if (CurrentMenu == menu)
        {
            return;
        }

        if (CurrentMenu && !CurrentMenu.IsOpen || menu.GetAnimationState() != FluxMenu.AnimationState.CloseIdle)
        {
            return;
        }

        if (!menu.Popup)
        {
            foreach (FluxMenu prevMenu in MenuStack)
            {
                HideMenu(prevMenu);
            }
        }

        if (CurrentMenu && CurrentMenu.Popup)
        {
            HideMenu(MenuStack.Pop());
            CurrentMenu = null;
        }

        MenuStack.Push(menu);

        ShowMenu(menu);
    }
コード例 #2
0
    /// <summary>
    /// Adds a Stacked Menu to the Hierarchy 
    /// </summary>
    /// <param name="menu">FluxMenu to Add to the Hierarchy</param>
    public void AddStackedMenu(FluxMenu menu)
    {
        if (CurrentMenu == menu)
            return;

        if (CurrentMenu && !CurrentMenu.IsOpen || menu.GetAnimationState() != FluxMenu.AnimationState.CloseIdle)
            return;

        if (!menu.Popup)
        {
            foreach (FluxMenu prevMenu in MenuStack)
            {
                HideMenu(prevMenu);
            }
        }

        if (CurrentMenu && CurrentMenu.Popup)
        {
            HideMenu(MenuStack.Pop());
            CurrentMenu = null;
        }

        MenuStack.Push(menu);

        ShowMenu(menu);
    }
コード例 #3
0
    /// <summary>
    /// Go to the Previous Menu of the Hierarchy
    /// </summary>
    public void GotoPrevious()
    {
        FluxMenu PrevMenu = MenuStack.Count > 0 ? MenuStack.Pop() : null;
        FluxMenu TopMenu  = MenuStack.Count > 0 ? MenuStack.Peek() : null;

        if (TopMenu && PrevMenu)
        {
            if (CurrentMenu && CurrentMenu.IsOpen &&
                (TopMenu.GetAnimationState() == FluxMenu.AnimationState.CloseIdle && !PrevMenu.Popup) ||
                (TopMenu.GetAnimationState() == FluxMenu.AnimationState.OpenIdle && PrevMenu.Popup))
            {
                if (MenuStack.Count > 0)
                {
                    ShowMenu(TopMenu);
                }
                else
                {
                    ShowMenu(null);
                }
            }
            else
            {
                MenuStack.Push(PrevMenu);
            }
        }
        else
        {
            MenuStack.Push(PrevMenu);
        }
    }
コード例 #4
0
ファイル: FluxMenuEditor.cs プロジェクト: hilfor/FirstChild
    public override void OnInspectorGUI()
    {
        FluxMenu menu = (FluxMenu)target;

        if (menu.StateManager == null)
        {
            menu.StateManager = FindMenuStateManager();
            if (!menu.StateManager)
            {
                return;
            }
        }

        GUI.backgroundColor = Color.gray;
        FluxEditor.BeginGroup();

        FluxEditor.BeginGroup("Flux Menu", new Color(1, 0.77f, 0.05f), 2, 1);
        FluxEditor.EndGroup();
        GUI.color           = Color.white;
        GUI.backgroundColor = Color.white;

        if (menu.GetMenuManager().DefaultMenu == menu)
        {
            DrawSplitter();
            GUI.contentColor = new Color(1, 0.77f, 0.05f);
            EditorGUILayout.HelpBox("This is the Default Menu", MessageType.Info);
            GUI.contentColor = Color.white;
        }
        if ((menu.GetMenuManager().ExitMenu == menu))
        {
            DrawSplitter();
            GUI.contentColor = new Color(1, 0.77f, 0.05f);
            EditorGUILayout.HelpBox("This is the Exit Menu", MessageType.Info);
            GUI.contentColor = Color.white;
        }
        DrawSplitter();
        EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);
        menu.Popup = EditorGUILayout.Toggle("Popup", menu.Popup);
        DrawSplitter();

        EditorGUILayout.BeginHorizontal();
        if (FluxEditor.Button("Make This Default"))
        {
            MakeDefault();
        }

        if (FluxEditor.Button("Make This Exit"))
        {
            MakeExit();
        }
        EditorGUILayout.EndHorizontal();

        FluxEditor.EndGroup();

        EditorUtility.SetDirty(menu);
    }
コード例 #5
0
ファイル: FluxMenuEditor.cs プロジェクト: hilfor/FirstChild
    private FluxMenuStateManager FindMenuStateManager()
    {
        FluxMenu menu = (FluxMenu)target;

        Transform t = menu.gameObject.transform;

        while (t.parent != null)
        {
            if (t.parent.GetComponent <FluxMenuStateManager>())
            {
                return(t.parent.gameObject.GetComponent <FluxMenuStateManager>());
            }
            t = t.parent.transform;
        }
        return(null);
    }
コード例 #6
0
    /// <summary>
    /// Displays a Menu
    /// </summary>
    /// <param name="Current">Menu to be Displayed</param>
    void ShowMenu(FluxMenu Current)
    {
        bool isPrevPop = false;

        if (CurrentMenu != null && !Current.Popup)
        {
            isPrevPop = CurrentMenu.Popup;
            HideMenu(CurrentMenu);
            CurrentMenu = null;
        }

        if (Current)
        {
            CurrentMenu = Current;
            CurrentMenu.Show();
            if (!isPrevPop)
            {
                // It should be already opened
                CurrentMenu.IsOpen = true;
            }
        }
    }
コード例 #7
0
    /// <summary>
    /// Removes all the Previous Hierarachy and Adds a Stacked Menu
    /// </summary>
    /// <param name="menu">FluxMenu to Add to the Hierarchy</param>
    public void SetCurrentMenu(FluxMenu menu)
    {
        if (CurrentMenu == menu)
        {
            return;
        }

        if (CurrentMenu && !CurrentMenu.IsOpen || menu.GetAnimationState() != FluxMenu.AnimationState.CloseIdle)
        {
            return;
        }

        foreach (FluxMenu prevMenu in MenuStack)
        {
            HideMenu(prevMenu);
        }

        CurrentMenu = null;

        MenuStack.Clear();

        AddStackedMenu(menu);
    }
コード例 #8
0
    /// <summary>
    /// Displays a Menu
    /// </summary>
    /// <param name="Current">Menu to be Displayed</param>
    void ShowMenu(FluxMenu Current)
    {
        bool isPrevPop = false;

        if (CurrentMenu != null && !Current.Popup)
        {
            isPrevPop = CurrentMenu.Popup;
            HideMenu(CurrentMenu);
            CurrentMenu = null;
        }

        if (Current)
        {
            CurrentMenu = Current;
            CurrentMenu.Show();
            if (!isPrevPop)
            {
                // It should be already opened
                CurrentMenu.IsOpen = true;
            }
        }
    }
コード例 #9
0
 /// <summary>
 /// Hides the Menu
 /// </summary>
 /// <param name="menu">Menu to be hidden</param>
 void HideMenu(FluxMenu menu)
 {
     menu.IsOpen = false;
 }
コード例 #10
0
    /// <summary>
    /// Removes all the Previous Hierarachy and Adds a Stacked Menu
    /// </summary>
    /// <param name="menu">FluxMenu to Add to the Hierarchy</param>
    public void SetCurrentMenu(FluxMenu menu)
    {
        if (CurrentMenu == menu)
            return;

        if (CurrentMenu && !CurrentMenu.IsOpen || menu.GetAnimationState() != FluxMenu.AnimationState.CloseIdle)
            return;

        foreach (FluxMenu prevMenu in MenuStack)
        {
            HideMenu(prevMenu);
        }

        CurrentMenu = null;

        MenuStack.Clear();

        AddStackedMenu(menu);
    }
コード例 #11
0
ファイル: FluxMenuEditor.cs プロジェクト: hilfor/FirstChild
    private void MakeExit()
    {
        FluxMenu menu = (FluxMenu)target;

        menu.MakeExit();
    }
コード例 #12
0
ファイル: FluxMenuEditor.cs プロジェクト: hilfor/FirstChild
    private void MakeDefault()
    {
        FluxMenu menu = (FluxMenu)target;

        menu.MakeDefault();
    }
コード例 #13
0
 /// <summary>
 /// Hides the Menu
 /// </summary>
 /// <param name="menu">Menu to be hidden</param>
 void HideMenu(FluxMenu menu)
 {
     menu.IsOpen = false;
 }