internal void trySupplyFleet(int battle_fleetid) { UserFleet uf = GameData.instance.GetFleetOfId(battle_fleetid); bool needsupply = false; if (uf != null) { foreach (var s in uf.ships) { UserShip us = GameData.instance.GetShipById(s); if (us.NeedSupplyAmount > 1) { needsupply = true; } } } if (needsupply == true) { ReqSupply component = new ReqSupply(); component.SupplyOneFleetSuccess += new EventHandler <EventArgs>(this.ontrySupplyFleetSuccess); component.SupplyOneFleetFail += new EventHandler <EventArgs>(this.ontrySupplyFleetFail); component.SupplyFleet(battle_fleetid, 0); } else { z.instance.setBattleStatus(BATTLE_STATUS.SUPPLY); } }
internal void updateCurFleetInfo() { foreach (ButtonX b in ships) { b.Image = null; b.Location = new Point(b.Location.X, 12); } UserFleet uf = GameData.instance.GetFleetOfId(FleetID); if (uf == null) { return; } Text = "编辑舰队 -- " + uf.title; int i = 0; foreach (int j in uf.ships) { UserShip us = GameData.instance.GetShipById(j); if (us != null) { ships[i].Image = tools.helper.getShipBigImage(us, new Rectangle(0, 0, 192, 256)); } i++; } updateTeamProps(); }
internal void updateCurFleetInfo() { UserFleet uf = GameData.instance.GetFleetOfId(FleetID); if (uf == null) { return; } Text = "查看少女 -- " + uf.title; int i = 0; if (shipid > 0) { UserShip us = GameData.instance.GetShipById(shipid); updateshipinfo(us); updateprop(us); lockallweapon(us); updateweapon(us); } else { biglihui.BackgroundImage = tools.helper.OpenImage("res/png/unknown/899.png"); updateshipinfo(null); lockallweapon(null); updateprop(null); } }
public void FinishExploreAtLevel(object[] os) { PVEExploreLevelConfig config = os[0] as PVEExploreLevelConfig; this.currentSelectedLevel = config; int id = (int) os[1]; this.finishingFleet = this.gamedata.GetFleetOfId(id); this.ReqFinishExplore(config.id); }
private void onSuccess(BaseWWWRequest obj) { try { this.updateData = new JsonFx.Json.JsonReader().Read <UpdateFleetReturnData>(this.UTF8String); base.responseData = this.updateData; if (this.updateData.eid != 0) { this.onFail(obj); } else { GameData instance = GameData.instance; if (this.requestingFleetId != 0) { UserFleet fleetOfId = instance.GetFleetOfId(this.requestingFleetId); if ((fleetOfId != null) && (fleetOfId.ships != null)) { foreach (int num in fleetOfId.ships) { instance.GetShipById(num).fleetId = 0; } } } if (this.updateData.fleetVo != null) { foreach (UserFleet fleet2 in this.updateData.fleetVo) { instance.UpdateFleet(fleet2); if (fleet2.ships != null) { foreach (int num4 in fleet2.ships) { instance.GetShipById(num4).fleetId = fleet2.id; } } } } if ((this.updateData.shipVO != null) && (this.updateData.shipVO.Length > 0)) { foreach (UserShip ship in this.updateData.shipVO) { instance.UpdateUserShip(ship); } } this.OnUpdateFleetSuccess(EventArgs.Empty); ServerRequestManager.instance.refreashUIData(); } } catch (Exception exception) { z.log(exception.Message); this.onFail(obj); } }
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 SetResultAndFleet(FinishExploreResponse result, UserFleet fleet) { this.result = result; this.fleet = fleet; this.UpdateIsBigSuccess(); this.UpdateFleetInfo(); this.UpdateArmyInfo(); this.UpdateResources(); this.SetItem(result.rewardItems); base.Invoke("UpdateLoveChange", this.showLoveChangeWaitTime); }
public void UpdateFleet(UserFleet newFleet) { for (int i = 0; i < this._userFleets.Length; i++) { UserFleet fleet = this._userFleets[i]; if (fleet.id == newFleet.id) { this._userFleets[i] = newFleet; return; } } }
public GetPVEData DealPVELevelNode(int nodeId, int fleetId, FleetFormation formationType) { UserFleet uf = GameData.instance.GetFleetOfId(fleetId); PVENode pl = PVEConfigs.instance.GetNode(nodeId); ShipGirlBot.z.log("[少女卖肉开始]...." + uf.title + " @ " + pl.flag + "点 "); GetPVEData component = new GetPVEData(); component.DealNode(nodeId, fleetId, formationType); return(component); }
public void setfleet_id(int id) { mfleetid = id; uf = GameData.instance.GetFleetOfId(mfleetid); if (uf == null) { return; } Text = "舰队远征 -- " + uf.title; int i = 0; updateExploreInfo(); }
public void updateTeamProps() { UserFleet uf = GameData.instance.GetFleetOfId(FleetID); if (uf == null) { return; } int[] prop = new int[7] { 0, 0, 0, 0, 0, 0, 0 }; double cvairval = 0.0f; foreach (int j in uf.ships) { UserShip us = GameData.instance.GetShipById(j); if (us != null) { prop[0] += us.battleProps.atk; prop[1] += us.battleProps.torpedo; prop[2] += us.battleProps.def; prop[3] += us.battleProps.antisub; prop[4] += us.battleProps.airDef; prop[5] += us.battleProps.radar; for (int index = 0; index < us.equipmentArr.Length; index++) { if (us.capacitySlotMax[index] <= 0) { continue; } var eq = us.equipmentArr[index].config; if (eq != null && eq.type == EquipmentType.FightPlane) { cvairval += Math.Sqrt((double)us.capacitySlotMax[index]) * (double)eq.airDef; } } } } label1.Text = "总火力: " + prop[0]; label2.Text = "总雷装: " + prop[1]; label3.Text = "总装甲: " + prop[2]; label4.Text = "总反潜: " + prop[3]; label5.Text = "总对空: " + prop[4]; label6.Text = "总索敌: " + prop[5]; label7.Text = "总制空值: " + cvairval; }
void CommandButtonClick(object sender, EventArgs e) { int explorerid = (int)EditorCell.Tag; bool autostart = (bool)EditorCell.GridRow[10].Value; if (z.instance.isFleetInBattle(fleetid)) { MessageBox.Show("舰队正在战斗中"); expform.Close(); return; } if (GameData.instance.IsFleetInRepair(fleetid) == true) { MessageBox.Show("舰队中有船只在修理"); expform.Close(); return; } tools.configmng.instance.setval(z.instance.get_username() + "_explore_" + fleetid, (autostart == true ? explorerid.ToString() : "no")); var exp = GameConfigs.instance.GetPVEExploreLevel(explorerid); UserFleet uf = GameData.instance.GetFleetOfId(fleetid); bool needsupply = false; foreach (int sste in uf.ships) { var sstus = GameData.instance.GetShipById(sste); if (sstus.battleProps.oil < sstus.battlePropsMax.oil || sstus.battleProps.ammo < sstus.battlePropsMax.ammo) { needsupply = true; } } if (needsupply == true) { z.log("[开始远征] 远征前补给 "); ServerRequestManager.instance.SupplyFleet(fleetid); System.Threading.Thread.Sleep(200); } z.log("[准备开始远征] " + exp.title + (autostart ? "并开始自动执行此远征" : " 自动执行关闭")); ServerRequestManager.instance.StartPVEExplore(fleetid, explorerid); expform.Close(); }
public void ShowFleet(int fleetIndex) { if ((this.canChangeFleet && (this.currentFleetIndex != fleetIndex)) && GlobalLock.instance.CanGo) { GlobalLock.instance.GoNow(); this.canChangeFleet = false; base.Invoke("EnableFleetChange", 0.3f); base.StopAllCoroutines(); base.SetLoclLoadingVisible(false); this.currentFleetIndex = fleetIndex; if (this.currentFleetIndex < this.gameData.UserFleets.Length) { this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; } else { this.selectedFleet = null; } this.UpdateUserShip(); } }
void CommandButtonClick(object sender, EventArgs e) { int shipid = (int)EditorCell.GridRow.Cells[18].Value; if (GameData.instance.IsFleetInExplore(fleetid)) { MessageBox.Show("目标舰队正在出征"); return; } UserFleet uf = GameData.instance.GetFleetOfId(fleetid); int selindex = form.get_cur_index(); UserShip us = GameData.instance.GetShipById(shipid); UserShip targetship = selindex >= uf.ships.Length? null:GameData.instance.GetShipById(uf.ships[selindex]); if (us != null && (us.IsInRepair || us.IsInExplore)) { MessageBox.Show("请求的少女(们)不存在 或者 正在洗澡..远征...战斗...."); return; } ServerRequestManager.instance.ChangeFleetShip(fleetid, shipid, form.get_cur_index()); form.updateCurFleetInfo(); //form.updateUserShipInfo(); var panel = EditorCell.GridPanel; int rindex = EditorCell.RowIndex; if (rindex > 0) { panel.Rows.Remove(panel.Rows[rindex]); } if (targetship != null) { var gr = getonerow(targetship); panel.Rows.Insert(rindex == 0?1:rindex, gr); } ServerRequestManager.instance.refreashUIData(); }
void CommandButtonClick(object sender, EventArgs e) { int shipid = (int)EditorCell.GridRow.Cells[8].Value; UserShip us = GameData.instance.GetShipById(shipid); if (us == null) { MessageBox.Show("错误的船只信息"); form.Close(); } UserFleet uf = GameData.instance.GetFleetOfId(us.fleetId); if (us.IsInRepair || us.IsInExplore || z.instance.isInBattle()) { MessageBox.Show("请求的少女正在洗澡..远征,或者有少女正在战斗中....无法修理"); return; } ServerRequestManager.instance.StartRepair(shipid, dockid); ServerRequestManager.instance.refreashUIData(); form.Close(); }
private void Start() { this.gameData = GameData.instance; this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; this.UpdateFleetInfo(); UIManager.instance.OnGotoShopActin += new System.Action(this.OnGotoShop); UIManager.instance.StartShowDetailedShipInfo += new EventHandler<EventArgs>(this.HandleStartShowDetailedShipInfo); UIManager.instance.EndShowDetailedShipInfo += new EventHandler<EventArgs>(this.HandleEndShowDetailedShipInfo); }
private void Start() { this.gameData = GameData.instance; this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; }
private void updateFleetInfo(UserFleet[] fleets) { if(canUpdateGridUI == false) { return; } GridPanel panel = shiplist.PrimaryGrid; int i = 0; foreach(UserFleet f in fleets) { object[] vals = new object[12]; panel.GetCell(i,0).Value = i; for( int j =1; j<7;j++) { if (f.ships.Length >= j) { UserShip us = GameData.instance.GetShipById(f.ships[j - 1]); if (us != null) { panel.GetCell(i, j).Value = tools.helper.getShipSmallImage(us);//"res/png/head_n/" + us.ship.picId + ".png"; } else { panel.GetCell(i, j).Value = ""; } }else{ panel.GetCell(i, j).Value = ""; } } panel.GetCell(i, 7).Value = "无"; panel.GetCell(i, 8).Value = "远征"; i++; } }
private bool tryFillBackupShips(UserFleet uf) { if(uf == null) { log("[自动检查舰队成员失败] 请先在战斗界面设定战斗关卡"); return false; } //首先尝试复活主力 for(int mc =0;mc<all_battle_ships.Count;mc++) { //不在舰队,且修理好,且不在远征 UserShip mus = GameData.instance.GetShipById(all_battle_ships[mc]); if(mus == null) { continue; } if( ((int)mus.BrokenType) < battlechangetypecombo.SelectedIndex + 2 && !uf.ships.Contains(mus.id) && !mus.IsInExplore && !mus.IsInRepair ) { //复活修理后主力 int tobereplace_shipindex = 0; int tobereplace_shipid = -1; int index = 0; foreach(int cursid in uf.ships) { UserShip tbus = GameData.instance.GetShipById(cursid); if(tbus.ship.cid == mus.ship.cid || tbus.ship.evoCid == mus.ship.cid || tbus.ship.cid == mus.ship.evoCid) { tobereplace_shipid = tbus.id; tobereplace_shipindex = index; break; } if(!all_battle_ships.Contains(cursid)) { tobereplace_shipid = tbus.id; tobereplace_shipindex = index; } index++; } if(tobereplace_shipid >0) { UserShip us = GameData.instance.GetShipById(tobereplace_shipid); var p = ServerRequestManager.instance.ChangeFleetShip(uf.id, mus.id, tobereplace_shipindex); if (p != null && p.responseData != null && p.responseData.eid == 0) { log("[自动战斗]主力少女复活! " + us.ship.title + " Lv." + us.level + "hp:" + us.battleProps.hp + "/" + us.battlePropsMax.hp + " => 主力少女 " + mus.ship.title + " Lv." + mus.level + "hp:" + mus.battleProps.hp + "/" + mus.battlePropsMax.hp); } else { log("[自动战斗]主力少女复活失败... 主力少女:" + mus.ship.title + " Lv." + mus.level + "hp:" + mus.battleProps.hp + "/" + mus.battlePropsMax.hp); } return true; } } } //原来的旗舰要是旗舰 if (all_battle_ships.Count > 0 && uf.ships.Length >0 && uf.ships.Contains(all_battle_ships[0]) && all_battle_ships[0] != uf.ships[0]) { UserShip oldflag = GameData.instance.GetShipById(uf.ships[0]); UserShip newflag = GameData.instance.GetShipById(all_battle_ships[0]); var p = ServerRequestManager.instance.ChangeFleetShip(uf.id, newflag.id, 0); if (p != null && p.responseData != null && p.responseData.eid == 0) { log("[自动战斗] 主力旗舰少女回归旗舰位置! " + oldflag.ship.title + " Lv." + oldflag.level + "hp:" + oldflag.battleProps.hp + "/" + oldflag.battlePropsMax.hp + " => 新旗舰 " + newflag.ship.title + " Lv." + newflag.level + "hp:" + newflag.battleProps.hp + "/" + newflag.battlePropsMax.hp); }else{ log("[自动战斗] 主力旗舰少女回归旗舰位置失败... "); } return true; } for (int i=0 ;i<uf.ships.Length;i++) { UserShip us = GameData.instance.GetShipById(uf.ships[i]); int sbt = (int)us.BrokenType; if (sbt > battlechangetypecombo.SelectedIndex + 1 || us.IsInRepair /*|| us.battleProps.oil<=0 || us.battleProps.ammo <=0*/) { int backupshipid = tryGetBackupShipForBattle(us.id); if (backupshipid == -1) { log("[自动战斗] 暂时没有更多少女可用了....稍微休息10秒吧.."); battle_counter += 20; return false; } UserShip bus = GameData.instance.GetShipById(backupshipid); if(bus!= null && bus.IsBigBroken == false) { log("[自动战斗]更换"+ ((us.battleProps.oil<=0 || us.battleProps.ammo <=0)?"药渣":"爆衣" )+"少女 (" + battlechangetypecombo.SelectedItem.ToString() + ") " + us.ship.title + " Lv." + us.level + "hp:" + us.battleProps.hp + "/" + us.battlePropsMax.hp + " => " + bus.ship.title + " Lv." + bus.level + "hp:" + bus.battleProps.hp + "/" + bus.battlePropsMax.hp); var p =ServerRequestManager.instance.ChangeFleetShip(uf.id, bus.id, i); if(p !=null && p.responseData!=null && p.responseData.eid ==0) { } return true; } } } return false; }
public void StartExploreAtLevelWithFleet(UserFleet fleet) { this.OnReturnFromPrepare(); this.ReqStartExplore(fleet.id, this.currentSelectedLevel.id); }
public void SelectFleet(int index) { if (!this.isChangingFleet) { this.isChangingFleet = true; base.Invoke("EnableChangeFleetAfter", 0.3f); index = Mathf.Clamp(index, 1, this.fleets.Length + 1); this.selectedFleet = this.fleets[index - 1]; this.UpdateFleet(); this.UpdateFleetBtns(); } }
internal static string getDetailWarBattleParam(AttackParam[] ap, UserFleet uf, ShipInWar[] enemy) { string r = ""; foreach (var opa in ap) { if(opa.attackSide == AttackSide.Self) { UserShip ata = GameData.instance.GetShipById(uf.ships[opa.fromIndex]); r += "\t " + getshiptype(ata.ship.type) + " " + getFormatedtitle(ata.ship.title) + " Lv." + ata.level + (opa.attackSide == AttackSide.Self ? " => " : " <= "); for (int i = 0; i < opa.targetIndex.Length && i < opa.damage.Length; i++) { ShipInWar siw = enemy[opa.targetIndex[i]]; siw.hp -= opa.damage[i]; if(siw.hp <0 ) { siw.hp = 0; } var damp = opa.damages[i]; var eqatk = GameConfigs.instance.GetEquipmentByCid(opa.equipmentCid); var skilldesc = GameConfigs.instance.GetSkillConfig(opa.skillId); r += (opa.damage[i] == 0 ? "MISS" : (" -" + opa.damage[i])) + "\t " + (damp.isCritical == 1 ? " 暴击! " : " ") + "\t"+ (skilldesc != null ? skilldesc.title : (eqatk != null? eqatk.title:"\t") ) + "\t " + getShipAttackTypeString(opa.attackType) +"\t" + siw.title + " Lv." + siw.level + " " + siw.hp + "/" + siw.hpMax; } r += "\r\n"; }else{ ShipInWar ata =enemy[opa.fromIndex]; for (int i = 0; i < opa.targetIndex.Length && i < opa.damage.Length; i++) { UserShip siw = GameData.instance.GetShipById(uf.ships[opa.targetIndex[i]]); var damp = opa.damages[i]; var eqatk = GameConfigs.instance.GetEquipmentByCid(opa.equipmentCid); r += "\t " + getshiptype(siw.ship.type) + " "+ getFormatedtitle(siw.ship.title) + " Lv." + siw.level + " <= "; r += (opa.damage[i] == 0 ? "MISS" : (" -" + opa.damage[i])) + "\t " + (damp.isCritical == 1 ? " 暴击! " : " ") + "\t " + (eqatk == null ? "\t " : eqatk.title) + "\t " + getShipAttackTypeString(opa.attackType) + "\t" + ata.title + " Lv." + ata.level + " " + ata.hp + "/" + ata.hp; } r += "\r\n"; } } return r; }
public void SetOpponentAndFleet(PVPOpponent opponent, UserFleet fleet) { this.selectedOpponent = opponent; this.selectedFleet = fleet; this.SearchPVP(); }
private void OnUpdateSuccess(object o, EventArgs e) { this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; this.UpdateFleetInfo(); this.isRequestingServer = false; }
private void OnUpdateFail(object o, EventArgs e) { int num = (int) o; Debug.Log("OnUpdateFail" + num); if (num != 0) { UIManager.instance.ShowNotice(Localization.Localize("ErrorCode" + num)); } this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; this.UpdateFleetInfo(); this.isRequestingServer = false; }
public static bool isFleetCanBattle(UserFleet uf, int changetype) { if(GameData.instance.IsFleetInExplore(uf.id)) { return false; } foreach (int i in uf.ships) { var us = GameData.instance.GetShipById(i); if(us == null || us.IsBigBroken || us.IsInExplore || us.IsInRepair || us.battleProps.oil <=0 || us.battleProps.ammo <=0 || ((int)us.BrokenType) >= changetype + 2 ) { return false; } } if(GameData.instance.UserShips.Count >= GameData.instance.UserInfo.detailInfo.shipNumTop) { z.log("[后宫已满]无法出征,请bi~~~~掉一些少女再说...."); return false; } return true; }
public void OnChangeNameSuccess(object o, EventArgs e) { this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; this.UpdateName(); }
private void Start() { this.gameData = GameData.instance; this.selectedFleet = this.gameData.UserFleets[this.currentFleetIndex]; UIManager.instance.OnGotoShopActin += new System.Action(this.OnGotoShop); }
private void InitFleet() { this.fleets = this.gameData.UserFleets; this.selectedFleet = this.fleets[0]; this.UpdateFleet(); this.UpdateFleetBtns(); }