protected void OnComponentClick(UWarGoodsStoreDispositionItemComponent _component) { Vector3 newVec3 = CurrentArrow.rectTransform.anchoredPosition; newVec3.y = _component.GetRectTransform.anchoredPosition.y - _component.GetRectTransform.sizeDelta.y / 2; CurrentArrow.rectTransform.anchoredPosition = newVec3; OnSelect.Invoke(_component.Index, _component); }
protected void OnDispositionSelect(int _index, UWarGoodsStoreDispositionItemComponent _component) { if (DispositionListView.DataSource != null) { if (DispositionListView.DataSource[_index].DispositionID == 0) { WarMobaGoodsDataManager.Instance.HeroCurrentGoodsDisposition = WarMobaGoodsDataManager.Instance.HeroDefaultGoodsDisposition; } else { WarMobaGoodsDataManager.Instance.HeroCurrentGoodsDisposition = DispositionListView.DataSource[_index].DispositionGoods; } //ToggleListView.isOn = false; UISystem.Instance.SendTargetWndMessage(WndID.WND_ID_WAR_GOODSSTORE, WndMsgID.WND_MSG_WAR_GOODSSTORE_CHANGEGOODSDISPOSITION, null); UWGS_SelectedGoodsDispositionMsgData msgData = new UWGS_SelectedGoodsDispositionMsgData(); msgData.SelectedDisposition = DispositionListView.DataSource[_index]; UISystem.Instance.SendTargetWndMessage(WndID.WND_ID_WAR_GOODSSTORE, WndMsgID.WND_MSG_WAR_GOODSSTORE_SET_SELECTEDRECOMMENDDISPOSITION, msgData); } }
protected void SetNewData(List <UWarGoodsStoreDispositionItem> _newData) { m_nDataSource = _newData; if (m_nComponentList != null && m_nComponentList.Count > 0) { for (int i = m_nComponentList.Count - 1; i >= 0; i--) { UWarGoodsStoreDispositionItemComponent component = m_nComponentList[i]; component.onClick.RemoveAllListeners(); ResNode.DestroyRes(ref component); m_nComponentList.RemoveAt(i); } m_nComponentList.Clear(); } else if (m_nComponentList == null) { m_nComponentList = new List <UWarGoodsStoreDispositionItemComponent>(); } //实例化显示对象并初始化数据 DefaultComponent.gameObject.SetActive(true); UWarGoodsStoreDispositionItemComponent newComponent = null; for (int i = 0; i < m_nDataSource.Count; ++i) { newComponent = ResNode.InstantiateRes <UWarGoodsStoreDispositionItemComponent>(DefaultComponent.gameObject, true); newComponent.GetTransform.SetParent(DefaultComponent.GetTransform.parent, false); newComponent.Index = i; newComponent.SetData(m_nDataSource[i]); newComponent.onClick.AddListener(OnComponentClick); m_nComponentList.Add(newComponent); } DefaultComponent.gameObject.SetActive(false); }