示例#1
0
 public bool IsClicked()
 {
     if (InputManager.LeftButtonIsClicked())
     {
         if (!ButtonRectangle.Intersects(InputManager.MouseRectangle))
         {
             IsLocked = true;
         }
         else if (ButtonRectangle.Intersects(InputManager.MouseRectangle) && !IsOnHold && !IsLocked)
         {
             IsOnHold = true;
             return(false);
         }
     }
     else if (!InputManager.LeftButtonIsClicked())
     {
         IsLocked = false;
         if (!ButtonRectangle.Intersects(InputManager.MouseRectangle))
         {
             IsOnHold = false;
         }
         else if (IsOnHold && ButtonRectangle.Intersects(InputManager.MouseRectangle))
         {
             IsOnHold = false;
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        public virtual void Update(GameTime gameTime)
        {
            if (!ButtonRectangle.Intersects(InputManager.MouseRectangle))
            {
                IdleMouseOver = false;
            }
            else
            {
                IdleMouseOver = true;
            }

            UpdateTransparency(IsOnHold);

            if (IdleMouseOver || (OffSet != 0))
            {
                UpdateOffSet(gameTime.ElapsedGameTime.Milliseconds);
            }
        }