public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnFailed();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         if (jsonObject.body == null)
         {
             this.OnFailed();
         }
         else
         {
             try
             {
                 MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.player);
             }
             catch (Exception ex)
             {
                 DebugUtility.LogException(ex);
                 this.OnFailed();
                 return;
             }
             Network.RemoveAPI();
             MyMetaps.TrackSpendCoin(this.ResetType.ToString(), this.getRequiredCoin());
             this.Success();
         }
     }
 }
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.GoldBuyCostShort:
                    if (this.ShowResult)
                    {
                        this.OutOfCoin();
                    }
                    this.OnBack();
                    break;

                case Network.EErrCode.GoldBuyLimit:
                    if (this.ShowResult)
                    {
                        this.OutOfBuyCount();
                    }
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    PlayerData.EDeserializeFlags flag = (PlayerData.EDeserializeFlags)(0 | 2 | 1);
                    if (!MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.player, flag))
                    {
                        this.OnRetry();
                    }
                    else
                    {
                        Network.RemoveAPI();
                        MyMetaps.TrackSpendCoin("BuyGold", this.getRequiredCoin());
                        if (this.ShowResult)
                        {
                            FixParam fixParam = MonoSingleton <GameManager> .Instance.MasterParam.FixParam;
                            UIUtility.SystemMessage((string)null, LocalizedText.Get("sys.GOLDBOUGHT", (object)fixParam.BuyGoldCost, (object)fixParam.BuyGoldAmount), (UIUtility.DialogResultEvent)(go => {}), (GameObject)null, false, -1);
                            MonoSingleton <GameManager> .Instance.Player.OnGoldChange((int)fixParam.BuyGoldAmount);
                        }
                        this.Success();
                    }
                }
            }
        }
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                if (Network.ErrCode == Network.EErrCode.StaminaCoinShort)
                {
                    if (this.ShowResult)
                    {
                        this.OutOfCoin();
                    }
                    this.OnBack();
                }
                else
                {
                    this.OnRetry();
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    int staminaRecoveryCost = MonoSingleton <GameManager> .Instance.Player.GetStaminaRecoveryCost(true);

                    PlayerData.EDeserializeFlags flag = (PlayerData.EDeserializeFlags)(0 | 2 | 4);
                    if (!MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.player, flag))
                    {
                        this.OnRetry();
                    }
                    else
                    {
                        Network.RemoveAPI();
                        MyMetaps.TrackSpendCoin("BuyStamina", staminaRecoveryCost);
                        if (this.ShowResult)
                        {
                            UIUtility.SystemMessage((string)null, LocalizedText.Get("sys.STAMINARECOVERED", new object[1]
                            {
                                (object)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.StaminaAdd
                            }), (UIUtility.DialogResultEvent)(go => {}), (GameObject)null, false, -1);
                        }
                        this.Success();
                    }
                }
            }
        }
Exemple #4
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnFailed();
     }
     else
     {
         WebAPI.JSON_BodyResponse <BattleCore.Json_BattleCont> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <BattleCore.Json_BattleCont> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         if (jsonObject.body == null)
         {
             this.OnFailed();
         }
         else
         {
             GlobalVars.MultiPlayBattleCont = jsonObject.body;
             PlayerData.EDeserializeFlags flag = (PlayerData.EDeserializeFlags)(0 | 2);
             if (!MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.player, flag))
             {
                 this.OnFailed();
             }
             else
             {
                 Network.RemoveAPI();
                 SceneBattle instance = SceneBattle.Instance;
                 int         num      = (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.ContinueCoinCostMulti;
                 if (Object.op_Inequality((Object)instance, (Object)null) && instance.Battle != null && instance.Battle.IsMultiTower)
                 {
                     num = (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.ContinueCoinCostMultiTower;
                 }
                 MyMetaps.TrackSpendCoin("ContinueMultiQuest", num);
                 this.Success();
             }
         }
     }
 }
Exemple #5
0
        private void OnRequestResult(WWWResult www)
        {
            if (Network.IsError)
            {
                if (Network.ErrCode == Network.EErrCode.AbilityCoinShort)
                {
                    FlowNode_Network.Back();
                }
                else
                {
                    FlowNode_Network.Retry();
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

                    Network.RemoveAPI();
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    FlowNode_Network.Retry();
                    return;
                }
                if (this.UseCoin > 0)
                {
                    MyMetaps.TrackSpendCoin("AbilityPoint", this.UseCoin);
                }
                this.UseCoin = 0;
                this.UpdateValue();
                this.Success();
            }
        }