Example #1
0
 private void reqGetResultSuccess(BaseWWWRequest obj)
 {
     try
     {
         this.battleResult = new JsonFx.Json.JsonReader().Read <GetCampaignWarResultResponse>(this.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);
             }
             if (this.battleResult.campaignVo != null)
             {
                 if (this.battleResult.campaignVo.canCampaignChallengeLevel != null)
                 {
                     GameData.instance.SetOpenedPVECampaignLevels(this.battleResult.campaignVo.canCampaignChallengeLevel);
                 }
                 if (this.battleResult.campaignVo.campaignChallenge != null)
                 {
                     GameData.instance.SetCampaignChapterTimesInfo(this.battleResult.campaignVo.campaignChallenge);
                 }
                 if (this.battleResult.campaignVo.passInfo != null)
                 {
                     GameData.instance.TotalCampainInfo = this.battleResult.campaignVo.passInfo;
                 }
             }
             if (this.battleResult.userResVo != null)
             {
                 this.battleResult.userResChange = GameData.instance.UserInfo.GetResourceChange(this.battleResult.userResVo);
                 GameData.instance.UserInfo.UpdateResource(this.battleResult.userResVo);
             }
             if (this.battleResult.packageVo != null)
             {
                 GameData.instance.UpdateUserItems(this.battleResult.packageVo);
             }
             this.CheckUserNewExpInfo();
             this.OnGetCampaignWarResultSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message);
         this.reqGetResultFail(obj);
     }
 }
Example #2
0
        internal static string getCampwarresultstring(GetCampaignWarResultResponse battleResult)
        {
            PVECampaignLevel lv = CurrentWarParameters.selectedCampaignLevel;
            int[] campships = GameData.instance.GetCampaignFleetInfo(lv.id);
            List<UserShip> battleships = new List<UserShip>();
            foreach (int stoi in campships)
            {
                UserShip us = GameData.instance.GetShipById(stoi);
                if (us != null)
                {
                    battleships.Add(us);
                }
            }

            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 = battleships[i];
                    r += (v.isMvp == 1 ? "MVP " : "    ") + us.ship.title + " Lv." + us.level + (v.isLevelUp == 1 ? "↑" : "") + "(+" + v.expAdd + ")/" + v.nextLevelExpNeed
                        + "  HP:" + us.battleProps.hp + "/" + us.battlePropsMax.hp + "  \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<GetCampaignWarResultResponse>(base.UTF8String);
         }
         else
         {
             this.battleResult = JsonReader.Deserialize<GetCampaignWarResultResponse>(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);
             }
             if (this.battleResult.campaignVo != null)
             {
                 if (this.battleResult.campaignVo.canCampaignChallengeLevel != null)
                 {
                     GameData.instance.SetOpenedPVECampaignLevels(this.battleResult.campaignVo.canCampaignChallengeLevel);
                 }
                 if (this.battleResult.campaignVo.campaignChallenge != null)
                 {
                     GameData.instance.SetCampaignChapterTimesInfo(this.battleResult.campaignVo.campaignChallenge);
                 }
                 if (this.battleResult.campaignVo.passInfo != null)
                 {
                     GameData.instance.TotalCampainInfo = this.battleResult.campaignVo.passInfo;
                 }
             }
             if (this.battleResult.userResVo != null)
             {
                 this.battleResult.userResChange = GameData.instance.UserInfo.GetResourceChange(this.battleResult.userResVo);
                 GameData.instance.UserInfo.UpdateResource(this.battleResult.userResVo);
             }
             if (this.battleResult.packageVo != null)
             {
                 GameData.instance.UpdateUserItems(this.battleResult.packageVo);
             }
             this.CheckUserNewExpInfo();
             this.OnGetCampaignWarResultSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception);
         base.parseException = exception;
         this.reqGetResultFail(obj);
     }
 }