예제 #1
0
        public override void update(GameTime time)
        {
            this.UpdateAnimationTimer(time);
            //this.UpdateHoldToDragTimer(time);

            bool wasRightDown = this.WasRightDown;
            bool isRightDown  = helper.Input.IsDown(SButton.MouseRight);

            this.WasRightDown = isRightDown;

            if (ShouldDragIcon(wasRightDown, isRightDown))
            {
                IsBeingDragged = true;

                this.xPositionOnScreen = Game1.getMouseX() - (int)iconPositionOffset.X;
                this.yPositionOnScreen = Game1.getMouseY() - (int)iconPositionOffset.Y;


                iconPositionOffset = new Vector2(Game1.getMouseX() - this.EmoteMenuButtonComponent.bounds.X, Game1.getMouseY() - this.EmoteMenuButtonComponent.bounds.Y);

                //Dont let the mouse grab the air, and set to grab at least the border
                //Horizontal position
                if (iconPositionOffset.X < 0)
                {
                    iconPositionOffset.X = 0;
                }
                else if (iconPositionOffset.X >= EmoteMenuButtonComponent.bounds.Width)
                {
                    iconPositionOffset.X = EmoteMenuButtonComponent.bounds.Width - 1;
                }

                //Vertical position
                if (iconPositionOffset.Y < 0)
                {
                    iconPositionOffset.Y = 0;
                }
                else if (iconPositionOffset.Y >= EmoteMenuButtonComponent.bounds.Height)
                {
                    iconPositionOffset.Y = EmoteMenuButtonComponent.bounds.Height - 1;
                }
            }
            else
            {
                IsBeingDragged = false;
            }

            if ((playAnimation && AnimatedEmoteIcon) /*|| (isHovering && AnimationOnHover)*/)
            {
                if (IsPlayingAnimation())
                {
                    AnimatedSpriteIcon.update(time);
                }
                else
                {
                    playAnimation = false;
                    AnimatedSpriteIcon.reset();
                }
            }
        }
예제 #2
0
        public override void update(GameTime time)
        {
            this.UpdateAnimationTimer(time);
            //this.UpdateHoldToDragTimer(time);

            if (ShouldDragIcon())
            {
                IsBeingDragged = true;

                this.targetRect.X = Game1.getMouseX() - (int)iconPositionOffset.X;
                this.targetRect.Y = Game1.getMouseY() - (int)iconPositionOffset.Y;


                iconPositionOffset = new Vector2(Game1.getMouseX() - this.emoteMenuIcon.bounds.X, Game1.getMouseY() - this.emoteMenuIcon.bounds.Y);

                //Dont let the mouse grab the air, and set to grab at least the border
                //Horizontal position
                if (iconPositionOffset.X < 0)
                {
                    iconPositionOffset.X = 0;
                }
                else if (iconPositionOffset.X >= emoteMenuIcon.bounds.Width)
                {
                    iconPositionOffset.X = emoteMenuIcon.bounds.Width - 1;
                }

                //Vertical position
                if (iconPositionOffset.Y < 0)
                {
                    iconPositionOffset.Y = 0;
                }
                else if (iconPositionOffset.Y >= emoteMenuIcon.bounds.Height)
                {
                    iconPositionOffset.Y = emoteMenuIcon.bounds.Height - 1;
                }
            }
            else
            {
                IsBeingDragged = false;
            }

            if ((playAnimation && AnimatedEmoteIcon) /*|| (isHovering && AnimationOnHover)*/)
            {
                if (IsPlayingAnimation())
                {
                    iconAnimation.update(time);
                }
                else
                {
                    playAnimation = false;
                    iconAnimation.reset();
                }
            }
        }
예제 #3
0
 public void tryHoverAction(int x, int y)
 {
     if (bounds.Contains(x, y) && !complete)
     {
         sprite.paused            = false;
         JunimoNoteMenu.hoverText = Game1.content.LoadString("Strings\\UI:JunimoNote_BundleName", label);
     }
     else if (!complete)
     {
         sprite.reset();
         sprite.sourceRect.X += sprite.sourceRect.Width;
         sprite.paused        = true;
     }
 }