void SmallBattleResponse(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); FBReword = null; if (response != null && response.status != BaseResponse.ERROR) { BattleResponse r = response as BattleResponse; FBReword = r.data; cityFloorManager.ShowReward(FBReword, GoNextFloor); //如果是新手引导点击的 if (IsGuideClick) { Core.Data.guideManger.DelayAutoRun(1.8f); } } else { isCanClick = true; if (response.errorCode == 4002) { JCRestoreEnergyMsg.OpenUI(110015, 110016); } else { ErrorDeal(response.errorCode); } } //UIMiniPlayerController.Instance.freshPlayerInfoView (); //DBUIController.mDBUIInstance.RefreshUserInfo (); }
public override void addItem(BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.data != null) { if (battleResp.data.reward != null) { addItem(battleResp.data.reward); } if (battleResp.data.ext != null) { addItem(battleResp.data.ext.p); } } NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse; if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null) { addItem(fightres.data.rushResult.award); } GetVipGiftResponse res = response as GetVipGiftResponse; if (res != null && res.data != null && res.data.award != null) { addItem(res.data.award); } } }
/// <summary> /// 把战斗结果加入本地数据层 /// </summary> private void handleResponse(BaseHttpRequest request, BattleResponse r) { TemporyData temp = Core.Data.temper; if (r != null) { if (r.data != null) { if (r.data.reward != null && r.data.sync != null) { PlayerManager player = Core.Data.playerManager; player.RTData.curVipLevel = r.data.sync.vip; temp.mPreLevel = player.RTData.curLevel; temp.AfterBattleLv = r.data.sync.lv; } if (r.data.battleData != null) { r.data.battleData.rsty = null; r.data.battleData.rsmg = null; } } } }
void BattleResponseFUC(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); if (response != null) { if (response.status != BaseResponse.ERROR) { BattleResponse r = response as BattleResponse; if (r != null && r.data != null && r.data.reward != null) { Core.Data.playerManager.RTData.curVipLevel = r.data.sync.vip; } r.data.battleData.rsty = null; r.data.battleData.rsmg = null; Core.Data.temper.warBattle = r.data; Core.Data.temper.currentBattleType = TemporyData.BattleType.FightWithFulisa; //跳转至Ban 的场景 JumpToBattleView(); } else { RED.LogError(response.errorCode.ToString()); } } }
/// <summary> /// 分析副本中的碎片 add by wxl /// </summary> /* public void Analysis(){ * foreach (FloorData fdata in FloorConfigList.Values) { * if (fdata != null) { * if (fdata.isBoss == 1) { * if (!floorAndRewardDic.ContainsKey (fdata.specialRewardID)) { * List<int> floorIdList = new List<int> (); * floorIdList.Add (fdata.ID); * int tId = fdata.specialRewardID; * if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Frag) { * SoulData soulConfig = Core.Data.soulManager.GetSoulConfigByNum (fdata.specialRewardID); * * if (soulConfig != null) { * if (soulConfig.type == (int)ItemType.Monster_Frage) { * tId = soulConfig.updateId; * } * } else { * RED.LogWarning (" soul config is null = " + tId); * continue; * } * * } else if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Monster) { * * tId = fdata.specialRewardID; * } else if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Equip) { * tId = fdata.specialRewardID; * * } else { * RED.Log (" other type id = " + tId); * } * * if (!floorAndRewardDic.ContainsKey (tId)) { * floorAndRewardDic.Add (tId, floorIdList); * } else { * List<int> tList = new List<int> (); * floorAndRewardDic.TryGetValue (tId, out tList); * floorAndRewardDic.Remove (tId); * tList.Add (fdata.ID); * floorAndRewardDic.Add (tId, tList); * * } * } else { * List<int> tList = new List<int> (); * floorAndRewardDic.TryGetValue (fdata.specialRewardID, out tList); * floorAndRewardDic.Remove (fdata.specialRewardID); * tList.Add (fdata.ID); * floorAndRewardDic.Add (fdata.specialRewardID, tList); * } * } * } * } * } */ /// <summary> /// 通过宠物或者装备id获得关卡id maybe equip ,frag and monster /// </summary> /// <returns>The floor id by giftid</returns> /// <param name="giftId">Gift identifier.</param> // public List<int> GetFloorIdByGiftId(int giftId){ // List<int> targetId =new List<int>(); // if(giftId != 0){ // // if(floorAndRewardDic.TryGetValue(giftId,out targetId)){ // return targetId; // } // } // return targetId; // } #region 更新地下城状态 public void OnFinishFloor(BaseHttpRequest request, BaseResponse response) { Utils.Assert(request == null, "Request is null."); if (response.status == BaseResponse.ERROR) { return; } if (request.baseType == BaseHttpRequestType.Common_Http_Request) { HttpRequest req = request as HttpRequest; if (req != null) { BaseRequestParam param = req.ParamMem; BattleResponse res = response as BattleResponse; if (param != null) { bool isWin = false; BattleParam bp = param as BattleParam; if (res != null) { if (res.status != BaseResponse.ERROR) { isWin = System.Convert.ToBoolean(res.data.battleData.retCode); isBossOfLastFloor = true; } } else { /*没有返回结果说明是小关(小关100%成功)*/ isWin = true; isBossOfLastFloor = false; } #region 测试代码 //isWin=false; #endregion this.isWinOfLastFloor = isWin; if (bp != null) { OnFinishFloor(bp.doorId, isWin); } } } } }
public override void addItem(BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.data != null) { if (battleResp.data.reward != null) { AddSoul(battleResp.data.reward.p); } if (battleResp.data.ext != null) { AddSoul(battleResp.data.ext.p); } } SecretShopBuyResponse secretshop = response as SecretShopBuyResponse; if (secretshop != null && secretshop.data != null && secretshop.data.p != null) { AddSoul(secretshop.data.p); } GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse; if (GLRResponse != null) { AddSoul(GLRResponse.data); } SevenDaysBuyResponse seven = response as SevenDaysBuyResponse; if (seven != null && seven.data != null) { AddSoul(seven.data.p); } NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse; if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null) { AddSoul(fightres.data.rushResult.award); } GetTresureResponse GTResponse = response as GetTresureResponse; if (GTResponse != null) { AddSoul(GTResponse.data.p); } } }
void StartTest() { try { BattleResponse response = JSON.Instance.ToObject(battleSequence, typeof(BattleResponse)) as BattleResponse; if (response != null) { response.handleResponse(); } Core.Data.temper.warBattle = response.data; Core.Data.temper.currentBattleType = TemporyData.BattleType.BossBattle; Core.SM.beforeLoadLevel(Application.loadedLevelName, SceneName.GAME_BATTLE); AsyncLoadScene.m_Instance.LoadScene(SceneName.GAME_BATTLE); } catch (Exception ex) { ConsoleEx.DebugLog(ex.ToString()); } }
public void fightReward(BaseHttpRequest request, BaseResponse response) { BattleResponse battleResp = response as BattleResponse; if (response != null && response.status != BaseResponse.ERROR) { //开箱子添加得到的道具 Core.Data.monManager.addItem(response); Core.Data.EquipManager.addItem(response); Core.Data.itemManager.addItem(response); Core.Data.playerManager.addItem2(request, response); Core.Data.soulManager.addItem(response); addItem2(request, response); if (request != null && battleResp.data != null) { addCoinOrExp(request, battleResp.data); } } }
//加钱 -- add Exp //减少精力 public void addItem2(BaseHttpRequest request, BaseResponse response) //public override void addItem (BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.data != null) { addCoinOrExp(request, battleResp.data); } //同步精力 体力 神秘商店时间 排行 int JL = -1; int pwr = -1; int rank = -1; if (battleResp != null && battleResp.data != null && battleResp.data.sync != null) { rank = battleResp.data.sync.rank; JL = battleResp.data.sync.eny; pwr = battleResp.data.sync.pwr; } if (JL != -1) { RTData.curJingLi = JL; } if (pwr != -1) { RTData.curTili = pwr; } if (rank != -1) { RTData.curRank = rank; } } }
/*点击BOSS关卡<执行>按钮后服务器返回的数据 * */ void BattleResponseFUC(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); if (response != null) { TemporyData temp = Core.Data.temper; if (response.status != BaseResponse.ERROR) { BattleResponse r = response as BattleResponse; ClientBattleResponse resp = response as ClientBattleResponse; if (r != null) { if (r != null && r.data != null && r.data.reward != null && r.data.sync != null) { Core.Data.playerManager.RTData.curVipLevel = r.data.sync.vip; } r.data.battleData.rsty = null; r.data.battleData.rsmg = null; temp.warBattle = r.data; temp.currentBattleType = TemporyData.BattleType.BossBattle; HttpRequest req = request as HttpRequest; BaseRequestParam param = req.ParamMem; //BattleResponse res = response as BattleResponse; BattleParam bp = param as BattleParam; FloorData floorD = Core.Data.dungeonsManager.getFloorData(bp.doorId); if (r.data.battleData.iswin == 1) { if (floorD != null) { Core.Data.ActivityManager.OnMissionComplete(floorD.name); } } else { if (floorD != null) { Core.Data.ActivityManager.OnMissionFail(floorD.name); } } if (bp.flag == 1) { //add by wxl Core.Data.ActivityManager.OnPurchaseVirtualCurrency(ActivityManager.ChapterType, 1, 10); } } if (resp != null) { temp.currentBattleType = TemporyData.BattleType.BossBattle; temp.clientDataResp = resp; #if LOCAL_AUTO temp.Open_StepMode = false; #else temp.Open_StepMode = true; #endif temp.Open_LocalWarMode = true; HttpRequest req = request as HttpRequest; if (req != null) { ClientBattleParam param = req.ParamMem as ClientBattleParam; if (param != null) { temp.clientReqParam = param; } } } Core.Data.deblockingBuildMgr.mFloorRecord = Core.Data.newDungeonsManager.lastFloorId; //跳转至Ban 的场景 JumpToBattleView(); } else { if (response.errorCode == 4002) { JCRestoreEnergyMsg.OpenUI(110015, 110016); } else { ErrorDeal(response.errorCode); } } } }
public override void addItem(BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.data != null) { if (battleResp.data.reward != null) { addEquipment(battleResp.data.reward); } if (battleResp.data.ext != null) { AddEquip(battleResp.data.ext.p); } } GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse; if (GLRResponse != null) { AddEquip(GLRResponse.data); } NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse; if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null) { AddEquip(fightres.data.rushResult.award); } SockBuyItemResponse buyItem = response as SockBuyItemResponse; if (buyItem != null) { if (buyItem.data.retCode == 1) { ItemOfReward[] tReward = new ItemOfReward[1] { buyItem.data.p }; AddEquip(tReward); } } UsePropResponse propose = response as UsePropResponse; if (propose != null && propose.data != null && propose.data.p != null) { AddEquip(propose.data.p); } SevenDaysBuyResponse seven = response as SevenDaysBuyResponse; if (seven != null && seven.data != null) { AddEquip(seven.data.p); } GetTresureResponse GTResponse = response as GetTresureResponse; if (GTResponse != null) { AddEquip(GTResponse.data.p); } } }
// 0 - attackers win // 1 - defenders win public static BattleResponse DuelBattle( ref List <GameUnitsTable> attackers, ref List <GameUnitsTable> defenders) { int attackersCountBefore = attackers.Count; int defendersCountBefore = defenders.Count; while (true) { if (defenders.Count <= 0 && attackers.Count > 0) { var response = new BattleResponse(); response.WhoWonTheBattle = 0; response.Message = "Attacker win the battle! " + "Defenders been fully destroyed!\n" + $"Before battle [def count: {defendersCountBefore}" + $"att: {attackersCountBefore}]\n" + $"After battle [def count: {defendersCountBefore}" + $"att count: {attackersCountBefore}]"; return(response); } if (attackers.Count <= 0 && defenders.Count > 0) { var response = new BattleResponse(); response.WhoWonTheBattle = 1; response.Message = "Defender win the battle! " + "Attackers been fully destroyed!\n" + $"Before battle [def count: {defendersCountBefore}" + $"att: {attackersCountBefore}]\n" + $"After battle [def count: {defendersCountBefore}" + $"att count: {attackersCountBefore}]"; return(response); } if (attackers.Count <= 0 && defenders.Count <= 0) { var response = new BattleResponse(); response.WhoWonTheBattle = -1; response.Message = "Draw!\n" + "Attackers been fully destroyed!\n" + "Defenders been fully destroyed!"; return(response); } foreach (var attacker in attackers) { var tempDamage = attacker.GameUnitAttack * (100 - defenders[0].GameUnitDefence) / 100; defenders[0].GameUnitHP -= tempDamage; if (defenders[0].GameUnitHP <= 0) { defenders.RemoveAt(0); if (defenders.Count <= 0 && attackers.Count > 0) { var response = new BattleResponse(); response.WhoWonTheBattle = 0; response.Message = "Attacker win the battle! " + "Defenders been fully destroyed!\n" + $"Before battle [def count: {defendersCountBefore}" + $"att: {attackersCountBefore}]\n" + $"After battle [def count: {defendersCountBefore}" + $"att count: {attackersCountBefore}]"; return(response); } } } foreach (var defender in defenders) { var tempDamage = defender.GameUnitAttack * (100 - attackers[0].GameUnitDefence) / 100; attackers[0].GameUnitHP -= tempDamage; if (attackers[0].GameUnitHP <= 0) { attackers.RemoveAt(0); if (attackers.Count <= 0 && defenders.Count > 0) { var response = new BattleResponse(); response.WhoWonTheBattle = 1; response.Message = "Defender win the battle! " + "Attackers been fully destroyed!\n" + $"Before battle [def count: {defendersCountBefore}" + $"att: {attackersCountBefore}]\n" + $"After battle [def count: {defendersCountBefore}" + $"att count: {attackersCountBefore}]"; return(response); } } } } }
/// <summary> /// 保存战斗结果的数据 /// </summary> /// <param name="battleResp">Battle resp.</param> private void storeWarResult(BattleResponse battleResp) { //把服务器过来的战斗结算消息赋值 TemporyData temp = Core.Data.temper; NewDungeonsManager ddMgr = Core.Data.newDungeonsManager; if (temp.warBattle == null) { temp.warBattle = new BattleSequence() { //战斗同步数据 sync = battleResp.data.sync, // 系统奖励 reward = battleResp.data.reward, // 掠夺奖励 ext = battleResp.data.ext, //赌博结果 gambleResult = battleResp.data.gambleResult, //雷达组队神秘大奖 radarReward = battleResp.data.radarReward, //战斗序列 battleData = battleResp.data.battleData, //PVE活动副本倒计时 explorDoors = battleResp.data.explorDoors, //已打通的次数 passCount = battleResp.data.passCount, //连击 comboReward = battleResp.data.comboReward, }; } else { //战斗同步数据 temp.warBattle.sync = battleResp.data.sync; // 系统奖励 temp.warBattle.reward = battleResp.data.reward; // 掠夺奖励 temp.warBattle.ext = battleResp.data.ext; //赌博结果 temp.warBattle.gambleResult = battleResp.data.gambleResult; //雷达组队神秘大奖 temp.warBattle.radarReward = battleResp.data.radarReward; // 战斗序列 temp.warBattle.battleData.stars = battleResp.data.battleData.stars; //技能副本的引导需要这个值 temp.warBattle.battleData.isfirst = battleResp.data.battleData.isfirst; temp.warBattle.explorDoors = battleResp.data.explorDoors; //已打通的次数 temp.warBattle.passCount = battleResp.data.passCount; //连击 temp.warBattle.comboReward = battleResp.data.comboReward; } //PVE活动副本倒计时 if (battleResp.data.explorDoors != null) { ddMgr.explorDoors = battleResp.data.explorDoors; } //保存pvp挑战次数 NewFloor floor = ddMgr.GetFloorData(ddMgr.curFightingFloor.config.ID); if (floor != null) { floor.passTimes = battleResp.data.passCount; } }
private void Http_Suc(BaseHttpRequest request, BaseResponse response) { TemporyData temp = Core.Data.temper; if (temp.currentBattleType == TemporyData.BattleType.BossBattle) { //isSpecialGuide(WarIsOver); BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.status != BaseResponse.ERROR && battleResp.data != null) { //保存战斗结果的数据 storeWarResult(battleResp); handleResponse(request, battleResp); SyncPveTime(); /// /// ------- 新手引导,第4关 ------- /// #if NewGuide if (battleResp.data.battleData.isfirst != 1000) #endif Core.Data.guideManger.SpecialGuideID = battleResp.data.battleData.isfirst; SettleInLocal(); } else { //错误展示 if (battleResp != null && battleResp.status == BaseResponse.ERROR) { Core.Data.temper.WarErrorCode = battleResp.errorCode; } } } else if (temp.currentBattleType == TemporyData.BattleType.FinalTrialShalu || temp.currentBattleType == TemporyData.BattleType.FinalTrialBuou) { ClientBTShaBuResponse battleResp = response as ClientBTShaBuResponse; if (battleResp != null && battleResp.status != BaseResponse.ERROR && battleResp.data != null) { // 战斗序列 temp.warBattle.battleData.stars = statictis.getRank(WarIsOver); temp.warBattle.reward = new BattleReward() { p = battleResp.data.award, eco = battleResp.data.comboCoin, }; } else { //错误展示 if (battleResp != null && battleResp.status == BaseResponse.ERROR) { Core.Data.temper.WarErrorCode = battleResp.errorCode; } } } //通知UI展示战斗结算 if (WarResult != null) { WarResult(cachedTask); } }
/// <summary> /// Win Battle & Get Reward /// </summary> /// <param name="response">Response.</param> public override void addItem(BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { //Boss Battle or not BattleResponse battleResp = response as BattleResponse; if (battleResp != null && battleResp.data != null) { BattleReward Rewards = battleResp.data.reward; if (Rewards != null) { addMonster(Rewards); if (Rewards.p != null) { foreach (ItemOfReward it in Rewards.p) { ConfigDataType type = DataCore.getDataType(it.pid); if (type == ConfigDataType.Gems) { Core.Data.gemsManager.AddGems(it); } } } } if (battleResp.data.ext != null) { addMonster(battleResp.data.ext.p); } } SecretShopBuyResponse secretshop = response as SecretShopBuyResponse; if (secretshop != null && secretshop.data != null && secretshop.data.p != null) { AddShopMon(secretshop.data.p); } SevenDaysBuyResponse seven = response as SevenDaysBuyResponse; if (seven != null && seven.data != null) { addMonster(seven.data.p); } GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse; if (GLRResponse != null) { AddShopMon(GLRResponse.data); } NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse; if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null) { addMonster(fightres.data.rushResult.award); } SockBuyItemResponse buyItem = response as SockBuyItemResponse; if (buyItem != null) { if (buyItem.data.retCode == 1) { // if (ActivityNetController.tempHonorGiftId != 0) { ItemOfReward[] tReward = new ItemOfReward[1] { buyItem.data.p }; addMonster(tReward); // } } } GetTresureResponse GTResponse = response as GetTresureResponse; if (GTResponse != null) { addMonster(GTResponse.data.p); } } }
public void OnShow(int AttOrSuff, BattleVideoTagType type, BattleVideoPlaybackData data) { int playerid = int.Parse(Core.Data.playerManager.PlayerID); TemporyData temp = Core.Data.temper; if (playerid != data.battledata.attTeam.roleId && playerid != data.battledata.defTeam.roleId) { temp.isMyBussiness = false; } else { temp.isMyBussiness = true; } temp.self_name = data.battledata.attTeam.name; temp.enemy_name = data.battledata.defTeam.name; _videoid = data.id; if (type == BattleVideoTagType.Type_Share) { Type1.gameObject.SetActive(true); Type2.gameObject.SetActive(false); } else { Type1.gameObject.SetActive(false); Type2.gameObject.SetActive(true); } if (int.Parse(data.winid) == data.battledata.attTeam.roleId) { mSelfWin.gameObject.SetActive(true); mSelfLose.gameObject.SetActive(false); mEnemyWin.gameObject.SetActive(false); mEnemyLose.gameObject.SetActive(true); mSelf.text = Core.Data.stringManager.getString(25122); mEnemy.text = Core.Data.stringManager.getString(25123); } else { mSelfWin.gameObject.SetActive(false); mSelfLose.gameObject.SetActive(true); mEnemyWin.gameObject.SetActive(true); mEnemyLose.gameObject.SetActive(false); mSelf.text = Core.Data.stringManager.getString(25123); mEnemy.text = Core.Data.stringManager.getString(25122); } if (data.battledata.attTeam.headId == 0) { AtlasMgr.mInstance.SetHeadSprite(mHead, "10142"); } else { AtlasMgr.mInstance.SetHeadSprite(mHead, data.battledata.attTeam.headId.ToString()); } if (data.battledata.defTeam.headId == 0) { AtlasMgr.mInstance.SetHeadSprite(mEHead, "10142"); } else { AtlasMgr.mInstance.SetHeadSprite(mEHead, data.battledata.defTeam.headId.ToString()); } mLevel.text = data.battledata.attTeam.level.ToString(); mName.text = data.battledata.attTeam.name.ToString(); mAttack.text = data.battledata.attTeam.at.ToString(); mDefense.text = data.battledata.attTeam.df.ToString(); mELevel.text = data.battledata.defTeam.level.ToString(); mEName.text = data.battledata.defTeam.name.ToString(); mEAttack.text = data.battledata.defTeam.at.ToString(); mEDefense.text = data.battledata.defTeam.df.ToString(); setTemporyData(AttOrSuff, data); if (data.winid == Core.Data.playerManager.PlayerID) { Core.Data.temper.PvpVideo_SelfWin = 1; } else { Core.Data.temper.PvpVideo_SelfWin = 0; } _BattleResponse = new BattleResponse(); _BattleResponse.data = new BattleSequence(); _BattleResponse.data.battleData = new BattleData(); _BattleResponse.data.battleData.rsmg = data.content.msgArr; _BattleResponse.data.battleData.rsty = data.content.typeArr; _BattleResponse.handleResponse(); }