private void Refresh() { if (Object.op_Equality((Object)this.ItemTemplate, (Object)null) || Object.op_Equality((Object)this.ItemLayout, (Object)null)) { return; } for (int index = 0; index < this.Chapter.keys.Count; ++index) { KeyItem key = this.Chapter.keys[index]; if (key != null && !string.IsNullOrEmpty(key.iname) && key.num != 0) { ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(key.iname); ItemData itemDataByItemParam = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemParam(itemParam); GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate); DataSource.Bind <ChapterParam>(gameObject, this.Chapter); DataSource.Bind <ItemParam>(gameObject, itemParam); DataSource.Bind <ItemData>(gameObject, itemDataByItemParam); DataSource.Bind <KeyItem>(gameObject, key); KeyQuestBanner component = (KeyQuestBanner)gameObject.GetComponent <KeyQuestBanner>(); if (Object.op_Inequality((Object)component, (Object)null)) { component.UpdateValue(); } gameObject.get_transform().SetParent(this.ItemLayout.get_transform(), false); gameObject.SetActive(true); } } }
private void Refresh() { GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems); this.mItems.Clear(); GameManager instance = MonoSingleton <GameManager> .Instance; ChapterParam currentChapter; List <ChapterParam> availableChapters = this.GetAvailableChapters(instance.Chapters, instance.Player.AvailableQuests, Network.GetServerTime(), out currentChapter); this.mCurrentChapter = currentChapter; for (int index = 0; index < availableChapters.Count; ++index) { ChapterParam data = availableChapters[index]; if (!string.IsNullOrEmpty(data.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(data.prefabPath); ListItemEvents listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null)) { ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1); foreach (ButtonEvent componentsInChild in (ButtonEvent[])((Component)listItemEvents2).GetComponentsInChildren <ButtonEvent>(true)) { componentsInChild.syncEvent = this.ChapterScrollRect; } DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data); if (data.quests != null && data.quests.Count > 0) { DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), data.quests[0]); } KeyQuestBanner component = (KeyQuestBanner)((Component)listItemEvents2).get_gameObject().GetComponent <KeyQuestBanner>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { component.UpdateValue(); } ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnItemSelect); listItemEvents2.OnOpenDetail = new ListItemEvents.ListItemEvent(this.OnOpenItemDetail); listItemEvents2.OnCloseDetail = new ListItemEvents.ListItemEvent(this.OnCloseItemDetail); this.mItems.Add(listItemEvents2); } } } for (int index = 0; index < this.mItems.Count; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mItems[index], (UnityEngine.Object)null)) { ((Component)this.mItems[index]).get_gameObject().get_transform().SetSiblingIndex(index); } } this.ResetScroll(); }
private void Refresh(EventQuestList.EventQuestTypes type) { GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems); this.mItems.Clear(); GameManager instance = MonoSingleton <GameManager> .Instance; ChapterParam[] chapters = instance.Chapters; QuestParam[] availableQuests = instance.Player.AvailableQuests; long serverTime = Network.GetServerTime(); ChapterParam currentChapter = (ChapterParam)null; List <ChapterParam> availableChapters = this.GetAvailableChapters(type, chapters, availableQuests, (string)GlobalVars.SelectedSection, (string)GlobalVars.SelectedChapter, serverTime, out currentChapter); if (type == EventQuestList.EventQuestTypes.Normal) { SubQuestTypes mTabIndex = (SubQuestTypes)this.mTabIndex; for (int index = 0; index < availableChapters.Count; ++index) { if (availableChapters[index].GetSubQuestType() != mTabIndex) { availableChapters.RemoveAt(index--); } } } if (this.Descending) { availableChapters.Reverse(); } if (type == EventQuestList.EventQuestTypes.Tower && string.IsNullOrEmpty(GlobalVars.SelectedChapter.Get())) { List <TowerParam> towerParamList = new List <TowerParam>(); for (int index1 = 0; index1 < instance.Towers.Length; ++index1) { TowerParam tower = instance.Towers[index1]; for (int index2 = 0; index2 < availableQuests.Length; ++index2) { if (availableQuests[index2].type == QuestTypes.Tower && !(availableQuests[index2].iname != tower.iname) && availableQuests[index2].IsDateUnlock(serverTime)) { towerParamList.Add(tower); break; } } } for (int index = 0; index < towerParamList.Count; ++index) { TowerParam data = towerParamList[index]; ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>(); if (!string.IsNullOrEmpty(data.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(data.prefabPath); listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); } if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null)) { QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname); ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1); DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data); DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest); ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect); this.mItems.Add(listItemEvents2); } } for (int index = 0; index < availableQuests.Length; ++index) { if (availableQuests[index].IsMultiTower && availableQuests[index].IsDateUnlock(serverTime)) { ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>(); ChapterParam chapter = availableQuests[index].Chapter; if (chapter != null) { if (!string.IsNullOrEmpty(chapter.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(chapter.prefabPath); listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); } if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null)) { ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1); DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), availableQuests[index]); ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnMultiTowerSelect); this.mItems.Add(listItemEvents2); } } } } } for (int index = 0; index < availableChapters.Count; ++index) { ChapterParam data = availableChapters[index]; ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>(); if (!string.IsNullOrEmpty(data.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(data.prefabPath); listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); } if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null)) { ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1); DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data); DataSource.Bind <KeyItem>(((Component)listItemEvents2).get_gameObject(), data == null || data.keys.Count <= 0 ? (KeyItem)null : data.keys[0]); KeyQuestBanner component = (KeyQuestBanner)((Component)listItemEvents2).get_gameObject().GetComponent <KeyQuestBanner>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { component.UpdateValue(); } ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect); this.mItems.Add(listItemEvents2); } } this.StableSort <ListItemEvents>(this.mItems, (Comparison <ListItemEvents>)((p1, p2) => { ChapterParam chapterParam1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object)p1, (UnityEngine.Object)null) ? (ChapterParam)null : p1.Chapter; ChapterParam chapterParam2 = !UnityEngine.Object.op_Inequality((UnityEngine.Object)p2, (UnityEngine.Object)null) ? (ChapterParam)null : p2.Chapter; return((chapterParam1 == null ? 1 : (!chapterParam1.IsGpsQuest() ? 1 : 0)).CompareTo(chapterParam2 == null ? 1 : (!chapterParam2.IsGpsQuest() ? 1 : 0))); })); for (int index = 0; index < this.mItems.Count; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mItems[index], (UnityEngine.Object)null)) { ((Component)this.mItems[index]).get_gameObject().get_transform().SetSiblingIndex(index); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BackButton, (UnityEngine.Object)null)) { if (currentChapter != null) { this.BackButton.SetActive(true); } else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection)) { this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection)); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Caution, (UnityEngine.Object)null)) { this.Caution.SetActive(availableChapters.Count == 0 && type != EventQuestList.EventQuestTypes.Tower); } this.RefreshSwitchButton(type); if (type == EventQuestList.EventQuestTypes.Normal) { this.EnableTab(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestTypeTextFrame, (UnityEngine.Object)null)) { this.QuestTypeTextFrame.SetActive(false); } this.SetToggleIsOn(); } else { this.DisableTab(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestTypeTextFrame, (UnityEngine.Object)null)) { this.QuestTypeTextFrame.SetActive(true); } this.RefreshQuestTypeText(type); } this.ResetScroll(); FlowNode_GameObject.ActivateOutputLinks((Component)this, 50); }
private void Refresh(EventQuestList.EventQuestTypes type) { GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems); GameManager instance = MonoSingleton <GameManager> .Instance; ChapterParam[] chapters = instance.Chapters; List <ChapterParam> chapterParamList = new List <ChapterParam>((IEnumerable <ChapterParam>)chapters); QuestParam[] availableQuests = instance.Player.AvailableQuests; long serverTime = Network.GetServerTime(); ChapterParam chapterParam = (ChapterParam)null; for (int index = chapterParamList.Count - 1; index >= 0; --index) { if ((string)GlobalVars.SelectedSection != chapterParamList[index].section) { chapterParamList.RemoveAt(index); } } if (!string.IsNullOrEmpty((string)GlobalVars.SelectedChapter)) { chapterParam = instance.FindArea((string)GlobalVars.SelectedChapter); for (int index = chapterParamList.Count - 1; index >= 0; --index) { if (chapterParamList[index].parent == null || chapterParamList[index].parent.iname != (string)GlobalVars.SelectedChapter) { chapterParamList.RemoveAt(index); } } } else { for (int index = chapterParamList.Count - 1; index >= 0; --index) { if (chapterParamList[index].parent != null) { chapterParamList.RemoveAt(index); } } } switch (type) { case EventQuestList.EventQuestTypes.Normal: for (int index = 0; index < chapterParamList.Count; ++index) { if (chapterParamList[index].IsKeyQuest()) { chapterParamList.RemoveAt(index--); } } break; case EventQuestList.EventQuestTypes.Key: for (int index = 0; index < chapterParamList.Count; ++index) { if (!chapterParamList[index].IsKeyQuest()) { chapterParamList.RemoveAt(index--); } } break; } for (int index = chapterParamList.Count - 1; index >= 0; --index) { if (!this.ChapterContainsPlayableQuest(chapterParamList[index], chapters, availableQuests, serverTime)) { chapterParamList.RemoveAt(index); } } if (this.Descending) { chapterParamList.Reverse(); } if (type == EventQuestList.EventQuestTypes.Normal && string.IsNullOrEmpty(GlobalVars.SelectedChapter.Get())) { List <TowerParam> towerParamList = new List <TowerParam>(); for (int index1 = 0; index1 < instance.Towers.Length; ++index1) { TowerParam tower = instance.Towers[index1]; for (int index2 = 0; index2 < availableQuests.Length; ++index2) { if (availableQuests[index2].type == QuestTypes.Tower && !(availableQuests[index2].iname != tower.iname) && availableQuests[index2].IsDateUnlock(serverTime)) { towerParamList.Add(tower); break; } } } for (int index = 0; index < towerParamList.Count; ++index) { TowerParam data = towerParamList[index]; ListItemEvents listItemEvents1 = !Object.op_Inequality((Object)this.ItemTemplate, (Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>(); if (!string.IsNullOrEmpty(data.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(data.prefabPath); listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); } if (!Object.op_Equality((Object)listItemEvents1, (Object)null)) { QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname); ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1); DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data); DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest); ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect); this.mItems.Add(listItemEvents2); } } } for (int index = 0; index < chapterParamList.Count; ++index) { ChapterParam data = chapterParamList[index]; ListItemEvents listItemEvents1 = !Object.op_Inequality((Object)this.ItemTemplate, (Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>(); if (!string.IsNullOrEmpty(data.prefabPath)) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("QuestChapters/"); stringBuilder.Append(data.prefabPath); listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString()); } if (!Object.op_Equality((Object)listItemEvents1, (Object)null)) { ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1); DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data); DataSource.Bind <KeyItem>(((Component)listItemEvents2).get_gameObject(), data == null || data.keys.Count <= 0 ? (KeyItem)null : data.keys[0]); KeyQuestBanner component = (KeyQuestBanner)((Component)listItemEvents2).get_gameObject().GetComponent <KeyQuestBanner>(); if (Object.op_Inequality((Object)component, (Object)null)) { component.UpdateValue(); } ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false); ((Component)listItemEvents2).get_gameObject().SetActive(true); listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect); this.mItems.Add(listItemEvents2); } } if (Object.op_Inequality((Object)this.BackButton, (Object)null)) { if (chapterParam != null) { this.BackButton.SetActive(true); } else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection)) { this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection)); } } if (Object.op_Inequality((Object)this.Caution, (Object)null)) { this.Caution.SetActive(chapterParamList.Count == 0); } this.RefreshSwitchButton(type); this.RefreshQuestTypeText(type); this.ResetScroll(); FlowNode_GameObject.ActivateOutputLinks((Component)this, 50); }