예제 #1
0
        /// <summary>
        /// OnInitialized 方法
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (Size == Size.None)
            {
                Size = Size.ExtraSmall;
            }

            var onClick = OnClick;

            OnClick = EventCallback.Factory.Create <MouseEventArgs>(this, async e =>
            {
                if (!IsDisabled)
                {
                    if (onClick.HasDelegate)
                    {
                        await onClick.InvokeAsync(e);
                    }

                    if (Item != null && OnClickCallback != null)
                    {
                        await OnClickCallback.Invoke(Item);
                    }
                    if (Item != null && OnClickWithoutRenderCallback != null)
                    {
                        await OnClickWithoutRenderCallback.Invoke(Item);
                    }
                }
            });
        }
예제 #2
0
        public void OnToggle_Button(bool isOn)
        {
            if (!isOn)
            {
                return;
            }

            m_OnClickCB?.Invoke(m_Data);
        }
예제 #3
0
 public override void Click(Point point)
 {
     if (rect.Contains(point))
     {
         if (OnClickCallback != null)
         {
             OnClickCallback.Invoke();
         }
     }
 }
예제 #4
0
    protected override void OnAwake()
    {
        base.OnAwake();

        this.transform.SetActive(false);

        if (ok.Text != null)
        {
            ok.Text.text = "OK";
        }

        if (cancel.Text != null)
        {
            cancel.Text.text = "Cancel";
        }


        if (ok.Button != null)
        {
            ok.Button.onClick.RemoveAllListeners();
            ok.Button.onClick.AddListener(() =>
            {
                if (OnClickCallback != null)
                {
                    OnClickCallback.Invoke(ok.Id);
                }
            });
        }

        if (cancel.Button != null)
        {
            cancel.Button.onClick.RemoveAllListeners();
            cancel.Button.onClick.AddListener(() =>
            {
                if (OnClickCallback != null)
                {
                    OnClickCallback.Invoke(cancel.Id);
                }
            });
        }
    }
예제 #5
0
        /// <summary>
        /// OnInitialized 方法
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (Size == Size.None)
            {
                Size = Size.ExtraSmall;
            }

            OnClickButton = EventCallback.Factory.Create <MouseEventArgs>(this, async e =>
            {
                if (IsAsync)
                {
                    ButtonIcon = LoadingIcon;
                    IsDisabled = true;
                }
                if (OnClickWithoutRender != null)
                {
                    await OnClickWithoutRender.Invoke();
                }
                if (OnClick.HasDelegate)
                {
                    await OnClick.InvokeAsync(e);
                }
                if (Item != null && OnClickWithoutRenderCallback != null)
                {
                    await OnClickWithoutRenderCallback.Invoke(Item);
                }
                if (Item != null && OnClickCallback != null)
                {
                    await OnClickCallback.Invoke(Item);
                }
                if (IsAsync)
                {
                    ButtonIcon = Icon;
                    IsDisabled = false;
                }
            });
        }
 public void ButtonClicked()
 {
     onClickCallback?.Invoke();
     baseGameObject.gameObject.SetActive(false);
     Destroy(this);
 }