示例#1
0
    public void Submit(DialogView dialogView, DialogBean dialogBean)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //支付金钱
        gameData.PayMoney(levelData.price_l, levelData.price_m, levelData.price_s);
        //扣除时间
        int preGameTime = int.Parse(levelData.mark);

        //扣除时间
        GameTimeHandler.Instance.AddHour(preGameTime);
        //如果有研究菜谱 菜谱增加经验
        GameDataHandler.Instance.AddTimeProcess(preGameTime * 60);
        //判断玩哪个游戏
        MiniGameBaseBean miniGameData = null;

        switch (workerType)
        {
        case WorkerEnum.Chef:
            miniGameData = InitChefGame();
            break;

        case WorkerEnum.Waiter:
            //设置弹幕游戏数据
            miniGameData = InitWaiterGame();
            break;

        case WorkerEnum.Accountant:
            //设置算账游戏
            miniGameData = InitAccountantGame();
            break;

        case WorkerEnum.Accost:
            //设置辩论游戏
            miniGameData = InitAccostGame();
            break;

        case WorkerEnum.Beater:
            miniGameData = InitBeaterGame();
            break;

        default:
            break;
        }
        miniGameData.preGameTime = preGameTime;
        miniGameData.gameReason  = MiniGameReasonEnum.Improve;
        if (dialogBean.dialogPosition == 0)
        {
            //设置竞技场数据
            GameCommonInfo.SetArenaPrepareData(miniGameData);
            //保存之前的位置
            GameCommonInfo.ScenesChangeData.beforeUserPosition = GameControlHandler.Instance.manager.GetControl <BaseControl>(ControlEnum.Normal).transform.position;
            //跳转到竞技场
            GameScenesHandler.Instance.ChangeScene(ScenesEnum.GameArenaScene);
        }
        else
        {
            bool isWin = characterData.CalculationGuildSendWin(miniGameData.gameType);
            if (isWin)
            {
                ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7021));
                AudioHandler.Instance.PlaySound(AudioSoundEnum.Reward);
                //完成奖励
                RewardTypeEnumTools.CompleteReward(miniGameData.GetListUserCharacterData(), miniGameData.listReward);

                //数据添加
                Sprite attributeIcon          = IconDataHandler.Instance.manager.GetIconSpriteByName("keyboard_button_up_1");
                string attributeRewardContent = "";
                foreach (MiniGameCharacterBean miniGameCharacterData in miniGameData.listUserGameData)
                {
                    switch (miniGameData.gameType)
                    {
                    case MiniGameEnum.Cooking:
                        attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Cook) + " +5";
                        miniGameCharacterData.characterData.baseInfo.chefInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                        break;

                    case MiniGameEnum.Barrage:
                        attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + " +5";
                        miniGameCharacterData.characterData.baseInfo.waiterInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                        break;

                    case MiniGameEnum.Account:
                        attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " +5";
                        miniGameCharacterData.characterData.baseInfo.accountantInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                        break;

                    case MiniGameEnum.Debate:
                        attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " +5";
                        miniGameCharacterData.characterData.baseInfo.accostInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                        break;

                    case MiniGameEnum.Combat:
                        attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " +5";
                        miniGameCharacterData.characterData.baseInfo.beaterInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                        break;
                    }
                }
                ToastHandler.Instance.ToastHint(attributeIcon, attributeRewardContent);
                //刷新UI
                ((UITownGuildImprove)uiComponent).RefreshUI();
            }
            else
            {
                ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7022));
                AudioHandler.Instance.PlaySound(AudioSoundEnum.Passive);
            }
        }
    }
