Esempio n. 1
0
 public static APIRequestTask RequestColosseumBattleEnd(GameWebAPI.ReqData_ColosseumBattleEndLogic.BattleResult result, GameWebAPI.ReqData_ColosseumBattleEndLogic.BattleMode mode)
 {
     GameWebAPI.ColosseumBattleEndLogic request = new GameWebAPI.ColosseumBattleEndLogic
     {
         SetSendData = delegate(GameWebAPI.ReqData_ColosseumBattleEndLogic param)
         {
             param.battleResult         = (int)result;
             param.roundCount           = 0;
             param.skillUseDeckPosition = "0";
             param.isMockBattle         = (int)mode;
         }
     };
     return(new APIRequestTask(request, true));
 }
        private IEnumerator ExecuteColosseumBattleEndLogic(GameWebAPI.ReqData_ColosseumBattleEndLogic.BattleResult battleResult, Action <bool> callback = null)
        {
            GameWebAPI.RespData_ColosseumBattleEndLogic colosseumEnd = null;
            GameWebAPI.ColosseumBattleEndLogic          request      = new GameWebAPI.ColosseumBattleEndLogic
            {
                SetSendData = delegate(GameWebAPI.ReqData_ColosseumBattleEndLogic param)
                {
                    param.battleResult         = (int)battleResult;
                    param.roundCount           = 1;
                    param.isMockBattle         = ((!(ClassSingleton <MultiBattleData> .Instance.MockBattleUserCode == "0")) ? 1 : 0);
                    param.skillUseDeckPosition = "0";
                },
                OnReceived = delegate(GameWebAPI.RespData_ColosseumBattleEndLogic resData)
                {
                    colosseumEnd = resData;
                }
            };
            RequestBase request2 = request;

            if (ApplicationMonitor.< > f__mg$cache0 == null)
            {
                ApplicationMonitor.< > f__mg$cache0 = new Action(RestrictionInput.EndLoad);
            }
            yield return(request2.Run(ApplicationMonitor.< > 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;
                }
                if (callback != null)
                {
                    callback(true);
                }
            }
            else
            {
                responseData.reward = new MultiBattleData.BattleEndResponseData.Reward[0];
                if (callback != null)
                {
                    callback(false);
                }
            }
            ClassSingleton <MultiBattleData> .Instance.BattleEndResponse = responseData;
            yield break;
        }