コード例 #1
0
        private void TryAddRootButton()
        {
            if (rootButton != null)
            {
                return;
            }

            rootButton = UIRect.Find("Button_Root")?.GetComponent <YuLegoButton>();
            if (rootButton == null)
            {
                return;
            }

            rootButton.gameObject.layer = UIRect.gameObject.layer;

            if (!selfMeta.IsBlankClose)
            {
                rootButton.gameObject.SetActive(false);
                return;
            }

            rootButton.Construct(this);
            //            defaultRootClickHandler.OperateUi = this;
            rootButton.RegisterHandler(LegoInteractableType.OnPointerClick, defaultRootClickHandler);
            rootButton.SonText.gameObject.SetActive(false);
        }
コード例 #2
0
        public RectTransform GetContainer(string id)
        {
            if (containers.ContainsKey(id))
            {
                return(containers[id]);
            }

            var targetRect = UIRect.Find(id)?.GetComponent <RectTransform>();

            if (targetRect != null)
            {
                containers.Add(id, targetRect);
                return(targetRect);
            }

            throw new Exception($"容器{id}在目标UI物体{Id}下无法找到!");
        }