Пример #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 static int[] CalcExcitesForDrop(GachaDropData a_drop)
        {
            int rare = 0;

            if (a_drop != null)
            {
                rare = a_drop.Rare;
            }
            return(GachaExciteMaster.SelectStone(JSONParser.parseJSONArray <Json_GachaExcite>(AssetManager.LoadTextData("Data/gacha/stone_animation_pattern")), rare));
        }
Пример #4
0
        public static int[] CalcExcites(List <GachaDropData> a_drops)
        {
            int num = 1;

            using (List <GachaDropData> .Enumerator enumerator = a_drops.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    GachaDropData current = enumerator.Current;
                    if (current != null)
                    {
                        num = Math.Max(num, current.Rare);
                    }
                }
            }
            return(GachaExciteMaster.Select(JSONParser.parseJSONArray <Json_GachaExcite>(AssetManager.LoadTextData("Data/gacha/animation_pattern")), num));
        }
Пример #5
0
        private int GetPastShard(int index = 0, string iname = "")
        {
            if (string.IsNullOrEmpty(iname))
            {
                return(-1);
            }
            int num = 0;

            for (int index1 = 0; index1 < index; ++index1)
            {
                GachaDropData drop = GachaResultData.drops[index1];
                if (drop.unit == null && drop.artifact == null && (drop.item.type == EItemType.UnitPiece && !(iname != drop.item.iname)))
                {
                    num += drop.num;
                }
            }
            return(num);
        }
