コード例 #1
0
 private void Button()
 {
     if (this._eDisplay == EDisplay.Button)
     {
         if (this._rect.Contains(Event.current.mousePosition))
         {
             if (Event.current.type == EventType.MouseDown)
             {
                 this._eMouse        = EMouse.Down;
                 this._mouseDownTime = Time.realtimeSinceStartup;
             }
             else if (Event.current.type == EventType.MouseUp)
             {
                 this._eMouse = EMouse.Up;
                 if ((Time.realtimeSinceStartup - this._mouseDownTime) < this._mouseClickTime)
                 {
                     this._eDisplay = EDisplay.Panel;
                 }
             }
         }
         if ((this._eMouse == EMouse.Down) && (Event.current.type == EventType.MouseDrag))
         {
             this._rect.x = Event.current.mousePosition.x - (this._rect.width / 2f);
             this._rect.y = Event.current.mousePosition.y - (this._rect.height / 2f);
         }
         GUI.Button(this._rect, "On", this.GetGUISkin(GUI.skin.button, Color.white, TextAnchor.MiddleCenter));
     }
 }
コード例 #2
0
ファイル: InterfaceCloser.cs プロジェクト: wangxingge/Eryan
        public override int run()
        {
            if (ESession.isSystemMenuOpen())
            {
                EKeyboard.sendChar((char)0x1B);
                Thread.Sleep(600);
            }

            InterfaceEntry ok     = ESession.getOkButton();
            InterfaceEntry cancel = ESession.getCancelButton();

            if (ok != null || cancel != null)
            {
                if (cancel != null)
                {
                    EMouse.move(new Point(ERandom.Next(cancel.X, cancel.X + cancel.Width), ERandom.Next(cancel.Y, cancel.Y + cancel.Height)));
                }
                else
                {
                    EMouse.move(new Point(ERandom.Next(ok.X, ok.X + ok.Width), ERandom.Next(ok.Y, ok.Y + ok.Height)));
                }

                EMouse.click(true);
                Thread.Sleep(500);
            }

            return(200);
        }
コード例 #3
0
 void Button()
 {
     if (_rect.Contains(Event.current.mousePosition))
     {
         if (Event.current.type == EventType.MouseDown)
         {
             _eMouse        = EMouse.Down;
             _mouseDownTime = Time.realtimeSinceStartup;
         }
         else if (Event.current.type == EventType.MouseUp)
         {
             _eMouse = EMouse.Up;
             if (Time.realtimeSinceStartup - _mouseDownTime < _mouseClickTime)//click
             {
                 _eDisplay = EDisplay.Panel;
             }
         }
     }
     if (_eMouse == EMouse.Down && Event.current.type == EventType.MouseDrag)
     {
         _rect.x = Event.current.mousePosition.x - _rect.width / 2f;
         _rect.y = Event.current.mousePosition.y - _rect.height / 2f;
     }
     GUI.Button(_rect, "On", GetGUISkin(GUI.skin.button, Color.white, TextAnchor.MiddleCenter));
 }
コード例 #4
0
ファイル: ViewRotary.cs プロジェクト: daviddw/Kinsky
        public override void MouseUp(NSEvent aEvent)
        {
            try
            {
                if (iEnabled)
                {
                    EMouse currMousePos = MouseLocation(aEvent.LocationInWindow);

                    switch (iMouseDown)
                    {
                    case EMouse.eCentre:
                        // click if the mouse is still in the centre
                        if (currMousePos == ViewRocker.EMouse.eCentre)
                        {
                            if (EventClicked != null)
                            {
                                EventClicked(this, EventArgs.Empty);
                            }
                        }
                        break;

                    case EMouse.eLeft:
                    case EMouse.eRight:
                        // signal that "rotating" has stopped or been cancelled
                        if (currMousePos != EMouse.eNot)
                        {
                            if (EventStop != null)
                            {
                                EventStop(this, EventArgs.Empty);
                            }
                        }
                        else
                        {
                            if (EventCancelled != null)
                            {
                                EventCancelled(this, EventArgs.Empty);
                            }
                        }
                        break;
                    }
                }
            }
            finally
            {
                // always update the mouse down state - this is **very** important that this is not inside
                // some sort of if statement - if there is a chance that this iMouseDown state does not get
                // set to eNot, then it might get stuck in, for example, eRight which, for volume control
                // might mean that the volume keeps increasing until maximum!!!!
                iMouseDown = EMouse.eNot;

                UpdateState();
            }
        }