Exemple #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 OnClickForSend()
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal);
        DialogBean dialogData = new DialogBean();

        dialogData.dialogPosition = 1;
        PickForCharacterDialogView pickForCharacterDialog = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogData);
        //排除主角和不能参加的人
        List <string>        listExpel     = new List <string>();
        List <CharacterBean> listCharacter = gameData.GetAllCharacterData();

        for (int i = 0; i < listCharacter.Count; i++)
        {
            CharacterBean itemCharacter = listCharacter[i];
            if (itemCharacter == gameData.userCharacter ||
                (itemCharacter.baseInfo.GetWorkerStatus() != WorkerStatusEnum.Rest && itemCharacter.baseInfo.GetWorkerStatus() != WorkerStatusEnum.Work))
            {
                listExpel.Add(itemCharacter.baseInfo.characterId);
            }
        }
        pickForCharacterDialog.SetExpelCharacter(listExpel);
        pickForCharacterDialog.SetPickCharacterMax(3);
    }
Exemple #3
0
    public void OnClickForSelectCharacter()
    {
        DialogBean dialogData = new DialogBean();
        PickForCharacterDialogView pickForCharacterDialog = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogData);

        pickForCharacterDialog.SetPickCharacterMax(1);
    }
Exemple #4
0
    /// <summary>
    /// 点击研究
    /// </summary>
    public void OnClickResearch()
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal);
        //首先判断客栈等级是否足够
        if (!menuOwnData.CheckCanResearch(gameData, out string failStr))
        {
            ToastHandler.Instance.ToastHint(failStr);
            return;
        }

        DialogBean dialogData = new DialogBean
        {
            title = TextHandler.Instance.manager.GetTextById(3071)
        };
        PickForCharacterDialogView pickForCharacterDialog = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogData);

        pickForCharacterDialog.SetPickCharacterMax(1);
        //设置排出人员 (老板和没有在休息的员工)
        List <CharacterBean> listCharacter = gameData.listWorkerCharacter;
        List <string>        listExpelIds  = new List <string>();

        listExpelIds.AddRange(gameData.GetAllFamilyCharacterIds());
        foreach (CharacterBean itemData in listCharacter)
        {
            //休息日 排出不是工作或者休息的
            if (GameTimeHandler.Instance.GetDayStatus() == GameTimeHandler.DayEnum.Rest)
            {
                if (itemData.baseInfo.GetWorkerStatus() != WorkerStatusEnum.Rest && itemData.baseInfo.GetWorkerStatus() != WorkerStatusEnum.Work)
                {
                    listExpelIds.Add(itemData.baseInfo.characterId);
                }
            }
            //工作日 排出除休息中的所有员工
            else if (GameTimeHandler.Instance.GetDayStatus() == GameTimeHandler.DayEnum.Work)
            {
                if (itemData.baseInfo.GetWorkerStatus() != WorkerStatusEnum.Rest)
                {
                    listExpelIds.Add(itemData.baseInfo.characterId);
                }
            }
        }
        pickForCharacterDialog.SetExpelCharacter(listExpelIds);
    }
Exemple #5
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);
            }
        }
    }