예제 #1
0
    /// <summary>
    /// 提交按钮
    /// </summary>
    public void OnClickSubmit()
    {
        UIGameText   uiGameText = (UIGameText)uiComponent;
        GameDataBean gameData   = GameDataHandler.Instance.manager.GetGameData();

        AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal);
        //检测是否启用小游戏
        if (CheckUtil.StringIsNull(textData.pre_data_minigame))
        {
            List <PreTypeBean> listPre = PreTypeEnumTools.GetListPreData(textData.pre_data);
            foreach (PreTypeBean itemPreData in listPre)
            {
                PreTypeEnumTools.GetPreDetails(itemPreData, gameData);
                if (!itemPreData.isPre)
                {
                    ToastHandler.Instance.ToastHint(itemPreData.spPreIcon, itemPreData.preFailStr);
                    return;
                }
            }
            //完成前置条件
            PreTypeEnumTools.CompletePre(listPre, gameData);
            //完成所有奖励
            RewardTypeEnumTools.CompleteReward(null, textData.reward_data);
            uiGameText.SelectText(textData);
        }
        else
        {
            DialogBean dialogBean = new DialogBean();
            PickForCharacterDialogView dialogView = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogBean);
            PreTypeForMiniGameEnumTools.GetPlayerNumber(textData.pre_data_minigame, out int playerNumber);
            dialogView.SetPickCharacterMax(playerNumber);
        }
    }
    /// <summary>
    /// 提交晋升
    /// </summary>
    public void OnClickSubmit()
    {
        AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal);
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        if (isAllPre)
        {
            //前置如果有需要临时支付的条件
            PreTypeEnumTools.CompletePre(storeInfo.pre_data, gameData);
            //获取所有奖励
            RewardTypeEnumTools.CompleteReward(null, storeInfo.reward_data);
            //客栈升级
            gameData.innAttributes.SetInnLevelUp();

            ToastHandler.Instance.ToastHint(ivTitleIcon.sprite, TextHandler.Instance.manager.GetTextById(1062));
            UIHandler.Instance.manager.OpenUIAndCloseOther <UIGameMain>(UIEnum.GameMain);

            DialogBean            dialogData        = new DialogBean();
            AchievementDialogView achievementDialog = DialogHandler.Instance.CreateDialog <AchievementDialogView>(DialogEnum.Achievement, this, dialogData);
            achievementDialog.SetData(storeInfo);
        }
        else
        {
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1061));
        }
    }