public void OnSelect(ILoopSelectStyle loopSelectStyle) //选中 { if (m_SelecteStyle != null) { m_SelecteStyle.CancelStyle(); } var loopItem = loopSelectStyle.loopItem; m_SelecteStyle = loopSelectStyle; m_LastSelectedIndex = m_SelectedIndex; m_SelectedIndex = loopItem.index; loopSelectStyle.SelectedStyle(); if (onSelected != null) { onSelected(this.parameter, loopItem.item, m_SelectedIndex, m_LastSelectedIndex); } object para = null; if (itemParameter == null) { para = loopItem.item; } else { para = itemParameter; } if (itemCommand != null && itemCommand.CanExecute(para)) { itemCommand.Execute(para); } }
protected override void OnDestroy() { onDragChanged.RemoveListener(OnDraging); onEndDragChanged.RemoveListener(OnEndDrag); onItemRender = null; onDropped = null; onInstantiated = null; content = null; itemCommand = null; droppedCommand = null; m_SelecteStyle = null; for (int i = 0; i < m_Templates.Length; i++) { m_Pool.Clear(i); } m_Pool = null; foreach (var loopItem in m_Pages) { if (loopItem.item != null) { GameObject.Destroy(loopItem.item.gameObject); } loopItem.item = null; } base.OnDestroy(); }
protected bool InitItemStyle(LoopItem loopItem) { var loopItemSelect = loopItem.item.GetComponent <ILoopSelectStyle>(); if (loopItemSelect != null) { loopItemSelect.InitSytle(loopItem, this); if (m_SelectedIndex == loopItem.index) { m_SelecteStyle = loopItemSelect; // m_SelecteStyle.SelectedStyle(); return(true); } } return(false); }
protected void OnDestory() { onItemRender = null; onInstantiated = null; content = null; m_SelecteStyle = null; foreach (var loopItem in m_Pages) { if (loopItem.item != null) { GameObject.Destroy(loopItem.item.gameObject); } loopItem.item = null; } }
public void OnSelect(ILoopSelectStyle loopSelectStyle) //选中 { if (m_SelecteStyle != null) { m_SelecteStyle.CancelStyle(); } var loopItem = loopSelectStyle.loopItem; m_SelecteStyle = loopSelectStyle; loopSelectStyle.SelectedStyle(); int lastIdx = m_SelectedIndex; m_SelectedIndex = loopItem.index; if (onSelected != null) { onSelected(this.parameter, loopItem.item, loopItem.index, lastIdx); } if (itemCommand != null && itemCommand.CanExecute(new int[] { loopItem.index, lastIdx })) { itemCommand.Execute(new int[] { loopItem.index, lastIdx }); } }