예제 #1
0
        public virtual void HandleEvent()
        {
            if (WindowIn == null)
            {
                throw new Exception("控件" + Name + "没有挂载Window");
            }
            foreach (var evt in WindowIn.EventQueue.ToArray())
            {
                if (evt.Sender.Id == Id)
                {
                    switch (evt.Type)
                    {
                    case EventType.OnMouseDown:
                        EventTool.InvokeEvent(OnMouseDown, this, new EventArgs());
                        break;

                    case EventType.OnMouseClick:
                        EventTool.InvokeEvent(OnMouseClick, this, new EventArgs());
                        break;

                    case EventType.OnMouseUp:
                        EventTool.InvokeEvent(OnMouseUp, this, new EventArgs());
                        break;

                    case EventType.OnMouseDrag:
                        EventTool.InvokeEvent(OnMouseDrag, this, new MouseDragEventArgs(UnityEngine.Event.current.mousePosition));
                        break;
                    }
                }
            }
        }
예제 #2
0
 public override void HandleEvent()
 {
     //foreach (var evt in EventQueue.ToArray())
     //{
     //    if (evt.Type == EventType.Repaint)
     //    {
     //        EventTool.InvokeEvent(OnRepaint, this, new EventArgs());
     //    }
     //}
     //Debug.Log("window Handle Event");
     //Debug.Log("repaintFlag is " + repaintFlag);
     if (repaintFlag)
     {
         EventTool.InvokeEvent(OnRepaint, this, new EventArgs());
     }
 }