void SetMenuListItemContent(int index, GameObject go) { UICompoundWndListItem item = go.GetComponent <UICompoundWndListItem>(); if (item == null) { return; } if (index < 0 || index >= m_ItemDataList.Count) { return; } ItemProto data = m_ItemDataList[index]; if (!this.m_Formulas.ContainsKey(data.id)) { return; } //lz-2016.08.08 有任何可以合成这个Item的新脚本就标记为new bool newFlag = this.m_Formulas[data.id].Any(a => a.flag == true); item.SetItem(data.name, data.id, newFlag, data.icon, data.GetName(), index, ListItemType.mItem); item.SetSelectmState(false); item.mItemClick -= OnMenuListItemClick; item.mItemClick += OnMenuListItemClick; }
private void ListItemOnClick(int index) { if (IsCompounding) { return; } if (index < 0 || index >= m_ItemDataList.Count) { return; } List <GameObject> items = m_LeftList.Gos; if (mListSelectedIndex != -1 && mListSelectedIndex < items.Count) { UICompoundWndListItem item = items[mListSelectedIndex].GetComponent <UICompoundWndListItem>(); item.SetSelectmState(false); } if (index < items.Count) { UICompoundWndListItem item = items[index].GetComponent <UICompoundWndListItem>(); item.SetSelectmState(true); } mListSelectedIndex = index; this.UpdateCurItemScriptList(this.m_ItemDataList[index].id); this.SelectFirstScritItem(); }
void OnMenuListItemClick(int index) { if (index < 0 || index >= m_ItemDataList.Count) { return; } List <GameObject> items = FactoryReplicator.m_MenuContent.gridList.Gos; if (mListSelectedIndex != -1 && mListSelectedIndex < items.Count) { UICompoundWndListItem item = items[mListSelectedIndex].GetComponent <UICompoundWndListItem>(); item.SetSelectmState(false); } if (index < items.Count) { UICompoundWndListItem item = items[index].GetComponent <UICompoundWndListItem>(); item.SetSelectmState(true); } mListSelectedIndex = index; this.UpdateCurItemScriptList(this.m_ItemDataList[index].id); this.SelectFirstScritItem(); }