Пример #6
0
        private int GetAmountShardEx(int index = 0, string iname = "")
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            for (int index1 = GachaResultData.drops.Length - 1; index1 > index; --index1)
            {
                GachaDropData drop = GachaResultData.drops[index1];
                if (drop.unit == null && drop.artifact == null && (!(iname != drop.item.iname) && instance.MasterParam.GetUnitParamForPiece(drop.item.iname, true) != null))
                {
                    int num = !dictionary.ContainsKey(iname) ? instance.Player.GetItemAmount(iname) : dictionary[iname];
                    if (num > 0)
                    {
                        num -= drop.num;
                    }
                    dictionary[iname] = num;
                }
            }
            if (dictionary.ContainsKey(iname))
            {
                return(dictionary[iname]);
            }
            return(0);
        }
        private void Init()
        {
            int  length = GachaResultData.drops.Length;
            bool flag   = false;

            for (int index = 0; index < GachaResultData.drops.Length; ++index)
            {
                if (GachaResultData.drops[index].type == GachaDropData.Type.Unit)
                {
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                MonoSingleton <GameManager> .Instance.Player.UpdateUnitTrophyStates(false);
            }
            FlowNode_Variable.Set("GachaResultSingle", "0");
            if (length == 1 && GachaResultData.drops[0].type == GachaDropData.Type.Unit)
            {
                if (!string.IsNullOrEmpty(FlowNode_Variable.Get("GachaResultCurrentDetail")))
                {
                    FlowNode_Variable.Set("GachaResultCurrentDetail", string.Empty);
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "CLOSED_RESULT_SINGLE");
                }
                else
                {
                    FlowNode_Variable.Set("GachaResultSingle", "1");
                    this.OnSelectIcon(0, GachaResultThumbnailWindow.GachaResultType.Unit);
                }
            }
            else
            {
                GameObject gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.ResultListTemplate);
                ((Object)gameObject1).set_name("resultlist1");
                gameObject1.get_transform().SetParent(this.ResultListTemplate.get_transform().get_parent(), false);
                this.mResultList[0] = gameObject1;
                if (length > 5)
                {
                    GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ResultListTemplate);
                    ((Object)gameObject2).set_name("resultlist2");
                    gameObject2.get_transform().SetParent(this.ResultListTemplate.get_transform().get_parent(), false);
                    this.mResultList[1] = gameObject2;
                }
                Transform transform1 = this.mResultList[0].get_transform().Find("content");
                Transform transform2 = (Transform)null;
                if (Object.op_Inequality((Object)this.mResultList[1], (Object)null))
                {
                    transform2 = this.mResultList[1].get_transform().Find("content");
                }
                for (int index = 0; index < length; ++index)
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    GachaResultThumbnailWindow.\u003CInit\u003Ec__AnonStorey249 initCAnonStorey249 = new GachaResultThumbnailWindow.\u003CInit\u003Ec__AnonStorey249();
                    // ISSUE: reference to a compiler-generated field
                    initCAnonStorey249.\u003C\u003Ef__this = this;
                    GameObject    gameObject2 = (GameObject)null;
                    GachaDropData drop        = GachaResultData.drops[index];
                    // ISSUE: reference to a compiler-generated field
                    initCAnonStorey249.index = index;
                    if (drop.type == GachaDropData.Type.Unit)
                    {
                        gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitIconTemplate);
                        ((Object)gameObject2).set_name("icon_" + index.ToString());
                        DataSource.Bind <UnitData>(gameObject2, this.CreateUnitData(drop.unit));
                        ((UnitIcon)gameObject2.GetComponent <UnitIcon>()).UpdateValue();
                        Button component = (Button)gameObject2.GetComponent <Button>();
                        ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
                        // ISSUE: method pointer
                        ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)initCAnonStorey249, __methodptr(\u003C\u003Em__285)));
                    }
                    else if (drop.type == GachaDropData.Type.Item)
                    {
                        gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemIconTemplate);
                        DataSource.Bind <ItemData>(gameObject2, this.CreateItemData(drop.item, drop.num));
                        ((ItemIcon)gameObject2.GetComponent <ItemIcon>()).UpdateValue();
                        Button component = (Button)gameObject2.GetComponent <Button>();
                        ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
                        if (!string.IsNullOrEmpty(drop.item.flavor))
                        {
                            // ISSUE: method pointer
                            ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)initCAnonStorey249, __methodptr(\u003C\u003Em__286)));
                        }
                        else
                        {
                            // ISSUE: method pointer
                            ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)initCAnonStorey249, __methodptr(\u003C\u003Em__287)));
                        }
                    }
                    else if (drop.type == GachaDropData.Type.Artifact)
                    {
                        gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ArtifactIconTemplate);
                        DataSource.Bind <ArtifactData>(gameObject2, this.CreateArtifactData(drop.artifact));
                        ((ArtifactIcon)gameObject2.GetComponent <ArtifactIcon>()).UpdateValue();
                        Button component = (Button)gameObject2.GetComponent <Button>();
                        ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
                        // ISSUE: method pointer
                        ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)initCAnonStorey249, __methodptr(\u003C\u003Em__288)));
                    }
                    if (drop.isNew)
                    {
                        GameObject gameObject3 = ((Component)gameObject2.get_transform().FindChild("body/new")).get_gameObject();
                        if (Object.op_Inequality((Object)gameObject3, (Object)null))
                        {
                            gameObject3.SetActive(true);
                        }
                    }
                    if (index < 5)
                    {
                        gameObject2.get_transform().SetParent(transform1, false);
                    }
                    else if (Object.op_Inequality((Object)transform2, (Object)null))
                    {
                        gameObject2.get_transform().SetParent(transform2, false);
                    }
                    this.mThumbnailList[index] = gameObject2;
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
                this.RefreshThumbnail();
            }
        }
        private void RefreshThumbnail()
        {
            GameObject gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.ResultListTemplate);

            gameObject1.get_transform().SetParent(this.ResultListTemplate.get_transform().get_parent(), false);
            gameObject1.SetActive(true);
            this.mResultList[0] = gameObject1;
            if (GachaResultData.drops.Length > 5)
            {
                GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ResultListTemplate);
                gameObject2.get_transform().SetParent(this.ResultListTemplate.get_transform().get_parent(), false);
                gameObject2.SetActive(true);
                this.mResultList[1] = gameObject2;
            }
            Transform transform1 = this.mResultList[0].get_transform().Find("content");
            Transform transform2 = !Object.op_Inequality((Object)this.mResultList[1], (Object)null) ? (Transform)null : this.mResultList[1].get_transform().Find("content");
            int       length     = GachaResultData.drops.Length;

            for (int index = 0; index < length; ++index)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                GachaResultThumbnailWindow.\u003CRefreshThumbnail\u003Ec__AnonStorey248 thumbnailCAnonStorey248 = new GachaResultThumbnailWindow.\u003CRefreshThumbnail\u003Ec__AnonStorey248();
                // ISSUE: reference to a compiler-generated field
                thumbnailCAnonStorey248.\u003C\u003Ef__this = this;
                GachaDropData drop        = GachaResultData.drops[index];
                GameObject    gameObject2 = (GameObject)null;
                // ISSUE: reference to a compiler-generated field
                thumbnailCAnonStorey248.type = GachaResultThumbnailWindow.GachaResultType.None;
                // ISSUE: reference to a compiler-generated field
                thumbnailCAnonStorey248.index = index;
                if (drop.type == GachaDropData.Type.Unit)
                {
                    gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitIconTemplate);
                    DataSource.Bind <UnitData>(gameObject2, this.CreateUnitData(drop.unit));
                    ((UnitIcon)gameObject2.GetComponent <UnitIcon>()).UpdateValue();
                    // ISSUE: reference to a compiler-generated field
                    thumbnailCAnonStorey248.type = GachaResultThumbnailWindow.GachaResultType.Unit;
                }
                else if (drop.type == GachaDropData.Type.Item)
                {
                    gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemIconTemplate);
                    DataSource.Bind <ItemData>(gameObject2, this.CreateItemData(drop.item, drop.num));
                    ((ItemIcon)gameObject2.GetComponent <ItemIcon>()).UpdateValue();
                    // ISSUE: reference to a compiler-generated field
                    thumbnailCAnonStorey248.type = !string.IsNullOrEmpty(drop.item.flavor) ? GachaResultThumbnailWindow.GachaResultType.Item : GachaResultThumbnailWindow.GachaResultType.Piece;
                }
                else if (drop.type == GachaDropData.Type.Artifact)
                {
                    gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)this.ArtifactIconTemplate);
                    DataSource.Bind <ArtifactData>(gameObject2, this.CreateArtifactData(drop.artifact));
                    ((ArtifactIcon)gameObject2.GetComponent <ArtifactIcon>()).UpdateValue();
                    // ISSUE: reference to a compiler-generated field
                    thumbnailCAnonStorey248.type = GachaResultThumbnailWindow.GachaResultType.Artifact;
                }
                gameObject2.SetActive(true);
                Button component = (Button)gameObject2.GetComponent <Button>();
                ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
                // ISSUE: method pointer
                ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)thumbnailCAnonStorey248, __methodptr(\u003C\u003Em__284)));
                if (drop.isNew)
                {
                    GameObject gameObject3 = ((Component)gameObject2.get_transform().FindChild("body/new")).get_gameObject();
                    if (Object.op_Inequality((Object)gameObject3, (Object)null))
                    {
                        gameObject3.SetActive(true);
                    }
                }
                if (index < 5)
                {
                    if (Object.op_Inequality((Object)transform1, (Object)null))
                    {
                        gameObject2.get_transform().SetParent(transform1, false);
                    }
                }
                else if (Object.op_Inequality((Object)transform2, (Object)null))
                {
                    gameObject2.get_transform().SetParent(transform2, false);
                }
                this.mThumbnailList[index] = gameObject2;
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Пример #9
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.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:
                    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();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    this.Failure();
                    return;
                }
                List <GachaDropData> gachaDropDataList = new List <GachaDropData>();
                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.addMail != null)
                {
                    foreach (Json_DropInfo json in jsonObject.body.addMail)
                    {
                        GachaDropData gachaDropData = new GachaDropData();
                        if (gachaDropData.Deserialize(json))
                        {
                            a_dropMails.Add(gachaDropData);
                        }
                    }
                }
                GachaReceiptData a_receipt = new GachaReceiptData();
                a_receipt.Deserialize(jsonObject.body.receipt);
                GachaResultData.Init(gachaDropDataList, a_dropMails, a_receipt);
                CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type);
                AnalyticsManager.TrackSummonComplete();
                MonoSingleton <GameManager> .Instance.Player.OnGacha(this.mCurrentGachaType, this.mCurrentNum);

                this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList));
            }
        }
