示例#1
0
 public UIPanel GetUiPanel(BaseUi ui)
 {
     if (ui != null)
     {
         return(ui.GetComponent <UIPanel>());
     }
     return(null);
 }
示例#2
0
        private void AttachPointClick(BaseUi baseUI, PointerEventData eventData)
        {
            if (eventData.button == PointerEventData.InputButton.Right)
            {
                baseUI.GetComponent <Image>().sprite = Sys.Stable.ObjectPool.GetPrefab(null, BundleSys.UIBundle, "emptyUI").GetComponent <Image>().sprite;

                baseUI.RectTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, imageScale.x);
                baseUI.RectTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, imageScale.y);

                attachResult[attachPointInfo[selectedAttachPoint].index] = null;

                return;
            }
            else if (selectedAttachPoint == baseUI)
            {
                return;
            }

            listPlane.Clear();

            selectedAttachPoint = baseUI;
            Ship.AttachPoint        info   = attachPointInfo[baseUI];
            DataTable               select = Sys.Stable.DataBase["turret"].Select(new string[] { "name" }, new (string, object)[] { ("type", info.type) });
示例#3
0
    public BaseUi GetTopestShowingUi(Func <BaseUi, bool> addationCheckCondation = null)
    {
        BaseUi currentSelected = null;
        int    currentDepth    = 0;

        var enumerator = UiRelations.Instance.UiDic.GetEnumerator();

        do
        {
            var tmpUi = enumerator.Current.Value;
            if (tmpUi != null)
            {
                // 过滤不显示的ui
                if (!tmpUi.IsShowing)
                {
                    continue;
                }

                bool muchToper = false;
                if (currentSelected == null)
                {
                    muchToper = true;
                }
                else
                {
                    if (tmpUi.layer > currentSelected.layer)
                    {
                        muchToper = true;
                    }
                    else if (tmpUi.layer == currentSelected.layer)
                    {
                        var tmpPanel = tmpUi.GetComponent <UIPanel>();
                        if (tmpPanel != null)
                        {
                            muchToper = tmpPanel.depth > currentDepth;
                        }
                    }
                    else
                    {
                        muchToper = false;
                    }
                }

                // 自定义的额外过滤条件
                if (muchToper)
                {
                    if (addationCheckCondation != null && (!addationCheckCondation(tmpUi)))
                    {
                        muchToper = false;
                    }
                }

                if (muchToper)
                {
                    currentSelected = tmpUi;
                    var currentSelectedPanel = currentSelected.GetComponent <UIPanel>();
                    if (currentSelectedPanel != null)
                    {
                        currentDepth = currentSelectedPanel.depth;
                    }
                }
            }
        } while (enumerator.MoveNext());

        return(currentSelected);
    }