Exemple #1
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_GachaHistory> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaHistory> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         GachaHistoryWindow component = (GachaHistoryWindow)((Component)this).GetComponent <GachaHistoryWindow>();
         if (Object.op_Inequality((Object)component, (Object)null))
         {
             component.SetGachaHistoryData(jsonObject.body.log);
         }
         this.Success();
     }
 }
Exemple #2
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());
            }
        }