예제 #1
0
        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;
        }
예제 #2
0
        protected void ReleaseChildPopupList(UListComponentPopupBase _popupComponent)
        {
            //m_ActivePopupList.ForEach(DeactivateComponent);
            UListPopup releaseList = null;

            if (_popupComponent != null)
            {
                //有可能是二级菜单的组件
                releaseList = _popupComponent.ChildPopupList;
                if (releaseList == null)
                {
                    //0号是主列表
                    for (int i = 1; i < m_ActivePopupList.Count; ++i)
                    {
                        if (m_ActivePopupList[i].Contains(_popupComponent as UListComponentPopup))
                        {
                            releaseList = m_ActivePopupList[i];

                            releaseList.Clear();
                            if (!m_PopupListCache.Contains(releaseList))
                            {
                                m_PopupListCache.Add(releaseList);
                            }

                            m_ActivePopupList.RemoveAt(i);
                            return;
                        }
                    }
                    return;
                }
            }
            else
            {
                return;
            }



            if (!m_PopupListCache.Contains(_popupComponent.ChildPopupList))
            {
                m_PopupListCache.Add(_popupComponent.ChildPopupList);
            }
            if (m_ActivePopupList.Contains(_popupComponent.ChildPopupList))
            {
                m_ActivePopupList.Remove(_popupComponent.ChildPopupList);
            }

            _popupComponent.ChildPopupList.Clear();
            _popupComponent.ChildPopupList = null;
        }
예제 #3
0
 protected void OnPopupListComponentExitEvents(PointerEventData _eventData, UListComponentPopupBase _component)
 {
 }