protected void OnPopupListComponentEnterEvents(PointerEventData _eventData, UListComponentPopupBase _component) { //没有下级的就不管了 if (_component.ChildPopupList != null) { return; } if (_component.ItemData.ItemChildItems == null || _component.ItemData.ItemChildItems.Count <= 0) { return; } UListPopup childList = null; //判断当前是否已经显示超过两个列表,是则看最后一级列表能否复用 if (m_ActivePopupList.Count - 1 > 0) { childList = m_ActivePopupList[m_ActivePopupList.Count - 1]; //如果当前进入的对象在最后一级列表里,则不能复用 if (childList.Contains(_component as UListComponentPopup)) { childList = null; } else { //不在最后一级列表,则释放最后一级列表 ReleaseChildPopupList(childList.ParentConponent); //如果当前进入的对象属于主列表,则释放所有次级列表 if (m_ActivePopupList[0].Contains(_component as UListComponentPopup)) { for (int i = m_ActivePopupList.Count - 1; i > 0; --i) { ReleaseChildPopupList(m_ActivePopupList[i]); } } childList = null; } } //从回收的列表里取列表并赋值显示 if (childList == null) { childList = GetUnusePopupList(); } foreach (var action in _component.ItemData.ItemChildItems) { childList.Add(action as UListComponentItemDataPopup); } childList.UpdatePopup(new UPopupMenuUpdateParam(_tfTarget: _component.GetTransform, _camUI: UISystem.Instance.GetCamera(), _canvasRoot: UISystem.Instance.GetCanvas(), _eTipPostion: UIWidgets.TipPosition.TopRightCorner, _tfPopupView: this.GetTransform() )); _component.ChildPopupList = childList; childList.ParentConponent = _component as UListComponentPopup; }
public void ShowPopupMenu(UIPopupMenuData _actionData) { UListPopup popUpMenu = GetUnusePopupList(); foreach (var action in _actionData.actionPopup) { popUpMenu.Add(action.Value); } popUpMenu.UpdatePopup(new UPopupMenuUpdateParam(_tfTarget: _actionData.actionTarget, _camUI: UISystem.Instance.GetCamera(), _canvasRoot: UISystem.Instance.GetCanvas(), _eTipPostion: _actionData.actionTipPostion, _tfPopupView: this.GetTransform(), _bUseModal: true, _actionModalCilck: ReleaseAllPopupList )); }