public void SetLevelConfig(PVELevel config) { this.levelConfig = config; this.isCurrentProgrssLevel = GameData.instance.CurrentPVE.pveLevelId == this.levelConfig.id; this.userPVELevel = GameData.instance.GetUserPVELevel(this.levelConfig.id); this.UpdateBasicInfo(); }
public void StartLevel(int levelId, int fleetId, FleetFormation formationType) { UserFleet uf = GameData.instance.GetFleetOfId(fleetId); PVELevel pl = PVEConfigs.instance.GetLevel(levelId); z.log("[开始PVE战斗]...." + uf.title + " ===> " + pl.title + " " + pl.subTitle); object[] objArray1 = new object[] { "pve/challenge129/", levelId, "/", fleetId, "/", (int)formationType }; base.path = string.Concat(objArray1); base.SetupParams(null, new BaseWWWRequest.OnSuccess(this.onReqStartLevelSuccess), new BaseWWWRequest.OnFail(this.onReqStartLevelFail), true, ServerType.ChoosedServer, false); }
public void GotoLevelOf(PVELevel level) { if (GlobalLock.instance.CanGo) { GlobalLock.instance.GoNow(); this.currentSelectedLevel = level; this.levelParent.gameObject.SetActive(false); CurrentWarParameters.selectedLevel = level; GameObject obj2 = UnityEngine.Object.Instantiate(this.levelPreparePrefab) as GameObject; obj2.GetComponent<BattlePrepareUIManager>().SetPVEChapterUIManager(this); this.hideAction.SetActive(true); this.hideAction.GetComponent<AnimatePosition>().StartMove(); TutorialManager.instance.CheckStepFinishAction("PVELevelStartClick"); } }
public void SetSelectedLevel(PVELevel level) { if (this.currentSelectedLevel != level) { this.currentSelectedLevel = level; this.UpdateLevelSelection(); } }
public void CheckSelection(PVELevel config) { this.isSelected = this.levelConfig == config; base.GetComponent<PVEChapterLevelItemResizer>().isSelected = this.isSelected; }
private bool auto_battle() { if(!isInBattle()) { if (autostart_battle == true) { try { //if (this.bigbrokenhaiyaosuozi.Checked == true) //{ // log("[警告-警告-警告] 大破进击开关已经打开,请立即停止作死....请立即停止作死....",Color.Red); //} var uinfo = GameData.instance.UserInfo; //黑暗炼钢 if(darkforge.Checked == true ) { UserFleet ff = GameData.instance.GetFleetOfId(1); if(ff == null || GameData.instance.IsFleetInExplore(ff.id) || GameData.instance.IsFleetInRepair(ff.id) ) { initing = true; darkforge.Checked = false; autostart_battle = false; autobattlecheck.Checked = false; initing = false; log("[黑暗炼钢不支持非1号舰队] 请让1号舰队舰娘待机..."); return false; } if(GameData.instance.UserInfo.detailInfo.shipNum > darkforgetotalshipnum.Value) { initing = true; darkforge.Checked = false; autostart_battle = false; autobattlecheck.Checked = false; initing = false; log("[黑暗炼钢] 已经炼制太多少女,超过提督设定负荷极限 " +darkforgetotalshipnum.Value + "停止炼钢..."); return false; } } if(darkforge.Checked == true) { List<UserShip> forgelist = new List<UserShip>(); bool need_new_forger = false; //检查舰队 UserFleet forgefleet = GameData.instance.GetFleetOfId(1); UserShip flagship = forgefleet.GetUserShips().First(); if(flagship.ship.type != ShipType.Destroyer || flagship.level >5 || flagship.ship.star >2 || forgefleet.ships.Length >1 || flagship.battleProps.oil ==0 || flagship.battleProps.ammo == 0 || flagship.BrokenType == ShipBrokenType.bigBorken || flagship.IsLocked == true ) { need_new_forger = true; } //更新预备队 if (need_new_forger == true) { foreach (var dfs in GameData.instance.UserShips) { if (dfs.IsLocked == false && dfs.level == 1 && dfs.ship.star < 3 && dfs.ship.type == ShipType.Destroyer && dfs.BrokenType == ShipBrokenType.noBroken && dfs.battleProps.oil == dfs.battlePropsMax.oil && dfs.battleProps.ammo == dfs.battlePropsMax.ammo && dfs.fleetId == 0 && dfs.IsInRepair == false ) { forgelist.Add(dfs); } } if(forgelist.Count == 0) { initing = true; darkforge.Checked = false; autostart_battle = false; autobattlecheck.Checked = false; initing = false; log("[黑暗炼钢] 缺少祭品,无法炼钢 =>" + forgelist.Count + "枚"); return false; } log("[黑暗炼钢] 预备熔炼少女 =>" + forgelist.Count + "枚"); if (forgefleet.ships.Length >1) { for (int i = 0; i < forgefleet.ships.Length - 1;i++ ) { log("[黑暗炼钢]" + "移出其他舰队成员"); ServerRequestManager.instance.ChangeFleetShip(forgefleet.id, 0, 0); } } UserShip forger = forgelist.First(); log("[黑暗炼钢]抛弃钢渣少女 => " + tools.helper.getstartstring(flagship.ship.star) + tools.helper.getshiptype(flagship.ship.type) + " " + flagship.ship.title + " Lv." + flagship.level + " HP: " + flagship.battleProps.hp + "/" + flagship.battlePropsMax.hp + " 油:" + flagship.battleProps.oil + " 弹:" + flagship.battleProps.ammo); var ret =ServerRequestManager.instance.ChangeFleetShip(forgefleet.id, forger.id, 0); if(ret!= null && ret.responseData != null && ret.responseData.eid == 0) { log("[黑暗炼钢] 计划熔炼少女 => " + tools.helper.getstartstring(forger.ship.star) + tools.helper.getshiptype(forger.ship.type) + " " + forger.ship.title + " Lv." + forger.level + "HP: " + forger.battleProps.hp + "/" +forger.battlePropsMax.hp + " 油:" + forger.battleProps.oil + " 弹:" + forger.battleProps.ammo); } else { initing = true; darkforge.Checked = false; autostart_battle = false; autobattlecheck.Checked = false; initing = false; log("[黑暗炼钢] 更换祭品失败,无法炼钢 " ); return false; } } //开始炼钢 PVELevel lv = PVEConfigs.instance.GetLevel(101); UserFleet uf = GameData.instance.GetFleetOfId(1); if (lv != null && uf != null && tools.helper.isFleetCanBattle(uf, battlechangetypecombo.SelectedIndex)) { battle_fleetid = uf.id; battle_levelid = lv.id; battle_node_counter = 0; battel_status = BATTLE_STATUS.PREPARE; bcounter = 5; var forger = uf.GetUserShips().First(); log("[黑暗炼钢] 开始熔炼少女 => " +tools.helper.getstartstring(forger.ship.star)+ tools.helper.getshiptype(forger.ship.type) + " " + forger.ship.title + " Lv." + forger.level + " HP: " + forger.battleProps.hp + "/" + forger.battlePropsMax.hp + " 油:"+ forger.battleProps.oil + " 弹:"+ forger.battleProps.ammo); } else { initing = true; darkforge.Checked = false; autostart_battle = false; autobattlecheck.Checked = false; initing = false; log("[黑暗炼钢] 炼钢参数错误,无法炼钢 "); return false; } } else { //普通 if (uinfo.oil < 1000 || uinfo.ammo < 1000 || uinfo.steel < 1000 || uinfo.aluminium < 200) { log("[自动战斗] 油弹钢铝资源过低,休息30分钟..."); battle_counter += 3600; return false; } PVELevel lv = PVEConfigs.instance.GetLevel(battle_levelid); UserFleet uf = GameData.instance.GetFleetOfId(battle_fleetid); if(tryFillBackupShips(uf) == true) { return true; } if (lv != null && uf != null && tools.helper.isFleetCanBattle(uf , battlechangetypecombo.SelectedIndex)) { battle_fleetid = uf.id; battle_levelid = lv.id; battle_node_counter = 0; battel_status = BATTLE_STATUS.PREPARE; bcounter = 5; } } } catch (System.Exception ex) { return true; } } return false; } switch(battel_status) { case BATTLE_STATUS.PREPARE: if(darkforge.Checked == true) { setBattleStatus(BATTLE_STATUS.SUPPLY); log("[黑暗炼钢] 炼钢少女不许吃喝...."); } else if( supplyfleetbeforebattel_check.Checked == false) { setBattleStatus(BATTLE_STATUS.SUPPLY); log("[自动战斗] 黑心提督不许软萌少女吃喝... ≡≡[。。]≡"); } else { ServerRequestManager.instance.trySupplyFleet(battle_fleetid); } break; case BATTLE_STATUS.SUPPLY: var startret = ServerRequestManager.instance.StartPVELevel(battle_levelid, battle_fleetid, battle_formation); if (startret != null && startret.responseData != null && startret.responseData.eid == 0) { var blevel =PVEConfigs.instance.GetLevel(battle_levelid); this.currentlevel = blevel; this.currentNode = PVEConfigs.instance.GetNode(this.currentlevel.initNodeId); this.currentNodeStatus = new Dictionary<string,int>(); this.passedNodes = new List<PVENode>(); this.passedNodes.Add(this.currentNode); this.pveLevelEnd = false; this.battle_retry_counter = 10; } break; case BATTLE_STATUS.STARTED: if(CanBattle()) { var ret =ServerRequestManager.instance.GetNextPVELevelNode(); if(ret != null && ret.responseData != null && ret.responseData.eid ==0) { GetNextNodeResponse r = (ret.responseData as GetNextNodeResponse); if(r.node == 0) { log("[自动战斗] 关卡结束,返回港口...."); setBattleStatus(BATTLE_STATUS.FINISHED); refreshUIData(); return true; } this.currentNode = PVEConfigs.instance.GetNode(r.node); this.currentNodeStatus = r.nodeStatus; this.passedNodes.Add(currentNode); //战斗路点控制 if(battle_route.Text!=null && battle_route.Text != "") { char[] shcedule_route = battle_route.Text.ToArray(); if(this.passedNodes.Count <= shcedule_route.Length +1) { string cur_schedule_route_point = shcedule_route[this.passedNodes.Count - 2].ToString().ToUpper(); if (currentNode.flag.ToUpper() != cur_schedule_route_point) { string sroute = ""; foreach(var nnn in this.passedNodes) { sroute += nnn.flag + " => "; } log("[自动战斗-路径控制] 前进路径 " + sroute + "不符合设定路径" + battle_route.Text + "回港重来...."); ServerRequestManager.instance.NotifyPVEBackHome(); break; } } } if (this.passedNodes.Count > 2) { this.delay_counter += this.secondnodedelaymulti.Value; } else { this.delay_counter += this.battleresultdelayinput.Value; } } else if ( battle_retry_counter >0) { battle_retry_counter--; if (this.passedNodes.Count > 2) { this.delay_counter += this.secondnodedelaymulti.Value/2; } else { this.delay_counter += this.battleresultdelayinput.Value; } log("[自动战斗] 提督你肝少女们太快了...服务器响应失败...重试ing... 剩余次数 x " + battle_retry_counter); } else { ServerRequestManager.instance.NotifyPVEBackHome(); log("[自动战斗] 服务器娘已经肝倒....回港重来... "); } }else{ ServerRequestManager.instance.NotifyPVEBackHome(); setBattleStatus(BATTLE_STATUS.FINISHED); log("[舰队有大破需要修理或者修理中] 停止自动战斗...."); } break; case BATTLE_STATUS.VISIT_NODE: if (currentNode.IsBattleNode == true) { var spyret = ServerRequestManager.instance.SearchPVELevelNode(currentNode.id); if (spyret != null && spyret.responseData != null && spyret.responseData.eid == 0) { SearchEnemyResponse r = (spyret.responseData as SearchEnemyResponse); //避战控制 if (avoidbattletext.Text != null && avoidbattletext.Text != "") { char[] shcedule_avoid = avoidbattletext.Text.ToArray(); if (this.passedNodes.Count <= shcedule_avoid.Length + 1) { string cur_schedule_avoid_point = shcedule_avoid[this.passedNodes.Count - 2].ToString(); if (cur_schedule_avoid_point == "1" && r.enemyVO.canSkip == 1) { log("[自动战斗-自动回避] 尝试回避 @ " + currentlevel.title + "#" + currentNode.flag); var skipret = ServerRequestManager.instance.SkipPVELevelNode(currentNode.id); if (skipret != null && skipret.responseData != null && skipret.responseData.eid == 0) { var sret = skipret.responseData as SkipWarResponse; if(sret.isSuccess == 1) { //避战成功,下一个点 log("[自动战斗-自动回避] 回避成功 @ " + currentlevel.title + "#" + currentNode.flag); setBattleStatus(BATTLE_STATUS.STARTED); return true; } else { log("[自动战斗-自动回避] 回避失败 @ " + currentlevel.title + "#" + currentNode.flag); } } } } } //战斗 敌人 舰队组成 控制 if (searchenemycase.Text != null && searchenemycase.Text != "") { char[] enemycase = searchenemycase.Text.ToArray(); if (this.passedNodes.Count <= enemycase.Length + 1) { string cur_enemycase_point = enemycase[this.passedNodes.Count - 2].ToString().ToUpper(); if (judge_enemy_case(r.enemyVO.enemyShips, cur_enemycase_point) == dofightinstedofback.Checked) { string sroute = ""; foreach (var nnn in this.passedNodes) { sroute += nnn.flag + " => "; } log("[自动战斗-索敌控制] " + (dofightinstedofback.Checked? "不符合设定索敌条件, 回港重来....":"符合设定 避开 索敌条件, 回港重来....") ); ServerRequestManager.instance.NotifyPVEBackHome(); } } } } else { ServerRequestManager.instance.NotifyPVEBackHome(); log("[自动战斗]索敌错误,回港重来..."); } } else { log("[自动战斗-索敌控制] 资源点不索敌...."); setBattleStatus(BATTLE_STATUS.SPY_NODE); } break; case BATTLE_STATUS.SPY_NODE: UserFleet buf = GameData.instance.GetFleetOfId(battle_fleetid); UserShip[] nowshipstatus = new UserShip[buf.ships.Length]; for(int iii =0;iii < buf.ships.Length;iii++) { nowshipstatus[iii] = GameData.instance.GetShipById(buf.ships[iii]); } CurrentWarParameters.shipsbeforebattle = nowshipstatus; int nodeformation = -1; if (formation_control.Text != null && formation_control.Text != "") { char[] formation_controlpoint = formation_control.Text.ToArray(); if (this.passedNodes.Count <= formation_controlpoint.Length + 1) { string formation_control_point = formation_controlpoint[this.passedNodes.Count - 2].ToString(); if (formation_control_point != "") { nodeformation = int.Parse(formation_control_point); if (nodeformation < 1 || nodeformation > 5) { nodeformation = -1; } } } } log("[自动战斗] 舰队阵型:" + tools.helper.getformationstring(((nodeformation == -1 ? battle_formation : (FleetFormation)nodeformation)))); var firstbattl = ServerRequestManager.instance.DealPVELevelNode(currentNode.id,battle_fleetid, nodeformation == -1 ? battle_formation:((FleetFormation)nodeformation)); if (firstbattl!= null && firstbattl.responseData!= null && firstbattl.responseData.eid==0) { var respone = (firstbattl.responseData as GetDealNodeResponse); if (respone.pveLevelEnd != null && respone.pveLevelEnd == 1) { this.pveLevelEnd = true; } if (currentNode.IsBattleNode == true) { if (respone.warReport != null) { dealnode_enemyclearornot = respone.warReport.canDoNightWar == 0; } bool extranightwarswitch =false; if(night_war_control.Text!=null && night_war_control.Text != "") { char[] night_war_controlpoint = night_war_control.Text.ToArray(); if (this.passedNodes.Count <= night_war_controlpoint.Length + 1) { string night_war_control_point = night_war_controlpoint[this.passedNodes.Count - 2].ToString(); if (night_war_control_point == "1") { extranightwarswitch = true; } } } CurrentWarParameters.daybattleresult = respone; if (detailbattlelog.Checked == true) { z.log( tools.helper.getDetailDayWarresultstring(respone, battle_fleetid)); } if (dealnode_enemyclearornot) { log("[日战胜利!!]少女战利品回收中.. "); } else { log((this.nightwarcheck.Checked||extranightwarswitch) == true ? "[日战失利!!]提督判定大群少女继续夜战..... " : "[日战失利] 提督决定不参与夜战活动.."); } } else { if (this.currentNode.nodeType == PVENodeType.addItem) { if(currentNode.gain != null) foreach (var gkv in currentNode.gain) { log("[自动战斗] 在关卡"+currentlevel.title + " "+currentNode.flag + "点 遇到好心人,获得 " + tools.helper.getresourcetype(gkv.Key)+ " x " + gkv.Value); } } else if (this.currentNode.nodeType == PVENodeType.loseItem) { if(currentNode.loss != null) foreach (var gkv in currentNode.loss) { log("[自动战斗] 在关卡"+currentlevel.title + " "+currentNode.flag + "点 遇到坏蛋,丢失 " + tools.helper.getresourcetype(gkv.Key)+ " x " + gkv.Value); } } else if (this.currentNode.nodeType == PVENodeType.empty) { log("[自动战斗] 在关卡"+currentlevel.title + " "+currentNode.flag + "点 什么也没有发生............真的"); } setBattleStatus(BATTLE_STATUS.STARTED); } } else if (battle_retry_counter >0) { battle_retry_counter--; if (this.passedNodes.Count > 2) { this.delay_counter += this.secondnodedelaymulti.Value; } else { this.delay_counter += this.battleresultdelayinput.Value; } log("[自动战斗] 提督你肝少女们太快了...服务器响应失败...重试ing... 剩余次数 x " + battle_retry_counter); } else { ServerRequestManager.instance.NotifyPVEBackHome(); log("[自动战斗] 服务器娘已经肝倒....回港重来... "); } this.delay_counter += this.battleresultdelayinput.Value; break; case BATTLE_STATUS.NODE_BATTLE: //夜战额外控制 bool dobattleextranightwarswitch =false; if(night_war_control.Text!=null && night_war_control.Text != "") { char[] dobattlenight_war_controlpoint = night_war_control.Text.ToArray(); if (this.passedNodes.Count <= dobattlenight_war_controlpoint.Length + 1) { string dobattlenight_war_control_point = dobattlenight_war_controlpoint[this.passedNodes.Count - 2].ToString(); if (dobattlenight_war_control_point == "1") { dobattleextranightwarswitch = true; } } } var battleret = ServerRequestManager.instance.GetPVEBattleResult( (!dealnode_enemyclearornot) && (battle_do_nightwar==1 ||dobattleextranightwarswitch) , battle_fleetid); if (battleret != null && battleret.responseData != null && battleret.responseData.eid == 0) { z.instance.setBattleStatus(BATTLE_STATUS.BATTLE_RESULT); var battleResult = battleret.responseData as GetBattleResultResponse; if (detailbattlelog.Checked == true) { z.log(tools.helper.getDetailNightWarresultstring(battleResult, battle_fleetid)); } z.log("[少女卖肉报酬入手]..." + tools.helper.getwarresultstring(battleResult, battle_fleetid)); tools.reporter.reportGotShip(battleResult, battle_fleetid, currentlevel.title, currentNode.flag); //开关开了,5场 s ss 不掉船就停止捞船 if(stopbattlewhennodrop_check.Checked == true) { WarResultLevel wrl = (WarResultLevel)battleResult.warResult.resultLevel; if(battleResult.newShipVO!= null && battleResult.newShipVO.Length >0) { nodropcounter = 0; } else if (wrl == WarResultLevel.s || wrl == WarResultLevel.ss) { nodropcounter++; log("[自动战斗] S/SS胜无掉落...计数: " + nodropcounter + " , 5次后停止自动战斗"); } if(nodropcounter >=5 && autobattlecheck.Checked == true) { initing = true; autostart_battle = false; autobattlecheck.Checked = autostart_battle; initing = false; } } } else if (battle_retry_counter >0) { battle_retry_counter--; log("[自动战斗] 提督你肝少女们太快了...服务器响应失败...重试ing... 剩余次数 x " + battle_retry_counter); this.delay_counter += this.battleresultdelayinput.Value; } else { ServerRequestManager.instance.NotifyPVEBackHome(); log("[自动战斗] 服务器娘已经肝倒....回港重来... "); } if ((!dealnode_enemyclearornot) && (battle_do_nightwar == 1 || dobattleextranightwarswitch)) { this.delay_counter += this.battleresultdelayinput.Value; } break; case BATTLE_STATUS.BATTLE_RESULT: //todo think logic battle_node_counter++; if(this.pveLevelEnd == true) { log("[自动战斗] 关卡结束,返回港口...."); setBattleStatus(BATTLE_STATUS.FINISHED); refreshUIData(); return true; } if (battle_node_counter >= this.battlenodenuminput.Value) { ServerRequestManager.instance.NotifyPVEBackHome(); } else { setBattleStatus(BATTLE_STATUS.STARTED); } refreshUIData(); break; default: return false; break; } return true; }