Esempio n. 1
0
 private void reqGetResultSuccess(BaseWWWRequest obj)
 {
     try
     {
         this.battleResult = new JsonReader().Read <GetPVPWarResultResponse>(base.UTF8String);
         base.responseData = this.battleResult;
         if (this.battleResult.eid != 0)
         {
             this.reqGetResultFail(obj);
         }
         else
         {
             if (this.battleResult.shipVO != null)
             {
                 foreach (UserShip ship in this.battleResult.shipVO)
                 {
                     GameData.instance.UpdateUserShip(ship);
                 }
             }
             if ((this.battleResult.newShipVO != null) && (this.battleResult.newShipVO.Length > 0))
             {
                 CurrentWarParameters.newShipsGotFromWar = this.battleResult.newShipVO;
                 foreach (UserShip ship2 in this.battleResult.newShipVO)
                 {
                     GameData.instance.AddUserShip(ship2);
                 }
             }
             if (this.battleResult.detailInfo != null)
             {
                 GameData.instance.UserInfo.UpdateDetailInfo(this.battleResult.detailInfo);
             }
             this.CheckUserNewExpInfo();
             CurrentWarParameters.selectedOpponent.resultLevel = (WarResultLevel)this.battleResult.warResult.resultLevel;
             this.OnGetPVPWarResultSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message + " " + exception.StackTrace);
         this.reqGetResultFail(obj);
     }
 }
Esempio n. 2
0
        internal static string getpvpwarresultstring(GetPVPWarResultResponse battleResult, int fleetid)
        {
            UserFleet uf = GameData.instance.GetFleetOfId(fleetid);
            string r = "";

            if (battleResult.warResult == null)
            {
                return ("这里的海面静悄悄,什么都没有发生...可能会丢/多了点油弹什么的? 大概?");
            }
            r += (WarResultLevel)battleResult.warResult.resultLevel + "胜 ,";

            if (battleResult.newShipVO != null)
            {
                foreach (var ns in battleResult.newShipVO)
                {

                    r += " 发现新少女 -- " + ns.ship.title + " " + ns.ship.titleClass;
                }
            }
            int enemycount = 0;
            int i = 0;
            r += "\r\n";
            if (battleResult.warResult.selfShipResults != null && battleResult.warResult.selfShipResults.Length >0)
            {
                foreach (var v in battleResult.warResult.selfShipResults)
                {
                    UserShip us = GameData.instance.GetShipById(uf.ships[i]);
                    r += (v.isMvp == 1 ? "MVP " : "    ") + us.ship.title + " Lv." + us.level + (v.isLevelUp == 1 ? "↑" : "") + "(+" + v.expAdd + ")/" + v.nextLevelExpNeed + " \r\n";
                    i++;
                }
            }
            r += "\r\n敌方:\r\n";
            if (battleResult.warResult.enemyShipResults != null && battleResult.warResult.enemyShipResults.Length > 0
                && CurrentWarParameters.selectedOpponent!=null
                )
            {
                var p = CurrentWarParameters.selectedOpponent;
                i = 0;
                foreach (var v in battleResult.warResult.enemyShipResults)
                {
                    UserShip us = p.ships[i];
                    r+= getshiptype(us.ship.type) + " "+ us.ship.title + " Lv." + us.level
                        + " HP:"+ v.hp + "/" + us.ship.hp + " \r\n";
                    i++;
                }
            }
            return r;
        }
 private void reqGetResultSuccess(BaseWWWRequest obj)
 {
     try
     {
         if (this.needZip)
         {
             this.battleResult = JsonReader.Deserialize<GetPVPWarResultResponse>(base.UTF8String);
         }
         else
         {
             this.battleResult = JsonReader.Deserialize<GetPVPWarResultResponse>(base.www.text);
         }
         base.responseData = this.battleResult;
         if (this.battleResult.eid != 0)
         {
             this.reqGetResultFail(obj);
         }
         else
         {
             if (this.battleResult.shipVO != null)
             {
                 foreach (UserShip ship in this.battleResult.shipVO)
                 {
                     GameData.instance.UpdateUserShip(ship);
                 }
             }
             if ((this.battleResult.newShipVO != null) && (this.battleResult.newShipVO.Length > 0))
             {
                 CurrentWarParameters.newShipsGotFromWar = this.battleResult.newShipVO;
                 foreach (UserShip ship2 in this.battleResult.newShipVO)
                 {
                     GameData.instance.AddUserShip(ship2);
                 }
             }
             if (this.battleResult.detailInfo != null)
             {
                 GameData.instance.UserInfo.UpdateDetailInfo(this.battleResult.detailInfo);
             }
             this.CheckUserNewExpInfo();
             CurrentWarParameters.selectedOpponent.resultLevel = (WarResultLevel) this.battleResult.warResult.resultLevel;
             this.OnGetPVPWarResultSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception);
         base.parseException = exception;
         this.reqGetResultFail(obj);
     }
 }