Пример #10
0
        private void RefreshThumbnail()
        {
            if (GachaResultData.drops == null)
            {
                return;
            }
            int length = GachaResultData.drops.Length;

            this.mResultList[0] = this.CreateHorizontalList();
            if (length > 5)
            {
                this.mResultList[1] = this.CreateHorizontalList();
            }
            Transform transform1 = this.mResultList[0].get_transform().Find("content");
            Transform transform2 = !UnityEngine.Object.op_Equality((UnityEngine.Object) this.mResultList[1], (UnityEngine.Object)null) ? this.mResultList[1].get_transform().Find("content") : (Transform)null;
            int       num        = Math.Min(length, GachaResultThumbnailWindow.CONTENT_VIEW_MAX);

            for (int index = 0; index < num; ++index)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                GachaResultThumbnailWindow.\u003CRefreshThumbnail\u003Ec__AnonStorey333 thumbnailCAnonStorey333 = new GachaResultThumbnailWindow.\u003CRefreshThumbnail\u003Ec__AnonStorey333();
                // ISSUE: reference to a compiler-generated field
                thumbnailCAnonStorey333.\u003C\u003Ef__this = this;
                // ISSUE: reference to a compiler-generated field
                thumbnailCAnonStorey333.index = index + this.mCurrentPage * GachaResultThumbnailWindow.CONTENT_VIEW_MAX;
                // ISSUE: reference to a compiler-generated field
                if (length >= thumbnailCAnonStorey333.index)
                {
                    // ISSUE: reference to a compiler-generated field
                    GachaDropData drop = GachaResultData.drops[thumbnailCAnonStorey333.index];
                    // ISSUE: reference to a compiler-generated field
                    thumbnailCAnonStorey333.type = GachaResultThumbnailWindow.GachaResultType.None;
                    GameObject gameObject1 = (GameObject)null;
                    if (drop.type == GachaDropData.Type.Unit)
                    {
                        gameObject1 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.UnitIconTemplate);
                        DataSource.Bind <UnitData>(gameObject1, this.CreateUnitData(drop.unit));
                        // ISSUE: reference to a compiler-generated field
                        thumbnailCAnonStorey333.type = GachaResultThumbnailWindow.GachaResultType.Unit;
                    }
                    else if (drop.type == GachaDropData.Type.Item)
                    {
                        gameObject1 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemIconTemplate);
                        DataSource.Bind <ItemData>(gameObject1, this.CreateItemData(drop.item, drop.num));
                        // ISSUE: reference to a compiler-generated field
                        thumbnailCAnonStorey333.type = !string.IsNullOrEmpty(drop.item.flavor) ? GachaResultThumbnailWindow.GachaResultType.Item : GachaResultThumbnailWindow.GachaResultType.Piece;
                    }
                    else if (drop.type == GachaDropData.Type.Artifact)
                    {
                        gameObject1 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ArtifactIconTemplate);
                        DataSource.Bind <ArtifactData>(gameObject1, this.CreateArtifactData(drop.artifact, drop.Rare));
                        // ISSUE: reference to a compiler-generated field
                        thumbnailCAnonStorey333.type = GachaResultThumbnailWindow.GachaResultType.Artifact;
                    }
                    // ISSUE: reference to a compiler-generated field
                    if (thumbnailCAnonStorey333.type != GachaResultThumbnailWindow.GachaResultType.None)
                    {
                        gameObject1.SetActive(true);
                        Button component = (Button)gameObject1.GetComponent <Button>();
                        ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
                        // ISSUE: method pointer
                        ((UnityEvent)component.get_onClick()).AddListener(new UnityAction((object)thumbnailCAnonStorey333, __methodptr(\u003C\u003Em__37D)));
                        if (drop.isNew)
                        {
                            GameObject gameObject2 = ((Component)gameObject1.get_transform().FindChild("body/new")).get_gameObject();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject2, (UnityEngine.Object)null))
                            {
                                gameObject2.SetActive(true);
                            }
                        }
                        if (index < 5)
                        {
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)transform1, (UnityEngine.Object)null))
                            {
                                gameObject1.get_transform().SetParent(transform1, false);
                            }
                        }
                        else if (UnityEngine.Object.op_Inequality((UnityEngine.Object)transform2, (UnityEngine.Object)null))
                        {
                            gameObject1.get_transform().SetParent(transform2, false);
                        }
                        this.mThumbnailList[index] = gameObject1;
                    }
                }
                else
                {
                    break;
                }
            }
            this.RefreshPagerToggle(this.mCurrentPage);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Пример #11
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_PendingGachaResponse> res = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PendingGachaResponse> >(www.text);
         DebugUtility.Assert(res != null, "res == null");
         Network.RemoveAPI();
         if (res.body == null)
         {
             return;
         }
         List <GachaDropData> gachaDropDataList = new List <GachaDropData>();
         foreach (Json_DropInfo json in res.body.add)
         {
             GachaDropData gachaDropData = new GachaDropData();
             if (gachaDropData.Deserialize(json))
             {
                 gachaDropDataList.Add(gachaDropData);
             }
         }
         List <GachaDropData> a_dropMails = new List <GachaDropData>();
         if (res.body.add_mail != null)
         {
             foreach (Json_DropInfo json in res.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.iname = res.body.gacha.gname;
         int a_redraw_rest = 0;
         if (res.body.rest > 0)
         {
             a_redraw_rest = res.body.rest;
         }
         GachaResultData.Init(gachaDropDataList, a_dropMails, (List <int>)null, a_receipt, false, a_redraw_rest <= 0 ? 0 : 1, a_redraw_rest);
         bool flag = false;
         if ((MonoSingleton <GameManager> .Instance.Player.TutorialFlags & 1L) != 0L)
         {
             string empty = string.Empty;
             if (a_redraw_rest > 0)
             {
                 if (res.body.gacha.time_end > Network.GetServerTime())
                 {
                     flag = true;
                 }
                 else
                 {
                     empty = LocalizedText.Get("sys.GACHA_REDRAW_CAUTION_OUTOF_PERIOD");
                 }
             }
             else
             {
                 empty = LocalizedText.Get("sys.GACHA_REDRAW_CAUTION_LIMIT_UPPER");
             }
             if (!flag)
             {
                 UIUtility.SystemMessage(empty, (UIUtility.DialogResultEvent)(go => this.ExecGacha(res.body.gacha.gname)), (GameObject)null, true, -1);
                 return;
             }
         }
         this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList));
     }
 }
