コード例 #1
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                switch (errCode)
                {
                case Network.EErrCode.NoGacha:
                    this.OnFailed();
                    break;

                case Network.EErrCode.GachaCostShort:
                    this.OnBack();
                    break;

                case Network.EErrCode.GachaItemMax:
                    this.OnBack();
                    break;

                case Network.EErrCode.GachaPaidLimitOver:
                    this.PaidGachaLimitOver();
                    break;

                default:
                    if (errCode == Network.EErrCode.GachaOutofPeriod)
                    {
                        this.OutofPeriod();
                        break;
                    }
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_GachaResult> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaResult> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                ItemData itemDataByItemId1 = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID("IT_US_SUMMONS_01");

                int num1 = itemDataByItemId1 != null ? itemDataByItemId1.Num : 0;
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    this.Failure();
                    return;
                }
                ItemData itemDataByItemId2 = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID("IT_US_SUMMONS_01");

                int        num2          = itemDataByItemId2 != null ? itemDataByItemId2.Num : 0;
                List <int> a_summonCoins = new List <int>();
                a_summonCoins.Add(num1);
                a_summonCoins.Add(num2);
                List <GachaDropData> gachaDropDataList = new List <GachaDropData>();
                if (jsonObject.body.add != null && jsonObject.body.add.Length > 0)
                {
                    foreach (Json_DropInfo json in jsonObject.body.add)
                    {
                        GachaDropData gachaDropData = new GachaDropData();
                        if (gachaDropData.Deserialize(json))
                        {
                            gachaDropDataList.Add(gachaDropData);
                        }
                    }
                }
                List <GachaDropData> a_dropMails = new List <GachaDropData>();
                if (jsonObject.body.add_mail != null)
                {
                    foreach (Json_DropInfo json in jsonObject.body.add_mail)
                    {
                        GachaDropData gachaDropData = new GachaDropData();
                        if (gachaDropData.Deserialize(json))
                        {
                            a_dropMails.Add(gachaDropData);
                        }
                    }
                }
                for (int index = 0; index < gachaDropDataList.Count; ++index)
                {
                    if (gachaDropDataList[index].type == GachaDropData.Type.ConceptCard)
                    {
                        GlobalVars.IsDirtyConceptCardData.Set(true);
                        break;
                    }
                }
                GachaReceiptData a_receipt = new GachaReceiptData();
                a_receipt.Deserialize(jsonObject.body.receipt);
                GachaResultData.Init(gachaDropDataList, a_dropMails, a_summonCoins, a_receipt, this.mUseOneMore, jsonObject.body.is_pending, jsonObject.body.rest);
                if (!GachaResultData.IsRedrawGacha || GachaResultData.IsRedrawGacha && this.API == FlowNode_ExecGacha2.ExecType.DECISION)
                {
                    MyMetaps.TrackSpend(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type), a_receipt.iname, a_receipt.val);
                    MonoSingleton <GameManager> .Instance.Player.OnGacha(this.mCurrentGachaType, gachaDropDataList.Count);
                }
                if (this.API == FlowNode_ExecGacha2.ExecType.DECISION)
                {
                    FlowNode_Variable.Set("REDRAW_GACHA_PENDING", string.Empty);
                    GachaResultData.Reset();
                    this.Success();
                }
                else
                {
                    this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList));
                }
            }
        }
コード例 #2
0
    public static bool TrackSpendShopUpdate(ESaleType sale_type, EShopType shop_type, int value)
    {
        string name = "ShopUpdate." + shop_type.ToString();

        return(MyMetaps.TrackSpend(sale_type.ToString(), name, value));
    }
コード例 #3
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         if (Network.ErrCode == Network.EErrCode.NoGacha)
         {
             this.OnFailed();
         }
         else
         {
             this.OnRetry();
         }
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_GachaResult> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaResult> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         try
         {
             MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             this.Failure();
             return;
         }
         List <GachaDropData> a_drops = new List <GachaDropData>();
         if (jsonObject.body.add != null && jsonObject.body.add.Length > 0)
         {
             foreach (Json_DropInfo json in jsonObject.body.add)
             {
                 GachaDropData gachaDropData = new GachaDropData();
                 if (gachaDropData.Deserialize(json))
                 {
                     a_drops.Add(gachaDropData);
                 }
             }
         }
         GachaReceiptData a_receipt = new GachaReceiptData();
         a_receipt.Deserialize(jsonObject.body.receipt);
         GachaResultData.Init(a_drops, (List <GachaDropData>)null, (List <int>)null, a_receipt, false, jsonObject.body.is_pending, jsonObject.body.rest);
         MyMetaps.TrackSpend(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type), a_receipt.iname, a_receipt.val);
         if (this.API == FlowNode_ExecTutorialGacha.ExecType.DECISION)
         {
             this.Success();
         }
         else
         {
             GachaDropData drop = GachaResultData.drops[0];
             if (drop == null)
             {
                 DebugUtility.LogError("召喚結果が存在しません");
                 this.Failure();
             }
             else
             {
                 this.StartCoroutine(this.AsyncDownload(drop.unit));
             }
         }
     }
 }
コード例 #4
0
 public static bool TrackSpendCoin(string name, int value)
 {
     return(MyMetaps.TrackSpend(ESaleType.Coin.ToString(), name, value));
 }