public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);

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

            if (FloatingActionButtons.Any())
            {
                if (ViewLocationButton.containsPoint(x, y))
                {
                    // TODO: MapViewMenu.ViewLocationButton
                }
                if (ReturnViewLocationButton.containsPoint(x, y))
                {
                    Desktop.ReturnFromViewLocation();
                }
            }

            foreach (ClickableComponent point in MapLocations.ToList())
            {
                if (point.containsPoint(x, y))
                {
                    // Clicking on map regions will cast the view to that location
                    int warpX = 0, warpY = 0;
                    Utility.getDefaultWarpLocation(point.name, ref warpX, ref warpY);
                    Desktop.ViewLocation(point.name, new Point(warpX, warpY));
                }
            }
        }
Exemplo n.º 2
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))
                {
                }
            }
        }