public bool SetGachaHistoryData(Json_GachaHistoryLog historys)
 {
     if (historys == null)
     {
         this.Cauntion.SetActive(true);
         ((Component)((Component)this.TitleText).get_transform().get_parent()).get_gameObject().SetActive(false);
         return(false);
     }
     this.mTitleName      = historys.title;
     this.mDropAt         = historys.drop_at;
     this.mLocalisedTitle = historys.multi_title;
     if (historys.drops != null && historys.drops.Length > 0)
     {
         this.mHistorys = new GachaHistoryData[historys.drops.Length];
         for (int index = 0; index < historys.drops.Length; ++index)
         {
             GachaHistoryData gachaHistoryData = new GachaHistoryData();
             if (gachaHistoryData.Deserialize(historys.drops[index]))
             {
                 this.mHistorys[index] = gachaHistoryData;
             }
         }
     }
     this.IsDataSet = true;
     return(true);
 }
        public bool SetGachaHistoryData(Json_GachaHistoryLog historys)
        {
            if (historys == null)
            {
                this.Cauntion.SetActive(true);
                ((Component)((Component)this.TitleText).get_transform().get_parent()).get_gameObject().SetActive(false);
                return(false);
            }
            this.mTitleName      = historys.title;
            this.mDropAt         = historys.drop_at;
            this.mLocalisedTitle = historys.multi_title;
            List <GachaHistoryData> source = new List <GachaHistoryData>();

            if (historys.drops != null && historys.drops.Length > 0)
            {
                for (int index = 0; index < historys.drops.Length; ++index)
                {
                    GachaHistoryData gachaHistoryData = new GachaHistoryData();
                    if (gachaHistoryData.Deserialize(historys.drops[index]))
                    {
                        source.Add(gachaHistoryData);
                    }
                }
            }
            if (historys.drops != null && historys.drops.Length > 0)
            {
                this.mHistorySets.Clear();
                this.mCacheHistorys.Clear();
                int num = Mathf.Max(1, historys.drops.Length / GachaHistoryWindow.NODE_VIEW_MAX);
                for (int index = 0; index < num; ++index)
                {
                    this.mCacheHistorys.Clear();
                    this.mCacheHistorys.AddRange(source.Skip <GachaHistoryData>(index * GachaHistoryWindow.NODE_VIEW_MAX).Take <GachaHistoryData>(GachaHistoryWindow.NODE_VIEW_MAX));
                    if (this.mCacheHistorys != null && this.mCacheHistorys.Count > 0)
                    {
                        this.mHistorySets.Add(this.mCacheHistorys.ToArray());
                    }
                }
            }
            this.IsDataSet = true;
            return(true);
        }
 private bool RefreshHistoryList()
 {
     this.mLists = new GameObject[this.mHistorys.Length];
     for (int index = 0; index < this.mHistorys.Length; ++index)
     {
         GachaHistoryData mHistory = this.mHistorys[index];
         if (mHistory != null)
         {
             GameObject root = (GameObject)null;
             if (mHistory.type == GachaDropData.Type.Unit)
             {
                 root = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitTemp);
                 root.get_transform().SetParent(this.UnitTemp.get_transform().get_parent(), false);
                 DataSource.Bind <UnitData>(root, this.CreateUnitData(mHistory.unit));
             }
             else if (mHistory.type == GachaDropData.Type.Item)
             {
                 root = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemp);
                 root.get_transform().SetParent(this.ItemTemp.get_transform().get_parent(), false);
                 DataSource.Bind <ItemData>(root, this.CreateItemData(mHistory.item, mHistory.num));
             }
             else if (mHistory.type == GachaDropData.Type.Artifact)
             {
                 root = (GameObject)Object.Instantiate <GameObject>((M0)this.ArtifactTemp);
                 root.get_transform().SetParent(this.ArtifactTemp.get_transform().get_parent(), false);
                 DataSource.Bind <ArtifactData>(root, this.CreateArtifactData(mHistory.artifact));
             }
             if (!Object.op_Equality((Object)root, (Object)null))
             {
                 Transform transform = root.get_transform().Find("body/status/new");
                 if (Object.op_Inequality((Object)transform, (Object)null))
                 {
                     ((Component)transform).get_gameObject().SetActive(mHistory.isNew);
                 }
                 this.mLists[index] = root;
                 root.SetActive(true);
                 GameParameter.UpdateAll(root);
             }
         }
     }
     return(true);
 }
