예제 #1
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);

            if (!IsSelected || !ShouldDraw)
            {
                return;
            }

            if (IsOnHomePage)
            {
                ClickableTextureComponent button = Heads.FirstOrDefault(head => head.containsPoint(x, y));
                if (button != null)
                {
                    SelectedChara = Game1.getCharacterFromName(name: button.name);
                }
            }
            else
            {
                if (GoToButton.containsPoint(x, y))
                {
                    if (SelectedChara.currentLocation.Name != Game1.currentLocation.Name)
                    {
                        // Cast view to characters in other locations
                        Desktop.ViewLocation(locationName: SelectedChara.currentLocation.Name, tileLocation: SelectedChara.getTileLocationPoint());
                    }
                    else
                    {
                        // Pan view to characters in this location
                        Game1.panScreen(
                            x: (SelectedChara.getTileX() * Game1.tileSize) - (Game1.viewport.Width / 2),
                            y: (SelectedChara.getTileY() * Game1.tileSize) - (Game1.viewport.Height / 2));
                    }
                }
                else if (OpenScheduleButton.containsPoint(x, y))
                {
                }
            }
        }
예제 #2
0
        public override void performHoverAction(int x, int y)
        {
            _hoverText = "";

            base.performHoverAction(x, y);

            if (!IsSelected || !ShouldDraw)
            {
                return;
            }

            if (IsOnHomePage)
            {
                if (Heads.FirstOrDefault(head => head.containsPoint(x, y)) is ClickableTextureComponent clickable && clickable != null)
                {
                    _hoverText = clickable.hoverText;
                }
            }
            else
            {
                GoToButton.tryHover(x, y, maxScaleIncrease: ActionButtonHoverScale);
                OpenScheduleButton.tryHover(x, y, maxScaleIncrease: ActionButtonHoverScale);
            }
        }