示例#1
0
 private void InvokeOnClickDelegate()
 {
     if (onClick != null && onClick.GetInvocationList().Length != 0)
     {
         onClick.Invoke();
     }
 }
示例#2
0
    public void ProcessClick(Vector3 clickPos)
    {
        if (OnClickEvent != null)
        {
            OnClickEvent(clickPos);
        }

        print(string.Format("GC: OnClickEvent triggered {0} event call(s)", OnClickEvent.GetInvocationList().Length));
    }
示例#3
0
 public void ClearClickEvent()
 {
     if (OnClickEvent != null)
     {
         Delegate[] invokeList = OnClickEvent.GetInvocationList();
         if (invokeList != null)
         {
             foreach (Delegate del in invokeList)
             {
                 OnClickEvent -= (OnClickDlg)del;
             }
         }
     }
 }
示例#4
0
        internal override void OnUpdate()
        {
            Vector2f mousePosition = Input.TackInput.MousePosition();

            if (mousePosition.X >= Bounds.X && mousePosition.X <= (Bounds.X + Bounds.Width))
            {
                if (mousePosition.Y >= Bounds.Y && mousePosition.Y <= (Bounds.Y + Bounds.Height))
                {
                    m_hovering = true;

                    if (TackInput.MouseButtonDown(MouseButtonKey.Left))
                    {
                        m_pressing = true;

                        if (OnClickEvent != null)
                        {
                            if (OnClickEvent.GetInvocationList().Length > 0)
                            {
                                OnClickEvent.Invoke(this, EventArgs.Empty);
                            }
                        }
                    }
                }
                else
                {
                    m_hovering = false;
                }
            }
            else
            {
                m_hovering = false;
            }

            if (TackInput.MouseButtonUp(MouseButtonKey.Left))
            {
                m_pressing = false;
            }
        }