예제 #1
0
    private void InitInfo()
    {
        this.multiBattleData    = ClassSingleton <MultiBattleData> .Instance;
        this.isMockBattle       = !(this.multiBattleData.MockBattleUserCode == "0");
        this.previousUserStatus = this.multiBattleData.PvPUserDatas.Where((MultiBattleData.PvPUserData item) => item.userStatus.userId == this.multiBattleData.MyPlayerUserId).Select((MultiBattleData.PvPUserData item) => item.userStatus).First <GameWebAPI.ColosseumUserStatus>();
        this.pvpResultData      = this.multiBattleData.BattleEndResponse;
        foreach (GameWebAPI.RespDataMA_ColosseumRankM.ColosseumRank colosseumRank in MasterDataMng.Instance().RespDataMA_ColosseumRankMaster.colosseumRankM)
        {
            this.rankDataDict.Add(colosseumRank.colosseumRankId, colosseumRank);
        }
        this.getClusterLabel.text  = "0";
        this.fluctuateDpLabel.text = "0";
        GameWebAPI.RespDataMA_ColosseumRankM.ColosseumRank colosseumRank2 = this.rankDataDict[this.previousUserStatus.colosseumRankId.ToString()];
        this.currentDpLabel.text = this.previousUserStatus.score.ToString();
        bool flag = this.multiBattleData.BattleResult == 1;

        if (flag && !this.isMockBattle)
        {
            this.nowTotalWin = this.previousUserStatus.winTotal + 1;
        }
        else
        {
            this.nowTotalWin = this.previousUserStatus.winTotal;
        }
        this.totalWinNum.text = string.Format(StringMaster.GetString("MyColosseumTotalWinNum"), this.nowTotalWin.ToString());
        if (this.isMockBattle)
        {
            this.nextRankupWinNum.text = string.Empty;
        }
        else if (this.pvpResultData.battleRecord != null)
        {
            this.nextRankupWinNum.text = string.Format(StringMaster.GetString("ColosseumRankAGroup"), this.pvpResultData.battleRecord.count, this.pvpResultData.battleRecord.winPercent);
        }
        else
        {
            this.nextRankupWinNum.text = string.Format(StringMaster.GetString("NextRankupNum"), int.Parse(colosseumRank2.maxScore) + 1 - this.nowTotalWin);
        }
        this.rankSprite.spriteName = MultiTools.GetPvPRankSpriteName(int.Parse(colosseumRank2.colosseumRankId));
        this.UpdateItemNum();
    }
    private IEnumerator BattleEndActionHttp()
    {
        GameWebAPI.RespData_ColosseumBattleEndLogic colosseumEnd = null;
        GameWebAPI.ColosseumBattleEndLogic          request      = new GameWebAPI.ColosseumBattleEndLogic
        {
            SetSendData = delegate(GameWebAPI.ReqData_ColosseumBattleEndLogic param)
            {
                param.battleResult         = ClassSingleton <MultiBattleData> .Instance.BattleResult;
                param.roundCount           = this.battleStateData.currentRoundNumber;
                param.isMockBattle         = ((!(ClassSingleton <MultiBattleData> .Instance.MockBattleUserCode == "0")) ? 1 : 0);
                param.skillUseDeckPosition = "0";
            },
            OnReceived = delegate(GameWebAPI.RespData_ColosseumBattleEndLogic resData)
            {
                colosseumEnd = resData;
            }
        };
        RequestBase request2 = request;

        if (BattlePvPFunction.< > f__mg$cache0 == null)
        {
            BattlePvPFunction.< > f__mg$cache0 = new Action(RestrictionInput.EndLoad);
        }
        yield return(request2.Run(BattlePvPFunction.< > f__mg$cache0, delegate(Exception noop)
        {
            RestrictionInput.EndLoad();
        }, null));

        MultiBattleData.BattleEndResponseData responseData = new MultiBattleData.BattleEndResponseData();
        if (colosseumEnd != null)
        {
            responseData.resultCode = colosseumEnd.resultCode;
            List <MultiBattleData.BattleEndResponseData.Reward> list = new List <MultiBattleData.BattleEndResponseData.Reward>();
            if (colosseumEnd.reward != null)
            {
                for (int i = 0; i < colosseumEnd.reward.Length; i++)
                {
                    list.Add(new MultiBattleData.BattleEndResponseData.Reward
                    {
                        assetCategoryId = colosseumEnd.reward[i].assetCategoryId,
                        assetNum        = colosseumEnd.reward[i].assetNum,
                        assetValue      = colosseumEnd.reward[i].assetValue
                    });
                }
            }
            List <MultiBattleData.BattleEndResponseData.Reward> list2 = new List <MultiBattleData.BattleEndResponseData.Reward>();
            if (colosseumEnd.firstRankUpReward != null)
            {
                for (int j = 0; j < colosseumEnd.firstRankUpReward.Length; j++)
                {
                    list2.Add(new MultiBattleData.BattleEndResponseData.Reward
                    {
                        assetCategoryId = colosseumEnd.firstRankUpReward[j].assetCategoryId,
                        assetNum        = colosseumEnd.firstRankUpReward[j].assetNum,
                        assetValue      = colosseumEnd.firstRankUpReward[j].assetValue
                    });
                }
            }
            responseData.reward            = list.ToArray();
            responseData.firstRankUpReward = list2.ToArray();
            responseData.score             = colosseumEnd.score;
            responseData.colosseumRankId   = colosseumEnd.colosseumRankId;
            responseData.isFirstRankUp     = colosseumEnd.isFirstRankUp;
            if (colosseumEnd.battleRecord != null)
            {
                responseData.battleRecord            = new MultiBattleData.BattleEndResponseData.ColosseumBattleRecord();
                responseData.battleRecord.count      = colosseumEnd.battleRecord.count;
                responseData.battleRecord.winPercent = colosseumEnd.battleRecord.winPercent;
            }
        }
        else
        {
            responseData.reward = new MultiBattleData.BattleEndResponseData.Reward[0];
        }
        ClassSingleton <MultiBattleData> .Instance.BattleEndResponse = responseData;
        yield break;
    }