Exemple #1
0
            public override void OnCursorMoved(StardewModdingAPI.Events.CursorMovedEventArgs e)
            {
                base.OnCursorMoved(e);

                if (!this.IsVisible)
                {
                    return;
                }

                var coords = new Point(Convert.ToInt32(e.NewPosition.ScreenPixels.X), Convert.ToInt32(e.NewPosition.ScreenPixels.Y));

                // check if within bounds
                if (!this.Bounds.Contains(coords))
                {
                    this.hoverText = "";
                    _liveDummyChest.playerChoiceColor.Value = _originalColour;
                    return;
                }

                var new_colour = this.GetColourAt(coords.X, coords.Y);

                // change dummy chest colour
                _liveDummyChest.playerChoiceColor.Value = new_colour;

                // set hover text
                this.hoverText = $"#{new_colour.R:X2}{new_colour.G:X2}{new_colour.B:X2} {new_colour.ToString()}";
            }
Exemple #2
0
 /// <summary>
 /// Event handler for checking if the button is being hovered over by the mouse cursor.
 /// </summary>
 /// <param name="sender">The object from which the event originated.</param>
 /// <param name="e">These are the arguments sent along with the event from SMAPI, used here to get cursor position.</param>
 private void Input_CursorMoved(object sender, StardewModdingAPI.Events.CursorMovedEventArgs e)
 {
     if (organiseButton.containsPoint((int)e.NewPosition.ScreenPixels.X, (int)e.NewPosition.ScreenPixels.Y))
     {
         hoverText = organiseButton.hoverText;
     }
     else
     {
         hoverText = "";
     }
     organiseButton.tryHover((int)e.NewPosition.ScreenPixels.X, (int)e.NewPosition.ScreenPixels.Y);
 }
Exemple #3
0
        /// <summary>
        /// Calls '<see cref="playObjectAnimation()"/>' if cursor has activity on this object, '<see cref="revertObjectAnimation()"/>' if not.
        /// </summary>
        public override void OnCursorMoved(StardewModdingAPI.Events.CursorMovedEventArgs e)
        {
            base.OnCursorMoved(e);

            if (this.cursorStatus != CursorStatus.None)
            {
                this.playObjectAnimation();
            }
            else
            {
                this.revertObjectAnimation();
            }
        }
Exemple #4
0
 private void Input_CursorMoved(object sender, StardewModdingAPI.Events.CursorMovedEventArgs e)
 {
     MouseScreenPosition = e.NewPosition.ScreenPixels.AsAndroidCompatibleCursorPoint();
     HoveredTile         = e.NewPosition.Tile;
 }