Example #1
0
    private void SetModel()
    {
        m_helpBufEvent = MainMenuUtil.checkHelpBufEvent();
        CheckSkillUpEvent();
        m_unitBufEvent = (MainMenuParam.m_BlendBuildEventSLV != 0);
        m_footer       = new MainMenuFooterModel();

        m_footer.OnDisappearingBegan += () =>
        {
            PlayAnimation(DisappearAnimationName);
        };

        m_footer.OnAppeared += () =>
        {
            m_isFooterAppeared = true;
            m_helpButton       = ButtonList[(int)FOOTER_MENU_TYPE.QUEST].GetComponentInChildren <MainMenuFooterHelpButton>();
            if (m_helpButton != null)
            {
                if (MainMenuManager.Instance != null &&
                    MainMenuManager.Instance.currentCategory == MAINMENU_CATEGORY.QUEST)
                {
                    m_helpButton.setBufEvent(false);
                }
                else
                {
                    if (MainMenuParam.m_PartyAssignPrevPage == MAINMENU_SEQ.SEQ_QUEST_SELECT_PARTY)
                    {
                        m_helpButton.setBufEvent(false);
                    }
                    else
                    {
                        m_helpButton.setBufEvent(true);
                    }
                }
            }
            m_unitsButton = ButtonList[(int)FOOTER_MENU_TYPE.UNITS].GetComponentInChildren <MainMenuFooterUnitsButton>();
            if (m_unitsButton != null)
            {
                if (MainMenuManager.Instance != null &&
                    MainMenuManager.Instance.currentCategory == MAINMENU_CATEGORY.UNIT)
                {
                    m_unitsButton.setBufEvent(false);
                }
                else
                {
                    m_unitsButton.setBufEvent(true);
                }
            }
            m_gachaButton = ButtonList[(int)FOOTER_MENU_TYPE.SCRATCH].GetComponentInChildren <MainMenuFooterGachaButton>();
            if (m_gachaButton != null)
            {
                bool bFlag = MasterDataUtil.CheckFirstTimeFree();
                m_gachaButton.SetFlag(bFlag);
            }
        };
    }
Example #2
0
    private void AddButtons()
    {
        var createViewMap = new List <System.Func <GameObject, MainMenuFooterButtonModel, ButtonView> >
        {
            (GameObject parent, MainMenuFooterButtonModel model) =>
            {
                return(MainMenuFooterHomeButton.
                       Attach(parent).
                       SetModel(model.AddCategory(MAINMENU_CATEGORY.HOME)));
            },
            (GameObject parent, MainMenuFooterButtonModel model) =>
            {
                return(MainMenuFooterUnitsButton.
                       Attach(parent).
                       SetModel(model.AddCategory(MAINMENU_CATEGORY.UNIT), m_unitBufEvent));
            },
            (GameObject parent, MainMenuFooterButtonModel model) =>
            {
                return(MainMenuFooterGachaButton.
                       Attach(parent).
                       SetModel(model.AddCategory(MAINMENU_CATEGORY.GACHA)));
            },
            (GameObject parent, MainMenuFooterButtonModel model) =>
            {
                return(MainMenuFooterShopButton.
                       Attach(parent).
                       SetModel(model.AddCategory(MAINMENU_CATEGORY.SHOP)));
            },
            (GameObject parent, MainMenuFooterButtonModel model) =>
            {
                return(MainMenuFooterHelpButton.
                       Attach(parent).
                       SetModel(model.AddCategory(MAINMENU_CATEGORY.QUEST), m_helpBufEvent));
            }
        };

        int size = m_buttonRoots.Length;

        UnityEngine.Debug.Assert(createViewMap.Count == size, "The count of footer button gameObjects is invalid.");

        for (int i = 0; i < size; i++)
        {
            int index  = i;
            var button = new MainMenuFooterButtonModel();
            button.OnClicked += () =>
            {
                // TODO : OnTouchMenuが整理されたらここも新しい処理に切り替える
                OnTouchMenu((FOOTER_MENU_TYPE)index);
            };

            ButtonList[index] = createViewMap[index](m_buttonRoots[index], button).GetRoot();

            m_buttons.Add(button);
        }

        m_buttons[0].isSelected = true;

        //戻るボタン
        {
            var retBtnModel = new ButtonModel();
            retBtnModel.OnClicked += () =>
            {
                OnSelectReturn();
            };

            MainMenuFooterReturnButton.Attach(returnButton).SetModel(retBtnModel);

            retBtnModel.Appear();
        }
    }