示例#2
0
    public void Submit(DialogView dialogView, DialogBean dialogBean)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        if (dialogView as PickForCharacterDialogView)
        {
            //判断时间是否过晚
            GameTimeHandler.Instance.GetTime(out float hour, out float min);
            if (hour >= 21 || hour < 6)
            {
                ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1034));
                return;
            }
            //支付金钱
            gameData.PayMoney(miniGameData.preMoneyL, miniGameData.preMoneyM, miniGameData.preMoneyS);
            //扣除时间
            GameTimeHandler.Instance.AddHour(miniGameData.preGameTime);
            //如果有研究菜谱 菜谱增加经验
            GameDataHandler.Instance.AddTimeProcess(miniGameData.preGameTime * 60);
            //设置参赛人员
            PickForCharacterDialogView pickForCharacterDialog = dialogView as PickForCharacterDialogView;
            List <CharacterBean>       listCharacter          = pickForCharacterDialog.GetPickCharacter();
            miniGameData.InitData(listCharacter);
            //今日不能再参加
            GameCommonInfo.DailyLimitData.AddArenaAttendedCharacter(listCharacter);
            //删除该条数据
            GameCommonInfo.DailyLimitData.RemoveArenaDataByType(trophyType, miniGameData);

            if (arenaJoinType == 1)
            {
                //设置竞技场数据
                GameCommonInfo.SetArenaPrepareData(miniGameData);
                //保存之前的位置
                GameCommonInfo.ScenesChangeData.beforeUserPosition = GameControlHandler.Instance.manager.GetControl <BaseControl>(GameControlHandler.ControlEnum.Normal).transform.position;
                //跳转到竞技场
                GameScenesHandler.Instance.ChangeScene(ScenesEnum.GameArenaScene);
            }
            else if (arenaJoinType == 2)
            {
                //刷新UI
                ((UITownArena)uiComponent).RefreshUI();
                CharacterBean character = listCharacter[0];
                bool          isWin     = character.CalculationArenaSendWin(miniGameData.gameType);
                if (isWin)
                {
                    ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7011));
                    AudioHandler.Instance.PlaySound(AudioSoundEnum.Reward);
                    //设置不记录
                    foreach (RewardTypeBean rewardData in miniGameData.listReward)
                    {
                        if (rewardData.GetRewardType() == RewardTypeEnum.AddArenaTrophyAdvanced ||
                            rewardData.GetRewardType() == RewardTypeEnum.AddArenaTrophyElementary ||
                            rewardData.GetRewardType() == RewardTypeEnum.AddArenaTrophyIntermediate ||
                            rewardData.GetRewardType() == RewardTypeEnum.AddArenaTrophyLegendary)
                        {
                            rewardData.isRecord = false;
                        }
                    }
                    //完成奖励
                    RewardTypeEnumTools.CompleteReward(listCharacter, miniGameData.listReward);
                }
                else
                {
                    ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7012));
                    AudioHandler.Instance.PlaySound(AudioSoundEnum.Passive);
                }
            }
        }
        else
        {
            //弹出选人界面
            DialogBean dialogData = new DialogBean();
            PickForCharacterDialogView pickForCharacterDialog = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogData);
            pickForCharacterDialog.SetPickCharacterMax(1);
            List <string> listExpelCharacterId = new List <string>();
            //排出今日已经参加过的人
            List <string> listAttendedCharacterId = GameCommonInfo.DailyLimitData.GetArenaAttendedCharacter();
            //排出等级不符合的人
            List <CharacterBean> listWorker = gameData.GetAllCharacterData();
            foreach (CharacterBean itemWorker in listWorker)
            {
                bool isExpel = false;
                CharacterWorkerBaseBean workerInfo = null;
                switch (gameType)
                {
                case MiniGameEnum.Cooking:
                    workerInfo = itemWorker.baseInfo.GetWorkerInfoByType(WorkerEnum.Chef);
                    break;

                case MiniGameEnum.Barrage:
                    workerInfo = itemWorker.baseInfo.GetWorkerInfoByType(WorkerEnum.Waiter);
                    break;

                case MiniGameEnum.Account:
                    workerInfo = itemWorker.baseInfo.GetWorkerInfoByType(WorkerEnum.Accountant);
                    break;

                case MiniGameEnum.Debate:
                    workerInfo = itemWorker.baseInfo.GetWorkerInfoByType(WorkerEnum.Accost);
                    break;

                case MiniGameEnum.Combat:
                    workerInfo = itemWorker.baseInfo.GetWorkerInfoByType(WorkerEnum.Beater);
                    break;
                }
                int workLevel = workerInfo.GetLevel();
                switch (trophyType)
                {
                case TrophyTypeEnum.Elementary:
                    if (workLevel != 0 && workLevel != 1)
                    {
                        isExpel = true;
                    }
                    break;

                case TrophyTypeEnum.Intermediate:
                    if (workLevel != 2 && workLevel != 3)
                    {
                        isExpel = true;
                    }
                    break;

                case TrophyTypeEnum.Advanced:
                    if (workLevel != 4 && workLevel != 5)
                    {
                        isExpel = true;
                    }
                    break;

                case TrophyTypeEnum.Legendary:
                    if (workLevel != 6)
                    {
                        isExpel = true;
                    }
                    break;
                }
                if (isExpel)
                {
                    listExpelCharacterId.Add(itemWorker.baseInfo.characterId);
                }
            }
            listExpelCharacterId.AddRange(listAttendedCharacterId);
            pickForCharacterDialog.SetExpelCharacter(listExpelCharacterId);
            if (miniGameData.gameType == MiniGameEnum.Combat)
            {
                pickForCharacterDialog.SetPickCharacterMax(miniGameData.winBringDownNumber);
            }
        }
    }