예제 #1
0
    protected override void OnFirstShow()
    {
        _disableOnHide = false;

        _menuInOutAnimation = gameObject.AddComponent <MenuAnimation>();
        _menuInOutAnimation.TransitionOutFinished += InOutAnimation_Finished;

        _menuTransitionAnimation = gameObject.AddComponent <MenuTransitionAnimation>();

        CyclicalList         = new CyclicalList <MenuBase>(_menus);
        CyclicalList.Wrapped = true;
        CyclicalList.Moved  += Menu_Moved;

        // Menu input.
        _menuInput = new MenuInput(this);
        _menuInput.InputEnabled = true;

        // Make sure all menus are hidden by default and set the current menu.
        for (int i = 0; i < _menus.Count; i++)
        {
            // Add a button for each menu.
            _menuButtons.AddButton(_menus[i], _menus[i].name);

            if (i == 0)
            {
                CurrentMenu = _menus[i];
            }

            _menus[i].gameObject.SetActive(false);
        }

        _menuButtons.ButtonPressed += MenuButton_OnPressed;
    }