public void Submit(DialogView dialogView, DialogBean dialogBean) { if (dialogView as PickForCharacterDialogView) { PickForCharacterDialogView pickForCharacterDialog = dialogView as PickForCharacterDialogView; UserInfiniteTowersBean infiniteTowersData = new UserInfiniteTowersBean(); List <CharacterBean> listMembers = pickForCharacterDialog.GetPickCharacter(); GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (dialogBean.dialogPosition == 0) { //亲自 infiniteTowersData.isSend = false; foreach (CharacterBean itemCharacter in listMembers) { infiniteTowersData.listMembers.Add(itemCharacter.baseInfo.characterId); } gameData.AddInfinteTowersData(infiniteTowersData); //跳转场景 GameCommonInfo.SetInfiniteTowersPrepareData(infiniteTowersData); GameScenesHandler.Instance.ChangeScene(ScenesEnum.GameInfiniteTowersScene); } else if (dialogBean.dialogPosition == 1) { //派遣 infiniteTowersData.isSend = true; //检测 foreach (CharacterBean itemCharacter in listMembers) { WorkerStatusEnum workerStatusEnum = itemCharacter.baseInfo.GetWorkerStatus(); if (workerStatusEnum != WorkerStatusEnum.Rest && workerStatusEnum != WorkerStatusEnum.Work) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1142)); return; } } //派遣 foreach (CharacterBean itemCharacter in listMembers) { infiniteTowersData.listMembers.Add(itemCharacter.baseInfo.characterId); itemCharacter.baseInfo.SetWorkerStatus(WorkerStatusEnum.InfiniteTowers); } //计算每层攀登几率 infiniteTowersData.InitSuccessRate(GameItemsHandler.Instance.manager, listMembers); gameData.AddInfinteTowersData(infiniteTowersData); RefreshUI(); } } else { if (dialogBean.dialogPosition == 1) { //重置所有爬塔记录 GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); gameData.CleanInfinteTowers(); RefreshUI(); } } }
public void Submit(DialogView dialogView, DialogBean dialogBean) { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (dialogView as PickForCharacterDialogView) { //角色选择 PickForCharacterDialogView pickForCharacterDialog = dialogView as PickForCharacterDialogView; List <CharacterBean> listPickCharacter = pickForCharacterDialog.GetPickCharacter(); if (!CheckUtil.ListIsNull(listPickCharacter)) { SortedList <IngredientsEnum, long> listIng = menuOwnData.GetResearchIngredients(foodData); bool hasEnoughIng = true; foreach (var itemIng in listIng) { if (!gameData.HasEnoughIng(itemIng.Key, itemIng.Value)) { hasEnoughIng = false; break; } } if (!hasEnoughIng) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1045)); return; } foreach (var itemIng in listIng) { gameData.DeductIng(itemIng.Key, itemIng.Value); } //开始研究 menuOwnData.StartResearch(listPickCharacter); string toastStr = string.Format(TextHandler.Instance.manager.GetTextById(1201), listPickCharacter[0].baseInfo.name, foodData.name); ToastHandler.Instance.ToastHint(ivFood.sprite, toastStr); } } else { //如果是研究中则询问 if (menuOwnData.GetMenuStatus() == ResearchStatusEnum.Researching) { //普通弹窗(取消研究) menuOwnData.CancelResearch(gameData); } else { } } //重新设置数据 SetData(menuOwnData, foodData); }
public void Submit(DialogView dialogView, DialogBean dialogBean) { if (CheckUtil.StringIsNull(textData.pre_data_minigame)) { return; } UIGameText uiGameText = (UIGameText)uiComponent; PickForCharacterDialogView pickDialog = dialogView as PickForCharacterDialogView; if (uiGameText.callBack != null) { uiGameText.callBack.UITextSelectResult(textData, pickDialog.GetPickCharacter()); } }
public override void Submit(DialogView dialogView, DialogBean dialogBean) { base.Submit(dialogView, dialogBean); if (dialogView as PickForCharacterDialogView) { PickForCharacterDialogView pickForCharacterDialog = dialogView as PickForCharacterDialogView; List <CharacterBean> listPickCharacter = pickForCharacterDialog.GetPickCharacter(); if (!CheckUtil.ListIsNull(listPickCharacter)) { characterData = listPickCharacter[0]; ClearData(); } } else { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (gameData.HasEnoughMoney(priceL, priceM, priceS)) { gameData.PayMoney(priceL, priceM, priceS); if (!CheckUtil.StringIsNull(selectSkin)) { characterData.body.skin = selectSkin; characterData.body.skinColor = cvSkin.GetColorBean(); } if (!CheckUtil.StringIsNull(selectEye)) { characterData.body.eye = selectEye; characterData.body.eyeColor = cvEye.GetColorBean(); } if (!CheckUtil.StringIsNull(selectMouth)) { characterData.body.mouth = selectMouth; characterData.body.mouthColor = cvMouth.GetColorBean(); } if (!CheckUtil.StringIsNull(selectHair)) { characterData.body.hair = selectHair; characterData.body.hairColor = cvHair.GetColorBean(); } ClearData(); } else { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1005)); } } }
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); } } }
public void Submit(DialogView dialogView, DialogBean dialogBean) { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (dialogView is PickForCharacterDialogView) { buildBedData.GetResearchPrice(out long researchPriceL, out long researchPriceM, out long researchPriceS); //先判断一下是否有钱支付 if (!gameData.HasEnoughMoney(researchPriceL, researchPriceM, researchPriceS)) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1005)); return; } //扣除金钱 gameData.PayMoney(researchPriceL, researchPriceM, researchPriceS); //角色选择 PickForCharacterDialogView pickForCharacterDialog = dialogView as PickForCharacterDialogView; List <CharacterBean> listPickCharacter = pickForCharacterDialog.GetPickCharacter(); if (!CheckUtil.ListIsNull(listPickCharacter)) { //开始研究 buildBedData.StartResearch(listPickCharacter); string toastStr = string.Format(TextHandler.Instance.manager.GetTextById(1201), listPickCharacter[0].baseInfo.name, buildBedData.bedName); ToastHandler.Instance.ToastHint(toastStr); } } else if (dialogView is InputTextDialogView) { InputTextDialogView inputTextDialog = dialogView as InputTextDialogView; string bedName = inputTextDialog.GetText(); if (!CheckUtil.StringIsNull(bedName)) { buildBedData.bedName = bedName; } } else { if (dialogBean.dialogPosition == 1) { if (buildBedData.GetBedStatus() == ResearchStatusEnum.Researching) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1313)); return; } if (buildBedData.isSet) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1314)); return; } //丢弃确认 gameData.RemoveBed(buildBedData); uiComponent.RefreshUI(); } else if (dialogBean.dialogPosition == 2) { //普通弹窗(取消研究) buildBedData.CancelResearch(gameData); } } //重新设置数据 if (gameObject) { SetData(buildBedData); } }