/********* ** Public methods *********/ public ModMinimap( Dictionary <string, NpcMarker> npcMarkers, Dictionary <string, bool> conditionalNpcs, Dictionary <long, FarmerMarker> farmerMarkers, Dictionary <string, KeyValuePair <string, Vector2> > farmBuildings, Texture2D buildingMarkers, ModCustomizations customizations ) { // renderTarget = new RenderTarget2D(Game1.graphics.GraphicsDevice,Game1.viewport.Width, Game1.viewport.Height); this.NpcMarkers = npcMarkers; this.ConditionalNpcs = conditionalNpcs; this.FarmerMarkers = farmerMarkers; this.FarmBuildings = farmBuildings; this.BuildingMarkers = buildingMarkers; this.Customizations = customizations; this.DrawPamHouseUpgrade = Game1.MasterPlayer.mailReceived.Contains("pamHouseUpgrade"); this.DrawMovieTheaterJoja = Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheaterJoja"); this.DrawMovieTheater = Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheater"); this.DrawIsland = Game1.MasterPlayer.hasOrWillReceiveMail("Visited_Island"); this.MmX = ModEntry.Globals.MinimapX; this.MmY = ModEntry.Globals.MinimapY; this.MmWidth = ModEntry.Globals.MinimapWidth * Game1.pixelZoom; this.MmHeight = ModEntry.Globals.MinimapHeight * Game1.pixelZoom; }
// Map menu that uses modified map page and modified component locations for hover public ModMapPage( Dictionary <string, NpcMarker> npcMarkers, Dictionary <string, bool> conditionalNpcs, Dictionary <long, FarmerMarker> farmerMarkers, Dictionary <string, KeyValuePair <string, Vector2> > farmBuildings, Texture2D buildingMarkers, ModCustomizations customizations, LocationUtil locationUtil ) : base(Game1.uiViewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2) { this.NpcMarkers = npcMarkers; this.ConditionalNpcs = conditionalNpcs; this.FarmerMarkers = farmerMarkers; this.FarmBuildings = farmBuildings; this.BuildingMarkers = buildingMarkers; this.Customizations = customizations; this.LocationUtil = locationUtil; Vector2 center = Utility.getTopLeftPositionForCenteringOnScreen(ModEntry.Map.Bounds.Width * 4, 720); this.DrawPamHouseUpgrade = Game1.MasterPlayer.mailReceived.Contains("pamHouseUpgrade"); this.DrawMovieTheaterJoja = Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheaterJoja"); this.DrawMovieTheater = Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheater"); this.DrawIsland = Game1.MasterPlayer.hasOrWillReceiveMail("Visited_Island"); this.MapX = (int)center.X; this.MapY = (int)center.Y; var regionRects = this.RegionRects().ToList(); for (int i = 0; i < regionRects.Count; i++) { var rect = regionRects.ElementAtOrDefault(i); string locationName = rect.Key; // Special cases where the name is not an in-game location locationName = locationName switch { "Spa" => "BathHouse_Entry", "SewerPipe" => "Sewer", _ => locationName }; var locVector = ModEntry.LocationToMap(locationName); this.points[i].bounds = new Rectangle( // Snaps the cursor to the center instead of bottom right (default) (int)(this.MapX + locVector.X - rect.Value.Width / 2), (int)(this.MapY + locVector.Y - rect.Value.Height / 2), rect.Value.Width, rect.Value.Height ); } var customTooltips = this.Customizations.Tooltips; foreach (var tooltip in customTooltips) { var vanillaTooltip = this.points.Find(x => x.name == tooltip.Key); string text = tooltip.Value.SecondaryText != null ? tooltip.Value.PrimaryText + Environment.NewLine + tooltip.Value.SecondaryText : tooltip.Value.PrimaryText; var customTooltip = new ClickableComponent( new Rectangle( this.MapX + tooltip.Value.X, this.MapY + tooltip.Value.Y, tooltip.Value.Width, tooltip.Value.Height ), text ); // Replace vanilla with custom if (vanillaTooltip != null) { vanillaTooltip = customTooltip; } else // If new custom location, add it { this.points.Add(customTooltip); } } // If two tooltip areas overlap, the one earlier in the list takes precedence // Reversing order allows custom tooltips to take precedence this.points.Reverse(); }