Пример #1
0
 public static void Init(List <GachaDropData> a_drops = null, List <GachaDropData> a_dropMails = null, GachaReceiptData a_receipt = null)
 {
     GachaResultData.Reset();
     if (a_drops != null)
     {
         GachaResultData.drops_ = a_drops;
     }
     if (a_dropMails != null)
     {
         GachaResultData.dropMails_ = a_dropMails;
     }
     GachaResultData.excites_ = GachaResultData.CalcExcites(a_drops);
     if (a_receipt != null)
     {
         GachaResultData.receipt = a_receipt;
     }
     using (List <GachaDropData> .Enumerator enumerator = GachaResultData.drops_.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             GachaDropData current = enumerator.Current;
             current.excites = GachaResultData.CalcExcitesForDrop(current);
         }
     }
 }
Пример #2
0
 public static void Init(List <GachaDropData> a_drops = null, List <GachaDropData> a_dropMails = null, List <int> a_summonCoins = null, GachaReceiptData a_receipt = null, bool a_use_onemore = false, int a_is_pending = -1, int a_redraw_rest = -1)
 {
     GachaResultData.Reset();
     if (a_drops != null)
     {
         GachaResultData.drops_ = a_drops;
     }
     if (a_dropMails != null)
     {
         GachaResultData.dropMails_ = a_dropMails;
     }
     if (a_summonCoins != null)
     {
         GachaResultData.summonCoins_ = a_summonCoins;
     }
     GachaResultData.excites_ = GachaResultData.CalcExcites(a_drops);
     if (a_receipt != null)
     {
         GachaResultData.receipt = a_receipt;
     }
     using (List <GachaDropData> .Enumerator enumerator = GachaResultData.drops_.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             GachaDropData current = enumerator.Current;
             current.excites = GachaResultData.CalcExcitesForDrop(current);
         }
     }
     GachaResultData.use_one_more_ = a_use_onemore;
     GachaResultData.m_is_pending  = a_is_pending;
     GachaResultData.m_redraw_rest = a_redraw_rest;
 }
Пример #3
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_GachaList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaList> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         if (jsonObject.body == null)
         {
             this.Failure();
         }
         else
         {
             GameManager instance = MonoSingleton <GameManager> .Instance;
             try
             {
                 if (!instance.Deserialize(jsonObject.body))
                 {
                     this.Failure();
                     return;
                 }
             }
             catch (Exception ex)
             {
                 DebugUtility.LogException(ex);
                 this.Failure();
                 return;
             }
             GachaResultData.Reset();
             if (FlowNode_Variable.Get("REDRAW_GACHA_PENDING") == "1")
             {
                 this.ToCheckPending();
             }
             else
             {
                 this.Success();
             }
         }
     }
 }
Пример #4
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));
                }
            }
        }