Exemple #4
0
        private void Initalize()
        {
            GachaHistoryItemData dataOfClass = DataSource.FindDataOfClass <GachaHistoryItemData>(((Component)this).get_gameObject(), (GachaHistoryItemData)null);

            if (dataOfClass == null)
            {
                DebugUtility.LogError("履歴が存在しません");
            }
            else
            {
                Dictionary <string, List <ArtifactData> > dictionary = new Dictionary <string, List <ArtifactData> >();
                for (int index = dataOfClass.historys.Length - 1; index >= 0; --index)
                {
                    GachaHistoryData history = dataOfClass.historys[index];
                    if (history != null)
                    {
                        if (history.type == GachaDropData.Type.Unit)
                        {
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitIconObj);
                            if (Object.op_Inequality((Object)gameObject, (Object)null))
                            {
                                gameObject.get_transform().SetParent(this.ListParent, false);
                                gameObject.SetActive(true);
                                DataSource.Bind <UnitData>(gameObject, GachaHistoryWindow.CreateUnitData(history.unit));
                                NewBadgeParam data = new NewBadgeParam(true, history.isNew, NewBadgeType.Unit);
                                DataSource.Bind <NewBadgeParam>(gameObject, data);
                                this.mItems.Add(gameObject);
                                gameObject.get_transform().SetAsFirstSibling();
                            }
                        }
                        else if (history.type == GachaDropData.Type.Item)
                        {
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemIconObj);
                            if (Object.op_Inequality((Object)gameObject, (Object)null))
                            {
                                gameObject.get_transform().SetParent(this.ListParent, false);
                                gameObject.SetActive(true);
                                DataSource.Bind <ItemData>(gameObject, GachaHistoryWindow.CreateItemData(history.item, history.num));
                                NewBadgeParam data = new NewBadgeParam(true, history.isNew, NewBadgeType.Item);
                                DataSource.Bind <NewBadgeParam>(gameObject, data);
                                this.mItems.Add(gameObject);
                                gameObject.get_transform().SetAsFirstSibling();
                            }
                        }
                        else if (history.type == GachaDropData.Type.Artifact)
                        {
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ArtifactIconObj);
                            if (Object.op_Inequality((Object)gameObject, (Object)null))
                            {
                                gameObject.get_transform().SetParent(this.ListParent, false);
                                gameObject.SetActive(true);
                                DataSource.Bind <ArtifactData>(gameObject, GachaHistoryWindow.CreateArtifactData(history.artifact, history.rarity));
                                bool isnew = false;
                                if (dictionary.ContainsKey(history.artifact.iname))
                                {
                                    if (dictionary[history.artifact.iname].Count > 0)
                                    {
                                        dictionary[history.artifact.iname].RemoveAt(0);
                                    }
                                    isnew = dictionary[history.artifact.iname].Count <= 0;
                                }
                                else
                                {
                                    List <ArtifactData> artifactsByArtifactId = MonoSingleton <GameManager> .Instance.Player.FindArtifactsByArtifactID(history.artifact.iname);

                                    if (artifactsByArtifactId != null && artifactsByArtifactId.Count > 0)
                                    {
                                        artifactsByArtifactId.RemoveAt(0);
                                        dictionary.Add(history.artifact.iname, artifactsByArtifactId);
                                        isnew = artifactsByArtifactId.Count <= 0;
                                    }
                                }
                                NewBadgeParam data = new NewBadgeParam(true, isnew, NewBadgeType.Artifact);
                                DataSource.Bind <NewBadgeParam>(gameObject, data);
                                this.mItems.Add(gameObject);
                                gameObject.get_transform().SetAsFirstSibling();
                            }
                        }
                    }
                }
                if (Object.op_Inequality((Object)this.TitleText, (Object)null))
                {
                    Text component = (Text)this.TitleText.GetComponent <Text>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        string str = LocalizedText.Get("sys.TEXT_GACHA_HISTORY_FOOTER", (object)dataOfClass.GetDropAt().ToString("yyyy/MM/dd HH:mm:ss"), (object)dataOfClass.gachaTitle);
                        component.set_text(str);
                    }
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
        }
        private void Initalize()
        {
            GachaHistoryItemData dataOfClass = DataSource.FindDataOfClass <GachaHistoryItemData>(((Component)this).get_gameObject(), (GachaHistoryItemData)null);

            if (dataOfClass == null)
            {
                DebugUtility.LogError("履歴が存在しません");
            }
            else
            {
                for (int index = dataOfClass.historys.Length - 1; index >= 0; --index)
                {
                    GachaHistoryData history = dataOfClass.historys[index];
                    if (history != null)
                    {
                        GameObject gameObject1 = (GameObject)null;
                        bool       flag        = false;
                        if (history.type == GachaDropData.Type.Unit)
                        {
                            gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitIconObj);
                            if (Object.op_Inequality((Object)gameObject1, (Object)null))
                            {
                                gameObject1.get_transform().SetParent(this.ListParent, false);
                                gameObject1.SetActive(true);
                                DataSource.Bind <UnitData>(gameObject1, GachaHistoryWindow.CreateUnitData(history.unit));
                                flag = history.isNew;
                                this.mItems.Add(gameObject1);
                                gameObject1.get_transform().SetAsFirstSibling();
                            }
                        }
                        else if (history.type == GachaDropData.Type.Item)
                        {
                            gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemIconObj);
                            if (Object.op_Inequality((Object)gameObject1, (Object)null))
                            {
                                gameObject1.get_transform().SetParent(this.ListParent, false);
                                gameObject1.SetActive(true);
                                DataSource.Bind <ItemData>(gameObject1, GachaHistoryWindow.CreateItemData(history.item, history.num));
                                flag = history.isNew;
                                this.mItems.Add(gameObject1);
                                gameObject1.get_transform().SetAsFirstSibling();
                            }
                        }
                        else if (history.type == GachaDropData.Type.Artifact)
                        {
                            gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.ArtifactIconObj);
                            if (Object.op_Inequality((Object)gameObject1, (Object)null))
                            {
                                gameObject1.get_transform().SetParent(this.ListParent, false);
                                gameObject1.SetActive(true);
                                DataSource.Bind <ArtifactData>(gameObject1, GachaHistoryWindow.CreateArtifactData(history.artifact, history.rarity));
                                flag = history.isNew;
                                this.mItems.Add(gameObject1);
                                gameObject1.get_transform().SetAsFirstSibling();
                            }
                        }
                        else if (history.type == GachaDropData.Type.ConceptCard)
                        {
                            gameObject1 = (GameObject)Object.Instantiate <GameObject>((M0)this.ConceptCardIconObj);
                            if (Object.op_Inequality((Object)gameObject1, (Object)null))
                            {
                                gameObject1.get_transform().SetParent(this.ListParent, false);
                                gameObject1.SetActive(true);
                                ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(history.conceptcard.iname);
                                ConceptCardIcon component          = (ConceptCardIcon)gameObject1.GetComponent <ConceptCardIcon>();
                                if (Object.op_Inequality((Object)component, (Object)null))
                                {
                                    component.Setup(cardDataForDisplay);
                                }
                                flag = history.isNew;
                                this.mItems.Add(gameObject1);
                                gameObject1.get_transform().SetAsFirstSibling();
                            }
                        }
                        if (Object.op_Inequality((Object)gameObject1, (Object)null))
                        {
                            SerializeValueBehaviour component = (SerializeValueBehaviour)gameObject1.GetComponent <SerializeValueBehaviour>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                GameObject gameObject2 = component.list.GetGameObject("new");
                                if (Object.op_Inequality((Object)gameObject2, (Object)null))
                                {
                                    gameObject2.SetActive(flag);
                                }
                            }
                        }
                    }
                }
                if (Object.op_Inequality((Object)this.TitleText, (Object)null))
                {
                    Text component = (Text)this.TitleText.GetComponent <Text>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        string str = LocalizedText.Get("sys.TEXT_GACHA_HISTORY_FOOTER", (object)dataOfClass.GetDropAt().ToString("yyyy/MM/dd HH:mm:ss"), (object)dataOfClass.gachaTitle);
                        component.set_text(str);
                    }
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
        }