Example #1
0
 private void reqStartWarSuccess(BaseWWWRequest obj)
 {
     try
     {
         this.warResponse  = new JsonReader().Read <StartPVPWarResponse>(base.UTF8String);
         base.responseData = this.warResponse;
         if (this.warResponse.eid != 0)
         {
             this.reqStartWarFail(obj);
         }
         else
         {
             this.OnStartPVPWarSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message + " " + exception.StackTrace);
         this.reqStartWarFail(obj);
     }
 }
Example #2
0
        internal static string getPVPDetailDayWarresultstring(StartPVPWarResponse battleResult, int fleetid)
        {
            UserFleet uf = GameData.instance.GetFleetOfId(fleetid);
            string r = "";

            if (battleResult.warReport != null)
            {
                float tspeedus = 0.0f;
                int radarus = 0;
                int radarenemy = 0;
                double player_aircontrolval = 0.0f;
                double enemy_aircontrolval = 0.0f;

                var ep = battleResult.warReport;

                foreach (int i in uf.ships)
                {
                    var zus = GameData.instance.GetShipById(i);
                    tspeedus += zus.battleProps.speed;
                    radarus += zus.battleProps.radar;

                    for (int index = 0; index < zus.equipmentArr.Length; index++)
                    {
                        if (zus.capacitySlotMax[index] <= 0)
                        {
                            continue;
                        }
                        var eq = zus.equipmentArr[index].config;
                        if (eq != null && eq.type == EquipmentType.FightPlane)
                        {
                            player_aircontrolval += Math.Sqrt((double)zus.capacitySlotMax[index]) * (double)eq.airDef;
                        }
                    }
                }
                if (ep != null && ep.enemyShips != null)
                {
                    foreach (var ess in ep.enemyShips)
                    {
                        radarenemy += ess.radar;
                        if (ess.equipment == null)
                        {
                            continue;
                        }
                        for (int index = 0; index < ess.equipment.Length; index++)
                        {
                            if (ess.capacitySlotMax[index] <= 0)
                            {
                                continue;
                            }
                            var eq = ess.equipment[index].config;
                            if (eq != null && eq.type == EquipmentType.FightPlane)
                            {
                                enemy_aircontrolval += Math.Sqrt((double)ess.capacitySlotMax[index]) * (double)eq.airDef;
                            }
                        }
                    }
                }

                r += "\t 索敌 " + (ep.isExploreSuccess == 1 ? "成功,发现敌军舰队" : "失败。未能发现敌军")
                    + "  我方索敌值:" + radarus + "     敌军索敌值:" + radarenemy
                    + "\r\n";
                r += "\t " + uf.title + " 对战 敌 - " + ep.enemyName + "\r\n";
                r += "\t 战斗阵型: " + getWarTypeString(ep.warType) + "\r\n";
                r += "\t 制空权结果: " + getAirControlType(ep.airControlType)
                    + "  我方制空值:" + (int)player_aircontrolval + "     敌军制空值:" + (int)enemy_aircontrolval
                    + "\r\n";

                if (ep.openAirAttack != null && ep.openAirAttack.Length > 0)
                {
                    r += " 开幕空袭:\r\n";
                    r += getDetailWarBattleParam(ep.openAirAttack, uf, ep.enemyShips);

                }

                if (ep.openAntiSubAttack != null && ep.openAntiSubAttack.Length > 0)
                {
                    r += " 开幕反潜:\r\n";
                    r += getDetailWarBattleParam(ep.openAntiSubAttack, uf, ep.enemyShips);

                }

                if (ep.openTorpedoAttack != null && ep.openTorpedoAttack.Length > 0)
                {
                    r += " 开幕雷击:\r\n";
                    r += getDetailWarBattleParam(ep.openTorpedoAttack, uf, ep.enemyShips);

                }

                if (ep.normalAttacks != null && ep.normalAttacks.Length > 0)
                {
                    r += " 炮击战:\r\n";
                    r += getDetailWarBattleParam(ep.normalAttacks, uf, ep.enemyShips);

                }

                if (ep.closeTorpedoAttack != null && ep.closeTorpedoAttack.Length > 0)
                {
                    r += " 闭幕雷击战:\r\n";
                    r += getDetailWarBattleParam(ep.closeTorpedoAttack, uf, ep.enemyShips);

                }

                int enemycount = 0;
                int j = 0;
                r += "\r\n";
                if (battleResult.warReport.selfShips != null && battleResult.warReport.selfShips.Length > 0)
                {
                    foreach (var v in battleResult.warReport.selfShips)
                    {
                        UserShip us = GameData.instance.GetShipById(uf.ships[j]);
                        r += us.ship.title + " Lv." + us.level
                          +"\t" + v.hp + "/" + us.battlePropsMax.hp

                            + " \r\n";
                        j++;
                    }
                }
                r += "\r\n敌方:\r\n";
                if (battleResult.warReport.enemyShips != null && battleResult.warReport.enemyShips.Length > 0
                    && CurrentWarParameters.selectedOpponent != null
                    )
                {
                    var p = CurrentWarParameters.selectedOpponent;
                    j = 0;
                    foreach (var v in battleResult.warReport.enemyShips)
                    {
                        UserShip us = p.ships[j];
                        r += getshiptype(us.ship.type) + " " + us.ship.title + " Lv." + us.level
                            + " HP:" + v.hp + "/" + us.ship.hp + " \r\n";
                        j++;
                    }
                }
            }

            return r;
        }
 private void reqStartWarSuccess(BaseWWWRequest obj)
 {
     try
     {
         if (this.needZip)
         {
             this.warResponse = JsonReader.Deserialize<StartPVPWarResponse>(base.UTF8String);
         }
         else
         {
             this.warResponse = JsonReader.Deserialize<StartPVPWarResponse>(base.www.text);
         }
         base.responseData = this.warResponse;
         if (this.warResponse.eid != 0)
         {
             this.reqStartWarFail(obj);
         }
         else
         {
             this.OnStartPVPWarSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception);
         this.reqStartWarFail(obj);
     }
 }
Example #4
0
 private void reqStartWarSuccess(BaseWWWRequest obj)
 {
     try
     {
         this.warResponse = new JsonReader().Read<StartPVPWarResponse>(base.UTF8String);
         base.responseData = this.warResponse;
         if (this.warResponse.eid != 0)
         {
             this.reqStartWarFail(obj);
         }
         else
         {
             this.OnStartPVPWarSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message + " " + exception.StackTrace);
         this.reqStartWarFail(obj);
     }
 }