void InitAllQuestItems() { foreach (var kv in QuestManager.Instance.allQuests) { if (showAvailableList) { if (kv.Value.Info != null) { continue; } } else { if (kv.Value.Info == null) { continue; } } GameObject go = Instantiate(itemPrefab, kv.Value.Define.Type == QuestType.Main ? listMain.transform : listBranch.transform); UIQuestItem ui = go.GetComponent <UIQuestItem>(); ui.SetQuestInfo(kv.Value); if (kv.Value.Define.Type == QuestType.Main) { this.listMain.AddItem(ui); } else { this.listBranch.AddItem(ui); } } }
public void OnQuestSelected(ListView.ListViewItem item) { SelectedItem = item; UIQuestItem questItem = item as UIQuestItem; this.questInfo.SetQuestInfo(questItem.quest); }
public void SetFocusItem(UIQuestItem item) { if (item != _selectedItem) { if (_selectedItem != null) { _selectedItem.OnLoseFocus(); } _selectedItem = item; _selectedItem.OnSetFocus(); this.DisplayQuest(_selectedItem.questProgress); } }
private void AddQuestItem(QuestProgress qp, UIQuest uiQuest) { GameObject go = GameObject.Instantiate(questItemPrefab) as GameObject; go.transform.parent = gridGO.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; UIQuestItem item = go.GetComponent <UIQuestItem>(); item.Init(qp, uiQuest); _itemList.Add(item); }
private void ClearItems() { List <GameObject> goList = new List <GameObject>(); foreach (Transform t in _grid.transform) { goList.Add(t.gameObject); } foreach (GameObject go in goList) { Destroy(go); } _itemList.Clear(); _selectedItem = null; }
private void OnQuestSelected(ListView.ListViewItem item) { UIQuestItem questItem = item as UIQuestItem; this.questInfo.SetQuestInfo(questItem.quest); if (item.owner == listMain) { if (listBranch.SelectedItem != null) { //listBranch.SelectedItem.GetComponent<Image>().overrideSprite = (listBranch.SelectedItem as UIQuestItem).normalBg; listBranch.SelectedItem = null; } } else { if (listMain.SelectedItem != null) { //listMain.SelectedItem.GetComponent<Image>().overrideSprite = (listMain.SelectedItem as UIQuestItem).normalBg; listMain.SelectedItem = null; } } }
/// <summary> /// 初始化任务列表 /// </summary> void InitAllQuestList() { foreach (var item in QuestManager.Instance.allQuests) { if (showAvailableList) //显示可接任务 { if (item.Value.Info != null) //过滤已接任务 { continue; } } else //显示已接任务 { if (item.Value.Info == null) //过滤未接任务 { continue; } if (item.Value.Info.Status == QuestStatus.Finished) { continue; } } GameObject go = Instantiate(itemPrefab, item.Value.Define.Type == QuestType.Main ? this.listMain.transform : this.listBranch.transform); UIQuestItem ui = go.GetComponent <UIQuestItem>(); ui.SetQuestInfo(item.Value); if (item.Value.Define.Type == QuestType.Main) { this.listMain.AddItem(ui as ListView.ListViewItem); } else { this.listBranch.AddItem(ui as ListView.ListViewItem); } } }
private void OnQuestSelected(ListView.ListViewItem item) { UIQuestItem questItem = item as UIQuestItem; this.questInfo.SetQuestInfo(questItem.quest); }
private void OnQuestSelected(ListView.ListViewItem item) { UIQuestItem qustItem = item as UIQuestItem; }
public void RepositionItems(UIQuestItem changeItem) { _grid.Reposition(); //do it right now }