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); }
/// <summary> /// 设置空白区域点击处理器 /// </summary> /// <param name="clickHandler"></param> public void SetRootButtonHandler(IYuLegoActionHandler clickHandler) { if (rootButton == null) { return; } rootButton.gameObject.SetActive(true); rootButton.RegisterHandler(LegoInteractableType.OnPointerClick, clickHandler); }