Example #1
0
 private void onReqDealNodeSuccess(BaseWWWRequest obj)
 {
     try
     {
         GameData instance = GameData.instance;
         this.dealNodeResponse = new JsonFx.Json.JsonReader().Read<GetDealNodeResponse>(this.UTF8String);
         base.responseData = this.dealNodeResponse;
         if (this.dealNodeResponse.eid != 0)
         {
             this.onReqDealNodeFail(obj);
         }
         else
         {
             instance.AddPassedNodeId(this.dealingNodeId);
             if ((this.dealNodeResponse.newShipVO != null) && (this.dealNodeResponse.newShipVO.Length > 0))
             {
                 foreach (UserShip ship in this.dealNodeResponse.newShipVO)
                 {
                     instance.AddUserShip(ship);
                 }
             }
             if ((this.dealNodeResponse.equipmentVo != null) && (this.dealNodeResponse.equipmentVo.Length > 0))
             {
                 foreach (UserEquipment equipment in this.dealNodeResponse.equipmentVo)
                 {
                     instance.AddUserEquipmenet(equipment);
                 }
             }
             if ((this.dealNodeResponse.packageVo != null) && (this.dealNodeResponse.packageVo.Length > 0))
             {
                 instance.UpdateUserItems(this.dealNodeResponse.packageVo);
             }
             if (this.dealNodeResponse.userResVO != null)
             {
                 instance.UserInfo.UpdateResource(this.dealNodeResponse.userResVO);
             }
             this.HandleNewPveData(this.dealNodeResponse.newPveData);
             this.OnGetDealNodeSuccess(EventArgs.Empty);
             z.instance.setBattleStatus(BATTLE_STATUS.NODE_BATTLE);
             z.log("[少女卖肉成功].... 等待战(tiao)斗(jiao)过程 ...");
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message);
         this.onReqDealNodeFail(obj);
     }
 }
Example #2
0
        internal static string getDetailDayWarresultstring(GetDealNodeResponse 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);

                }

                if(ep.bossHp > 0)
                {
                    r += " Boss HP: " + ep.bossHpLeft + "/" + ep.bossHp + "\r\n";
                }
            }

            return r;
        }
 private void onReqDealNodeSuccess(BaseWWWRequest obj)
 {
     try
     {
         GameData instance = GameData.instance;
         if (this.needZip)
         {
             this.dealNodeResponse = JsonReader.Deserialize<GetDealNodeResponse>(base.UTF8String);
         }
         else
         {
             this.dealNodeResponse = JsonReader.Deserialize<GetDealNodeResponse>(base.www.text);
         }
         base.responseData = this.dealNodeResponse;
         if (this.dealNodeResponse.eid != 0)
         {
             this.onReqDealNodeFail(obj);
         }
         else
         {
             instance.AddPassedNodeId(this.dealingNodeId);
             if ((this.dealNodeResponse.newShipVO != null) && (this.dealNodeResponse.newShipVO.Length > 0))
             {
                 foreach (UserShip ship in this.dealNodeResponse.newShipVO)
                 {
                     instance.AddUserShip(ship);
                 }
             }
             if ((this.dealNodeResponse.equipmentVo != null) && (this.dealNodeResponse.equipmentVo.Length > 0))
             {
                 foreach (UserEquipment equipment in this.dealNodeResponse.equipmentVo)
                 {
                     instance.AddUserEquipmenet(equipment);
                 }
             }
             if ((this.dealNodeResponse.packageVo != null) && (this.dealNodeResponse.packageVo.Length > 0))
             {
                 instance.UpdateUserItems(this.dealNodeResponse.packageVo);
             }
             if (this.dealNodeResponse.userResVO != null)
             {
                 instance.UserInfo.UpdateResource(this.dealNodeResponse.userResVO);
             }
             this.HandleNewPveData(this.dealNodeResponse.newPveData);
             this.OnGetDealNodeSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception);
         base.parseException = exception;
         this.onReqDealNodeFail(obj);
     }
 }