コード例 #1
0
    private void CheckRecommend()
    {
        Array modeArray = Enum.GetValues(typeof(GameSystem.Mode));
        List <GameSystem.Mode> lockedModesHP = new List <GameSystem.Mode>(modeArray.Length);
        List <GameSystem.Mode> lockedModesLP = new List <GameSystem.Mode>(modeArray.Length);

        foreach (GameSystem.Mode mode in modeArray)
        {
            if (PlayerProfile.LoadModeUnlock(mode) == false)
            {
                if (ArrayTool.Constains(Constant.RECOMMEND_ORDER_HIGH_PRIORITY, mode))
                {
                    lockedModesHP.Add(mode);
                }
                else if (ArrayTool.Constains(Constant.RECOMMEND_ORDER_LOW_PRIORITY, mode))
                {
                    lockedModesLP.Add(mode);
                }
            }
        }

        if (ENTER_TIMES > 0 && ENTER_TIMES % Constant.RECOMMEND_TRIGGER_TIMES == 0)
        {
            if (lockedModesHP.Count > 0)
            {
                GameSystem.GetInstance().RecommendMode = RandomTool.Element(lockedModesHP);
            }
            else if (lockedModesLP.Count > 0)
            {
                GameSystem.GetInstance().RecommendMode = RandomTool.Element(lockedModesLP);
            }
            else
            {
                return;
            }

            string title = string.Format(TextManager.GetText("recommend_mode_title"), TextManager.GetText(string.Format("mode_name_{0}", (int)GameSystem.GetInstance().RecommendMode)));
            string yesButtonText = string.Format(TextManager.GetText("unlock_condition"), Constant.MODE_UNLOCK_COIN[(int)GameSystem.GetInstance().RecommendMode]);
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.SetRecommendMode(GameSystem.GetInstance().RecommendMode);
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.SetConfirmCallback(RecommendConfirmCallback);
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.SetContent(title, null, ConfirmStyle.YesNoClose);
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.SetYesButtonText(yesButtonText);
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.SetNoButtonText(TextManager.GetText("trial"));
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.DisableNextYesSound();
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.DisableNextNoSound();
            GameSystem.GetInstance().gameUI.recommendConfirmMenu.Show(true);
        }
    }