Пример #12
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));
                }
            }
        }
Пример #13
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));
             }
         }
     }
 }
        private void RefreshResult(GachaDropData[] _drops, GameObject _block, int _block_type, bool _is_anim = false)
        {
            if (_drops == null || _drops.Length < 0 || UnityEngine.Object.op_Equality((UnityEngine.Object)_block, (UnityEngine.Object)null))
            {
                return;
            }
            _block.SetActive(true);
            int length = _drops.Length;
            SerializeValueBehaviour component1 = (SerializeValueBehaviour)_block.GetComponent <SerializeValueBehaviour>();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
            {
                GameObject gameObject1 = component1.list.GetGameObject("icon");
                gameObject1.SetActive(false);
                for (int index1 = 0; index1 < length; ++index1)
                {
                    GachaDropData drop = _drops[index1];
                    int           num  = index1;
                    GachaResultThumbnailWindow.GachaResultType gachaResultType = GachaResultThumbnailWindow.GachaResultType.None;
                    if (drop != null)
                    {
                        GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)gameObject1);
                        gameObject2.get_transform().SetParent(gameObject1.get_transform().get_parent(), false);
                        ((Behaviour)gameObject2.GetComponent <Animator>()).set_enabled(_is_anim);
                        SerializeValueBehaviour component2 = (SerializeValueBehaviour)gameObject2.GetComponent <SerializeValueBehaviour>();
                        if (!UnityEngine.Object.op_Equality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                        {
                            GameObject gameObject3 = (GameObject)null;
                            if (drop.type == GachaDropData.Type.Unit)
                            {
                                gameObject3 = component2.list.GetGameObject("unit");
                                DataSource.Bind <UnitData>(gameObject3, this.CreateUnitData(drop.unit));
                                gachaResultType = GachaResultThumbnailWindow.GachaResultType.Unit;
                            }
                            else if (drop.type == GachaDropData.Type.Item)
                            {
                                gameObject3 = component2.list.GetGameObject("item");
                                DataSource.Bind <ItemData>(gameObject3, this.CreateItemData(drop.item, drop.num));
                                ItemIcon component3 = (ItemIcon)gameObject3.GetComponent <ItemIcon>();
                                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component3, (UnityEngine.Object)null))
                                {
                                    component3.UpdateValue();
                                }
                                gachaResultType = !string.IsNullOrEmpty(drop.item.Flavor) ? GachaResultThumbnailWindow.GachaResultType.Item : GachaResultThumbnailWindow.GachaResultType.Piece;
                            }
                            else if (drop.type == GachaDropData.Type.Artifact)
                            {
                                gameObject3 = component2.list.GetGameObject("artifact");
                                DataSource.Bind <ArtifactData>(gameObject3, this.CreateArtifactData(drop.artifact, drop.Rare));
                                gachaResultType = GachaResultThumbnailWindow.GachaResultType.Artifact;
                            }
                            else if (drop.type == GachaDropData.Type.ConceptCard)
                            {
                                gameObject3 = component2.list.GetGameObject("conceptcard");
                                ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(drop.conceptcard.iname);
                                ConceptCardIcon component3         = (ConceptCardIcon)gameObject3.GetComponent <ConceptCardIcon>();
                                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component3, (UnityEngine.Object)null))
                                {
                                    component3.Setup(cardDataForDisplay);
                                    SerializeValueBehaviour component4 = (SerializeValueBehaviour)gameObject3.GetComponent <SerializeValueBehaviour>();
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component4, (UnityEngine.Object)null))
                                    {
                                        GameObject gameObject4 = component4.list.GetGameObject("unit_icon");
                                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject4, (UnityEngine.Object)null))
                                        {
                                            UnitData data = (UnitData)null;
                                            if (drop.cardunit != null)
                                            {
                                                data = this.CreateUnitData(drop.cardunit);
                                            }
                                            DataSource.Bind <UnitData>(gameObject4, data);
                                            gameObject4.SetActive(drop.cardunit != null);
                                        }
                                        GameObject gameObject5 = component4.list.GetGameObject("skin");
                                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject5, (UnityEngine.Object)null))
                                        {
                                            bool flag = false;
                                            if (drop.conceptcard.effects != null && drop.conceptcard.effects.Length > 0)
                                            {
                                                for (int index2 = 0; index2 < drop.conceptcard.effects.Length; ++index2)
                                                {
                                                    ConceptCardEffectsParam effect = drop.conceptcard.effects[index2];
                                                    if (effect != null && !string.IsNullOrEmpty(effect.skin))
                                                    {
                                                        flag = true;
                                                        break;
                                                    }
                                                }
                                            }
                                            gameObject5.SetActive(flag);
                                        }
                                    }
                                }
                                gachaResultType = GachaResultThumbnailWindow.GachaResultType.ConceptCard;
                            }
                            if (UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject3, (UnityEngine.Object)null))
                            {
                                DebugUtility.LogError("アイコンオブジェクトがありません");
                                break;
                            }
                            SerializeValueBehaviour component5 = (SerializeValueBehaviour)gameObject3.GetComponent <SerializeValueBehaviour>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component5, (UnityEngine.Object)null))
                            {
                                GameObject gameObject4 = component5.list.GetGameObject("new");
                                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component5, (UnityEngine.Object)null))
                                {
                                    gameObject4.SetActive(drop.isNew);
                                }
                            }
                            ButtonEvent component6 = (ButtonEvent)gameObject3.GetComponent <ButtonEvent>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component6, (UnityEngine.Object)null))
                            {
                                ButtonEvent.Event @event = component6.GetEvent("CLICK_ICON");
                                if (@event != null)
                                {
                                    @event.valueList.SetField("index", num);
                                    @event.valueList.SetField("type", (int)gachaResultType);
                                    @event.valueList.SetField("block", _block_type);
                                    if (gachaResultType == GachaResultThumbnailWindow.GachaResultType.ConceptCard)
                                    {
                                        @event.valueList.SetField("is_first_get_unit", drop.cardunit != null);
                                    }
                                }
                            }
                            gameObject3.SetActive(true);
                            this.m_ResultIconRootList.Add(gameObject2);
                            if (_block_type == 0)
                            {
                                this.m_ResultIconRootList.Add(gameObject2);
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            SerializeValueBehaviour component7 = (SerializeValueBehaviour)((Component)this).get_gameObject().GetComponent <SerializeValueBehaviour>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component7, (UnityEngine.Object)null))
            {
                return;
            }
            GameObject gameObject = component7.list.GetGameObject("space");

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
            {
                return;
            }
            gameObject.get_transform().SetAsLastSibling();
            gameObject.SetActive(length > GachaResultThumbnailWindow.VIEW_COUNT);
        }