public FantasyBoardGame() { content = Game1.content.CreateTemporary(); slides = content.Load <Texture2D>("LooseSprites\\boardGame"); border = content.Load <Texture2D>("LooseSprites\\boardGameBorder"); Game1.globalFadeToClear(); }
/// <summary> /// Private internal function for parsing vanilla data from the game's content files. /// </summary> /// <remarks> /// This is one of the hackiest methods in the entire project - it's meant to, ostenisbly, parse vanilla data. /// Since we're trying to fit as much data as we can with has little outside intervention as possible, /// we're forced to jump through a few hoops to interpret the data in a way that meshes with our /// system in a sensible way. /// </remarks> private void VanillaRegistration() { var objectInfo = _content.Load <Dictionary <int, string> >("Data\\ObjectInformation"); foreach (var i in objectInfo.Keys) { var item = Item.ParseFromString(objectInfo[i]); if (item.IsError()) { GemfruitMod.Logger.Log(LogLevel.Error, "ItemRegistry", item.UnwrapError().Message); } else { var val = item.Unwrap(); val.AssignSpriteSheetReference(new ResourceKey("Maps\\springobjects"), VanillaSpritesheetHelper.ItemIdToRectangle(i)); val.Key = VanillaResourceKeyTransformers.ApplyTransformerForKey(val, i, new ResourceKey(StringUtility.SanitizeName(val.Name))); if (_dictionary.ContainsKey(val.Key)) { val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i); } // If the item is presumably an artifact we're forced to perform some extra parsing on it. if (val.Type.Contains("Arch")) { GemfruitMod.ArtifactDropRegistry.ParseVanillaItem(val.Key, objectInfo[i]); } // If the item is a Geode, we have to add the extra data geodes require. if (val.Name.Contains("Geode")) { GemfruitMod.GeodeResultRegistry.ParseVanillaItem(val.Key, objectInfo[i], objectInfo); } Register(val.Key, val); } } var weaponsInfo = _content.Load <Dictionary <int, string> >("Data\\weapons"); foreach (var i in weaponsInfo.Keys) { var item = Item.ParseWeaponFromString(weaponsInfo[i]); if (item.IsError()) { GemfruitMod.Logger.Log(LogLevel.Error, "ItemRegistry", item.UnwrapError().Message); } else { var val = item.Unwrap(); val.AssignSpriteSheetReference(new ResourceKey("TileSheets\\weapons"), VanillaSpritesheetHelper.WeaponIdToRectangle(i)); val.Key = VanillaResourceKeyTransformers.ApplyTransformerForKey(val, i, new ResourceKey(StringUtility.SanitizeName(val.Name))); if (_dictionary.ContainsKey(val.Key)) { val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i); } Register(val.Key, val); } } }
internal void InitializeContent(LocalizedContentManager content) { this.smallFont = content.Load <SpriteFont>(@"Fonts\SmallFont"); Game1.mobileSpriteSheet = content.Load <Texture2D>(@"LooseSprites\\MobileAtlas_manually_made"); this.scrollbar = new MobileScrollbar(0, 96, 16, this.ScrollBoxHeight - 192); this.scrollbox = new MobileScrollbox(0, 0, this.MaxTextAreaWidth, this.ScrollBoxHeight, this.MaxScrollBoxHeight, new Rectangle(0, 0, (int)(Game1.graphics.PreferredBackBufferWidth / Game1.NativeZoomLevel), this.ScrollBoxHeight), this.scrollbar ); }
public TelescopeScene(NPC Maru) { temporaryContent = Game1.content.CreateTemporary(); background = temporaryContent.Load <Texture2D>("LooseSprites\\nightSceneMaru"); trees = temporaryContent.Load <Texture2D>("LooseSprites\\nightSceneMaruTrees"); walkSpace = new GameLocation(null, "walkSpace"); walkSpace.map = new Map(); walkSpace.map.AddLayer(new Layer("Back", walkSpace.map, new Size(30, 1), new Size(64))); Game1.currentLocation = walkSpace; }
private void VanillaRegistrations() { var fdict = _content.Load <Dictionary <int, string> >("Data\\Furniture"); _furnitureDefaultDesc = _content.LoadString("Strings\\StringsFromCSFiles:Furniture.cs.12623"); foreach (var i in fdict.Keys) { var plac = Placeable.ParseFromFurnitureString(fdict[i], _furnitureDefaultDesc); if (plac.IsError()) { GemfruitMod.Logger.Log(LogLevel.Error, "PlaceableRegistry", plac.UnwrapError().Message); } else { var val = plac.Unwrap(); var r = val.Rect; r.Location = VanillaSpritesheetHelper.FurnitureIdToLocation(i); val.AssignSpriteSheetReference(new ResourceKey("TileSheets\\furniture"), r); val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name)); if (_dictionary.ContainsKey(val.Key)) { val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i); } Register(val.Key, val); } } var cdict = _content.Load <Dictionary <int, string> >("Data\\BigCraftablesInformation"); foreach (var i in cdict.Keys) { var plac = Placeable.ParseFromBigCraftableString(cdict[i]); if (plac.IsError()) { GemfruitMod.Logger.Log(LogLevel.Error, "PlaceableRegistry", plac.UnwrapError().Message); } else { var val = plac.Unwrap(); var r = val.Rect; r.Location = VanillaSpritesheetHelper.CraftableIdToLocation(i); val.AssignSpriteSheetReference(new ResourceKey("TileSheets\\Craftables"), r); val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name)); if (_dictionary.ContainsKey(val.Key)) { val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i); } Register(val.Key, val); } } }
/// <summary>Reload the portraits for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="keys">The asset key to reload.</param> /// <returns>Returns the number of reloaded assets.</returns> private int ReloadNpcPortraits(LocalizedContentManager content, IEnumerable <string> keys) { // get NPCs HashSet <string> lookup = new HashSet <string>(keys, StringComparer.InvariantCultureIgnoreCase); var villagers = ( from npc in this.GetCharacters() where npc.isVillager() let textureKey = this.GetNormalizedPath($"Portraits\\{this.getTextureName(npc)}") where lookup.Contains(textureKey) select new { npc, textureKey } ) .ToArray(); if (!villagers.Any()) { return(0); } // update portrait int reloaded = 0; foreach (var entry in villagers) { entry.npc.resetPortrait(); entry.npc.Portrait = content.Load <Texture2D>(entry.textureKey); reloaded++; } return(reloaded); }
/// <summary>Reload the disposition data for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any NPCs were affected.</returns> private bool ReloadNpcDispositions(LocalizedContentManager content, string key) { IDictionary <string, string> dispositions = content.Load <Dictionary <string, string> >(key); foreach (NPC character in this.GetCharacters()) { if (!character.isVillager() || !dispositions.ContainsKey(character.Name)) { continue; } NPC clone = new NPC(null, character.Position, character.DefaultMap, character.FacingDirection, character.Name, null, character.Portrait, eventActor: false); character.Age = clone.Age; character.Manners = clone.Manners; character.SocialAnxiety = clone.SocialAnxiety; character.Optimism = clone.Optimism; character.Gender = clone.Gender; character.datable.Value = clone.datable.Value; character.homeRegion = clone.homeRegion; character.Birthday_Season = clone.Birthday_Season; character.Birthday_Day = clone.Birthday_Day; character.id = clone.id; character.displayName = clone.displayName; } return(true); }
/// <summary>Reload the sprites for matching farm animals.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> /// <remarks>Derived from <see cref="FarmAnimal.reload"/>.</remarks> private bool ReloadFarmAnimalSprites(LocalizedContentManager content, string key) { // find matches FarmAnimal[] animals = this.GetFarmAnimals().ToArray(); if (!animals.Any()) { return(false); } // update sprites Lazy <Texture2D> texture = new Lazy <Texture2D>(() => content.Load <Texture2D>(key)); foreach (FarmAnimal animal in animals) { // get expected key string expectedKey = animal.age.Value < animal.ageWhenMature.Value ? $"Baby{(animal.type.Value == "Duck" ? "White Chicken" : animal.type.Value)}" : animal.type.Value; if (animal.showDifferentTextureWhenReadyForHarvest.Value && animal.currentProduce.Value <= 0) { expectedKey = $"Sheared{expectedKey}"; } expectedKey = $"Animals\\{expectedKey}"; // reload asset if (expectedKey == key) { this.SetSpriteTexture(animal.Sprite, texture.Value); } } return(texture.IsValueCreated); }
/// <summary>Reload critter textures.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns the number of reloaded assets.</returns> private int ReloadCritterTextures(LocalizedContentManager content, string key) { // get critters Critter[] critters = ( from location in this.GetLocations() let locCritters = this.Reflection.GetField <List <Critter> >(location, "critters").GetValue() where locCritters != null from Critter critter in locCritters where this.NormalizeAssetNameIgnoringEmpty(critter.sprite?.Texture?.Name) == key select critter ) .ToArray(); if (!critters.Any()) { return(0); } // update sprites Texture2D texture = content.Load <Texture2D>(key); foreach (var entry in critters) { this.SetSpriteTexture(entry.sprite, texture); } return(critters.Length); }
public MaruComet() { zoom = 4; content = Game1.content.CreateTemporary(); cometTexture = content.Load <Texture2D>("Minigames\\MaruComet"); changeScreenSize(); }
public HaleyCowPictures() { content = Game1.content.CreateTemporary(); pictures = (Game1.currentSeason.Equals("winter") ? content.Load <Texture2D>("LooseSprites\\cowPhotosWinter") : content.Load <Texture2D>("LooseSprites\\cowPhotos")); float pixel_zoom_adjustment = 1f / Game1.options.zoomLevel; centerOfScreen = new Vector2(Game1.game1.localMultiplayerWindow.Width / 2, Game1.game1.localMultiplayerWindow.Height / 2) * pixel_zoom_adjustment; }
public MaruComet() { zoom = 4; content = Game1.content.CreateTemporary(); cometTexture = content.Load <Texture2D>("Minigames\\MaruComet"); float pixel_zoom_adjustment = 1f / Game1.options.zoomLevel; centerOfScreen = pixel_zoom_adjustment * new Vector2(Game1.graphics.GraphicsDevice.Viewport.Width / 2, Game1.graphics.GraphicsDevice.Viewport.Height / 2); cometColorOrigin = centerOfScreen + pixel_zoom_adjustment * new Vector2(-71 * zoom, 71 * zoom); }
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, StardewValley.Farmer f) { if (TextureSheet.IsDisposed == true) { TextureSheet = contentManager.Load <Texture2D>(blankTexture); } spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); if (f.ActiveObject != null && f.ActiveObject.Name.Contains("=")) { spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); if (Math.Abs(Game1.starCropShimmerPause) <= 0.05f && Game1.random.NextDouble() < 0.97) { return; } Game1.starCropShimmerPause += 0.04f; if (Game1.starCropShimmerPause >= 0.8f) { Game1.starCropShimmerPause = -0.8f; } } }
/// <summary>Reload the disposition data for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any NPCs were affected.</returns> private bool ReloadNpcDispositions(LocalizedContentManager content, string key) { IDictionary <string, string> data = content.Load <Dictionary <string, string> >(key); bool changed = false; foreach (NPC npc in this.GetCharacters()) { if (npc.isVillager() && data.ContainsKey(npc.Name)) { npc.reloadData(); changed = true; } } return(changed); }
private void restoreBridge() { LocalizedContentManager localizedContentManager = Game1.content.CreateTemporary(); Map map = localizedContentManager.Load <Map>("Maps\\Mountain-BridgeFixed"); int num = 92; int num2 = 24; for (int i = 0; i < map.GetLayer("Back").LayerWidth; i++) { for (int j = 0; j < map.GetLayer("Back").LayerHeight; j++) { this.map.GetLayer("Back").Tiles[i + num, j + num2] = ((map.GetLayer("Back").Tiles[i, j] == null) ? null : new StaticTile(this.map.GetLayer("Back"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Back").Tiles[i, j].TileIndex)); this.map.GetLayer("Buildings").Tiles[i + num, j + num2] = ((map.GetLayer("Buildings").Tiles[i, j] == null) ? null : new StaticTile(this.map.GetLayer("Buildings"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Buildings").Tiles[i, j].TileIndex)); this.map.GetLayer("Front").Tiles[i + num, j + num2] = ((map.GetLayer("Front").Tiles[i, j] == null) ? null : new StaticTile(this.map.GetLayer("Front"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Front").Tiles[i, j].TileIndex)); } } this.bridgeRestored = true; localizedContentManager.Unload(); }
/********* ** Private methods *********/ /**** ** Reload methods ****/ /// <summary>Reload the sprites for matching pets or horses.</summary> /// <typeparam name="TAnimal">The animal type.</typeparam> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadPetOrHorseSprites <TAnimal>(LocalizedContentManager content, string key) where TAnimal : NPC { // find matches TAnimal[] animals = this.GetCharacters().OfType <TAnimal>().ToArray(); if (!animals.Any()) { return(false); } // update sprites Texture2D texture = content.Load <Texture2D>(key); foreach (TAnimal animal in animals) { this.SetSpriteTexture(animal.Sprite, texture); } return(true); }
private void restoreBridge() { LocalizedContentManager temporary = Game1.content.CreateTemporary(); Map map = temporary.Load <Map>("Maps\\Mountain-BridgeFixed"); int num1 = 92; int num2 = 24; for (int index1 = 0; index1 < map.GetLayer("Back").LayerWidth; ++index1) { for (int index2 = 0; index2 < map.GetLayer("Back").LayerHeight; ++index2) { this.map.GetLayer("Back").Tiles[index1 + num1, index2 + num2] = map.GetLayer("Back").Tiles[index1, index2] == null ? (Tile)null : (Tile) new StaticTile(this.map.GetLayer("Back"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Back").Tiles[index1, index2].TileIndex); this.map.GetLayer("Buildings").Tiles[index1 + num1, index2 + num2] = map.GetLayer("Buildings").Tiles[index1, index2] == null ? (Tile)null : (Tile) new StaticTile(this.map.GetLayer("Buildings"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Buildings").Tiles[index1, index2].TileIndex); this.map.GetLayer("Front").Tiles[index1 + num1, index2 + num2] = map.GetLayer("Front").Tiles[index1, index2] == null ? (Tile)null : (Tile) new StaticTile(this.map.GetLayer("Front"), this.map.TileSheets[0], BlendMode.Alpha, map.GetLayer("Front").Tiles[index1, index2].TileIndex); } } this.bridgeRestored = true; temporary.Unload(); }
/// <summary>Reload tree textures.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <param name="type">The type to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadTreeTextures(LocalizedContentManager content, string key, int type) { Tree[] trees = Game1.locations .SelectMany(p => p.terrainFeatures.Values.OfType <Tree>()) .Where(tree => tree.treeType.Value == type) .ToArray(); if (trees.Any()) { Lazy <Texture2D> texture = new Lazy <Texture2D>(() => content.Load <Texture2D>(key)); foreach (Tree tree in trees) { this.Reflection.GetField <Lazy <Texture2D> >(tree, "texture").SetValue(texture); } return(true); } return(false); }
// Token: 0x06001171 RID: 4465 RVA: 0x00165BF8 File Offset: 0x00163DF8 private void restoreBridge() { LocalizedContentManager temp = Game1.content.CreateTemporary(); Map i = temp.Load <Map>("Maps\\Mountain-BridgeFixed"); int xOffset = 92; int yOffset = 24; for (int x = 0; x < i.GetLayer("Back").LayerWidth; x++) { for (int y = 0; y < i.GetLayer("Back").LayerHeight; y++) { this.map.GetLayer("Back").Tiles[x + xOffset, y + yOffset] = ((i.GetLayer("Back").Tiles[x, y] == null) ? null : new StaticTile(this.map.GetLayer("Back"), this.map.TileSheets[0], BlendMode.Alpha, i.GetLayer("Back").Tiles[x, y].TileIndex)); this.map.GetLayer("Buildings").Tiles[x + xOffset, y + yOffset] = ((i.GetLayer("Buildings").Tiles[x, y] == null) ? null : new StaticTile(this.map.GetLayer("Buildings"), this.map.TileSheets[0], BlendMode.Alpha, i.GetLayer("Buildings").Tiles[x, y].TileIndex)); this.map.GetLayer("Front").Tiles[x + xOffset, y + yOffset] = ((i.GetLayer("Front").Tiles[x, y] == null) ? null : new StaticTile(this.map.GetLayer("Front"), this.map.TileSheets[0], BlendMode.Alpha, i.GetLayer("Front").Tiles[x, y].TileIndex)); } } this.bridgeRestored = true; temp.Unload(); }
/// <summary>Reload the sprites for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadNpcSprites(LocalizedContentManager content, string key) { // get NPCs NPC[] characters = this.GetCharacters() .Where(npc => npc.Sprite != null && this.GetNormalisedPath(npc.Sprite.textureName.Value) == key) .ToArray(); if (!characters.Any()) { return(false); } // update portrait Texture2D texture = content.Load <Texture2D>(key); foreach (NPC character in characters) { this.SetSpriteTexture(character.Sprite, texture); } return(true); }
/// <summary>Reload the portraits for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadNpcPortraits(LocalizedContentManager content, string key) { // get NPCs string name = this.GetNpcNameFromFileName(Path.GetFileName(key)); NPC[] villagers = this.GetCharacters().Where(npc => npc.Name == name && npc.isVillager()).ToArray(); if (!villagers.Any()) { return(false); } // update portrait Texture2D texture = content.Load <Texture2D>(key); foreach (NPC villager in villagers) { villager.Portrait = texture; } return(true); }
/// <summary>Reload the sprites for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <param name="monster">Whether to match monsters (<c>true</c>) or non-monsters (<c>false</c>).</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadNpcSprites(LocalizedContentManager content, string key, bool monster) { // get NPCs string name = this.GetNpcNameFromFileName(Path.GetFileName(key)); NPC[] characters = this.GetCharacters().Where(npc => npc.Name == name && npc.IsMonster == monster).ToArray(); if (!characters.Any()) { return(false); } // update portrait Texture2D texture = content.Load <Texture2D>(key); foreach (NPC character in characters) { this.SetSpriteTexture(character.Sprite, texture); } return(true); }
/// <summary>Reload the portraits for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadNpcPortraits(LocalizedContentManager content, string key) { // get NPCs NPC[] villagers = this.GetCharacters() .Where(npc => npc.isVillager() && this.GetNormalisedPath($"Portraits\\{this.Reflection.GetMethod(npc, "getTextureName").Invoke<string>()}") == key) .ToArray(); if (!villagers.Any()) { return(false); } // update portrait Texture2D texture = content.Load <Texture2D>(key); foreach (NPC villager in villagers) { villager.resetPortrait(); villager.Portrait = texture; } return(true); }
public GrandpaStory() { Game1.changeMusicTrack("none"); content = Game1.content.CreateTemporary(); texture = content.Load <Texture2D>("Minigames\\jojacorps"); backgroundFadeChange = 0.0003f; grandpaSpeech = new Queue <string>(); grandpaSpeech.Enqueue(Game1.player.IsMale ? Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12026") : Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12028")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12029")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12030")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12031")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12034")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12035")); grandpaSpeech.Enqueue(Game1.player.IsMale ? Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12036") : Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12038")); grandpaSpeech.Enqueue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GrandpaStory.cs.12040")); Game1.player.Position = new Vector2(panX, Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 360) + new Vector2(3000f, 376f); Game1.viewport.X = 0; Game1.viewport.Y = 0; Game1.currentLocation = new FarmHouse("Maps\\FarmHouse", "FarmHouse"); Game1.currentLocation.map.LoadTileSheets(Game1.mapDisplayDevice); Game1.player.currentLocation = Game1.currentLocation; }
/// <summary>Reload building textures.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns whether any textures were reloaded.</returns> private bool ReloadBuildings(LocalizedContentManager content, string key) { // get buildings string type = Path.GetFileName(key); Building[] buildings = Game1.locations .OfType <BuildableGameLocation>() .SelectMany(p => p.buildings) .Where(p => p.buildingType.Value == type) .ToArray(); // reload buildings if (buildings.Any()) { Lazy <Texture2D> texture = new Lazy <Texture2D>(() => content.Load <Texture2D>(key)); foreach (Building building in buildings) { building.texture = texture; } return(true); } return(false); }
/// <summary>Reload the sprites for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="keys">The asset keys to reload.</param> /// <returns>Returns the number of reloaded assets.</returns> private int ReloadNpcSprites(LocalizedContentManager content, IEnumerable <string> keys) { // get NPCs HashSet <string> lookup = new HashSet <string>(keys, StringComparer.InvariantCultureIgnoreCase); NPC[] characters = this.GetCharacters() .Where(npc => npc.Sprite != null && lookup.Contains(this.NormalizeAssetNameIgnoringEmpty(npc.Sprite?.Texture?.Name))) .ToArray(); if (!characters.Any()) { return(0); } // update sprite int reloaded = 0; foreach (NPC npc in characters) { this.SetSpriteTexture(npc.Sprite, content.Load <Texture2D>(npc.Sprite.textureName.Value)); reloaded++; } return(reloaded); }
/// <summary>Reload the portraits for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="keys">The asset key to reload.</param> /// <returns>Returns the number of reloaded assets.</returns> private int ReloadNpcPortraits(LocalizedContentManager content, IEnumerable <string> keys) { // get NPCs HashSet <string> lookup = new HashSet <string>(keys, StringComparer.InvariantCultureIgnoreCase); var villagers = this .GetCharacters() .Where(npc => npc.isVillager() && lookup.Contains(this.NormalizeAssetNameIgnoringEmpty(npc.Portrait?.Name))) .ToArray(); if (!villagers.Any()) { return(0); } // update portrait int reloaded = 0; foreach (NPC npc in villagers) { npc.Portrait = content.Load <Texture2D>(npc.Portrait.Name); reloaded++; } return(reloaded); }
/********* ** Private methods *********/ /// <summary>Reload one of the game's core assets (if applicable).</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <returns>Returns any non-null value to indicate an asset was loaded.</returns> private object PropagateImpl(LocalizedContentManager content, string key) { Reflector reflection = this.Reflection; switch (key.ToLower().Replace("/", "\\")) // normalised key so we can compare statically { /**** ** Animals ****/ case "animals\\cat": return(this.ReloadPetOrHorseSprites <Cat>(content, key)); case "animals\\dog": return(this.ReloadPetOrHorseSprites <Dog>(content, key)); case "animals\\horse": return(this.ReloadPetOrHorseSprites <Horse>(content, key)); /**** ** Buildings ****/ case "buildings\\houses": // Farm reflection.GetField <Texture2D>(typeof(Farm), nameof(Farm.houseTextures)).SetValue(content.Load <Texture2D>(key)); return(true); /**** ** Content\Characters\Farmer ****/ case "characters\\farmer\\accessories": // Game1.loadContent return(FarmerRenderer.accessoriesTexture = content.Load <Texture2D>(key)); case "characters\\farmer\\farmer_base": // Farmer if (Game1.player == null || !Game1.player.IsMale) { return(false); } return(Game1.player.FarmerRenderer = new FarmerRenderer(key)); case "characters\\farmer\\farmer_girl_base": // Farmer if (Game1.player == null || Game1.player.IsMale) { return(false); } return(Game1.player.FarmerRenderer = new FarmerRenderer(key)); case "characters\\farmer\\hairstyles": // Game1.loadContent return(FarmerRenderer.hairStylesTexture = content.Load <Texture2D>(key)); case "characters\\farmer\\hats": // Game1.loadContent return(FarmerRenderer.hatsTexture = content.Load <Texture2D>(key)); case "characters\\farmer\\shirts": // Game1.loadContent return(FarmerRenderer.shirtsTexture = content.Load <Texture2D>(key)); /**** ** Content\Data ****/ case "data\\achievements": // Game1.loadContent return(Game1.achievements = content.Load <Dictionary <int, string> >(key)); case "data\\bigcraftablesinformation": // Game1.loadContent return(Game1.bigCraftablesInformation = content.Load <Dictionary <int, string> >(key)); case "data\\cookingrecipes": // CraftingRecipe.InitShared return(CraftingRecipe.cookingRecipes = content.Load <Dictionary <string, string> >(key)); case "data\\craftingrecipes": // CraftingRecipe.InitShared return(CraftingRecipe.craftingRecipes = content.Load <Dictionary <string, string> >(key)); case "data\\npcgifttastes": // Game1.loadContent return(Game1.NPCGiftTastes = content.Load <Dictionary <string, string> >(key)); case "data\\objectinformation": // Game1.loadContent return(Game1.objectInformation = content.Load <Dictionary <int, string> >(key)); /**** ** Content\Fonts ****/ case "fonts\\spritefont1": // Game1.loadContent return(Game1.dialogueFont = content.Load <SpriteFont>(key)); case "fonts\\smallfont": // Game1.loadContent return(Game1.smallFont = content.Load <SpriteFont>(key)); case "fonts\\tinyfont": // Game1.loadContent return(Game1.tinyFont = content.Load <SpriteFont>(key)); case "fonts\\tinyfontborder": // Game1.loadContent return(Game1.tinyFontBorder = content.Load <SpriteFont>(key)); /**** ** Content\Lighting ****/ case "loosesprites\\lighting\\greenlight": // Game1.loadContent return(Game1.cauldronLight = content.Load <Texture2D>(key)); case "loosesprites\\lighting\\indoorwindowlight": // Game1.loadContent return(Game1.indoorWindowLight = content.Load <Texture2D>(key)); case "loosesprites\\lighting\\lantern": // Game1.loadContent return(Game1.lantern = content.Load <Texture2D>(key)); case "loosesprites\\lighting\\sconcelight": // Game1.loadContent return(Game1.sconceLight = content.Load <Texture2D>(key)); case "loosesprites\\lighting\\windowlight": // Game1.loadContent return(Game1.windowLight = content.Load <Texture2D>(key)); /**** ** Content\LooseSprites ****/ case "loosesprites\\controllermaps": // Game1.loadContent return(Game1.controllerMaps = content.Load <Texture2D>(key)); case "loosesprites\\cursors": // Game1.loadContent return(Game1.mouseCursors = content.Load <Texture2D>(key)); case "loosesprites\\daybg": // Game1.loadContent return(Game1.daybg = content.Load <Texture2D>(key)); case "loosesprites\\font_bold": // Game1.loadContent return(SpriteText.spriteTexture = content.Load <Texture2D>(key)); case "loosesprites\\font_colored": // Game1.loadContent return(SpriteText.coloredTexture = content.Load <Texture2D>(key)); case "loosesprites\\nightbg": // Game1.loadContent return(Game1.nightbg = content.Load <Texture2D>(key)); case "loosesprites\\shadow": // Game1.loadContent return(Game1.shadowTexture = content.Load <Texture2D>(key)); /**** ** Content\Critters ****/ case "tilesheets\\crops": // Game1.loadContent return(Game1.cropSpriteSheet = content.Load <Texture2D>(key)); case "tilesheets\\debris": // Game1.loadContent return(Game1.debrisSpriteSheet = content.Load <Texture2D>(key)); case "tilesheets\\emotes": // Game1.loadContent return(Game1.emoteSpriteSheet = content.Load <Texture2D>(key)); case "tilesheets\\furniture": // Game1.loadContent return(Furniture.furnitureTexture = content.Load <Texture2D>(key)); case "tilesheets\\projectiles": // Game1.loadContent return(Projectile.projectileSheet = content.Load <Texture2D>(key)); case "tilesheets\\rain": // Game1.loadContent return(Game1.rainTexture = content.Load <Texture2D>(key)); case "tilesheets\\tools": // Game1.ResetToolSpriteSheet Game1.ResetToolSpriteSheet(); return(true); case "tilesheets\\weapons": // Game1.loadContent return(Tool.weaponsTexture = content.Load <Texture2D>(key)); /**** ** Content\Maps ****/ case "maps\\menutiles": // Game1.loadContent return(Game1.menuTexture = content.Load <Texture2D>(key)); case "maps\\springobjects": // Game1.loadContent return(Game1.objectSpriteSheet = content.Load <Texture2D>(key)); case "maps\\walls_and_floors": // Wallpaper return(Wallpaper.wallpaperTexture = content.Load <Texture2D>(key)); /**** ** Content\Minigames ****/ case "minigames\\clouds": // TitleMenu if (Game1.activeClickableMenu is TitleMenu) { reflection.GetField <Texture2D>(Game1.activeClickableMenu, "cloudsTexture").SetValue(content.Load <Texture2D>(key)); return(true); } return(false); case "minigames\\titlebuttons": // TitleMenu if (Game1.activeClickableMenu is TitleMenu titleMenu) { Texture2D texture = content.Load <Texture2D>(key); reflection.GetField <Texture2D>(titleMenu, "titleButtonsTexture").SetValue(texture); foreach (TemporaryAnimatedSprite bird in reflection.GetField <List <TemporaryAnimatedSprite> >(titleMenu, "birds").GetValue()) { bird.texture = texture; } return(true); } return(false); /**** ** Content\TileSheets ****/ case "tilesheets\\animations": // Game1.loadContent return(Game1.animations = content.Load <Texture2D>(key)); case "tilesheets\\buffsicons": // Game1.loadContent return(Game1.buffsIcons = content.Load <Texture2D>(key)); case "tilesheets\\bushes": // new Bush() reflection.GetField <Lazy <Texture2D> >(typeof(Bush), "texture").SetValue(new Lazy <Texture2D>(() => content.Load <Texture2D>(key))); return(true); case "tilesheets\\craftables": // Game1.loadContent return(Game1.bigCraftableSpriteSheet = content.Load <Texture2D>(key)); case "tilesheets\\fruittrees": // FruitTree return(FruitTree.texture = content.Load <Texture2D>(key)); /**** ** Content\TerrainFeatures ****/ case "terrainfeatures\\flooring": // Flooring return(Flooring.floorsTexture = content.Load <Texture2D>(key)); case "terrainfeatures\\hoedirt": // from HoeDirt return(HoeDirt.lightTexture = content.Load <Texture2D>(key)); case "terrainfeatures\\hoedirtdark": // from HoeDirt return(HoeDirt.darkTexture = content.Load <Texture2D>(key)); case "terrainfeatures\\hoedirtsnow": // from HoeDirt return(HoeDirt.snowTexture = content.Load <Texture2D>(key)); case "terrainfeatures\\mushroom_tree": // from Tree return(this.ReloadTreeTextures(content, key, Tree.mushroomTree)); case "terrainfeatures\\tree_palm": // from Tree return(this.ReloadTreeTextures(content, key, Tree.palmTree)); case "terrainfeatures\\tree1_fall": // from Tree case "terrainfeatures\\tree1_spring": // from Tree case "terrainfeatures\\tree1_summer": // from Tree case "terrainfeatures\\tree1_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.bushyTree)); case "terrainfeatures\\tree2_fall": // from Tree case "terrainfeatures\\tree2_spring": // from Tree case "terrainfeatures\\tree2_summer": // from Tree case "terrainfeatures\\tree2_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.leafyTree)); case "terrainfeatures\\tree3_fall": // from Tree case "terrainfeatures\\tree3_spring": // from Tree case "terrainfeatures\\tree3_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.pineTree)); } // dynamic textures if (this.IsInFolder(key, "Animals")) { return(this.ReloadFarmAnimalSprites(content, key)); } if (this.IsInFolder(key, "Buildings")) { return(this.ReloadBuildings(content, key)); } if (this.IsInFolder(key, "Characters")) { return(this.ReloadNpcSprites(content, key, monster: false)); } if (this.IsInFolder(key, "Characters\\Monsters")) { return(this.ReloadNpcSprites(content, key, monster: true)); } if (key.StartsWith(this.GetNormalisedPath("LooseSprites\\Fence"), StringComparison.InvariantCultureIgnoreCase)) { return(this.ReloadFenceTextures(content, key)); } if (this.IsInFolder(key, "Portraits")) { return(this.ReloadNpcPortraits(content, key)); } return(false); }
/********* ** Private methods *********/ /// <summary>Reload one of the game's core assets (if applicable).</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <param name="type">The asset type to reload.</param> /// <returns>Returns whether an asset was loaded. The return value may be true or false, or a non-null value for true.</returns> private bool PropagateOther(LocalizedContentManager content, string key, Type type) { key = this.AssertAndNormalizeAssetName(key); /**** ** Special case: current map tilesheet ** We only need to do this for the current location, since tilesheets are reloaded when you enter a location. ** Just in case, we should still propagate by key even if a tilesheet is matched. ****/ if (Game1.currentLocation?.map?.TileSheets != null) { foreach (TileSheet tilesheet in Game1.currentLocation.map.TileSheets) { if (this.NormalizeAssetNameIgnoringEmpty(tilesheet.ImageSource) == key) { Game1.mapDisplayDevice.LoadTileSheet(tilesheet); } } } /**** ** Propagate map changes ****/ if (type == typeof(Map)) { bool anyChanged = false; foreach (GameLocation location in this.GetLocations()) { if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.NormalizeAssetNameIgnoringEmpty(location.mapPath.Value) == key) { // reset town caches if (location is Town town) { this.Reflection.GetField <bool>(town, "ccRefurbished").SetValue(false); this.Reflection.GetField <bool>(town, "isShowingDestroyedJoja").SetValue(false); this.Reflection.GetField <bool>(town, "isShowingUpgradedPamHouse").SetValue(false); } // general updates location.reloadMap(); location.updateSeasonalTileSheets(); location.updateWarps(); // update interior doors location.interiorDoors.Clear(); foreach (var entry in new InteriorDoorDictionary(location)) { location.interiorDoors.Add(entry); } // update doors location.doors.Clear(); location.updateDoors(); anyChanged = true; } } return(anyChanged); } /**** ** Propagate by key ****/ Reflector reflection = this.Reflection; switch (key.ToLower().Replace("/", "\\")) // normalized key so we can compare statically { /**** ** Animals ****/ case "animals\\horse": return(this.ReloadPetOrHorseSprites <Horse>(content, key)); /**** ** Buildings ****/ case "buildings\\houses": // Farm reflection.GetField <Texture2D>(typeof(Farm), nameof(Farm.houseTextures)).SetValue(content.Load <Texture2D>(key)); return(true); /**** ** Content\Characters\Farmer ****/ case "characters\\farmer\\accessories": // Game1.LoadContent FarmerRenderer.accessoriesTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\farmer_base": // Farmer case "characters\\farmer\\farmer_base_bald": case "characters\\farmer\\farmer_girl_base": case "characters\\farmer\\farmer_girl_base_bald": return(this.ReloadPlayerSprites(key)); case "characters\\farmer\\hairstyles": // Game1.LoadContent FarmerRenderer.hairStylesTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\hats": // Game1.LoadContent FarmerRenderer.hatsTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\pants": // Game1.LoadContent FarmerRenderer.pantsTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\shirts": // Game1.LoadContent FarmerRenderer.shirtsTexture = content.Load <Texture2D>(key); return(true); /**** ** Content\Data ****/ case "data\\achievements": // Game1.LoadContent Game1.achievements = content.Load <Dictionary <int, string> >(key); return(true); case "data\\bigcraftablesinformation": // Game1.LoadContent Game1.bigCraftablesInformation = content.Load <Dictionary <int, string> >(key); return(true); case "data\\bundles": // NetWorldState constructor { var bundles = this.Reflection.GetField <NetBundles>(Game1.netWorldState.Value, "bundles").GetValue(); var rewards = this.Reflection.GetField <NetIntDictionary <bool, NetBool> >(Game1.netWorldState.Value, "bundleRewards").GetValue(); foreach (var pair in content.Load <Dictionary <string, string> >(key)) { int bundleKey = int.Parse(pair.Key.Split('/')[1]); int rewardsCount = pair.Value.Split('/')[2].Split(' ').Length; // add bundles if (!bundles.TryGetValue(bundleKey, out bool[] values) || values.Length < rewardsCount)
/********* ** Private methods *********/ /// <summary>Reload one of the game's core assets (if applicable).</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> /// <param name="type">The asset type to reload.</param> /// <returns>Returns whether an asset was loaded. The return value may be true or false, or a non-null value for true.</returns> private bool PropagateOther(LocalizedContentManager content, string key, Type type) { key = this.AssertAndNormalizeAssetName(key); /**** ** Special case: current map tilesheet ** We only need to do this for the current location, since tilesheets are reloaded when you enter a location. ** Just in case, we should still propagate by key even if a tilesheet is matched. ****/ if (Game1.currentLocation?.map?.TileSheets != null) { foreach (TileSheet tilesheet in Game1.currentLocation.map.TileSheets) { if (this.NormalizeAssetNameIgnoringEmpty(tilesheet.ImageSource) == key) { Game1.mapDisplayDevice.LoadTileSheet(tilesheet); } } } /**** ** Propagate map changes ****/ if (type == typeof(Map)) { bool anyChanged = false; foreach (GameLocation location in this.GetLocations()) { if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.NormalizeAssetNameIgnoringEmpty(location.mapPath.Value) == key) { // general updates location.reloadMap(); location.updateSeasonalTileSheets(); location.updateWarps(); // update interior doors location.interiorDoors.Clear(); foreach (var entry in new InteriorDoorDictionary(location)) { location.interiorDoors.Add(entry); } // update doors location.doors.Clear(); location.updateDoors(); anyChanged = true; } } return(anyChanged); } /**** ** Propagate by key ****/ Reflector reflection = this.Reflection; switch (key.ToLower().Replace("/", "\\")) // normalized key so we can compare statically { /**** ** Animals ****/ case "animals\\cat": return(this.ReloadPetOrHorseSprites <Cat>(content, key)); case "animals\\dog": return(this.ReloadPetOrHorseSprites <Dog>(content, key)); case "animals\\horse": return(this.ReloadPetOrHorseSprites <Horse>(content, key)); /**** ** Buildings ****/ case "buildings\\houses": // Farm reflection.GetField <Texture2D>(typeof(Farm), nameof(Farm.houseTextures)).SetValue(content.Load <Texture2D>(key)); return(true); /**** ** Content\Characters\Farmer ****/ case "characters\\farmer\\accessories": // Game1.LoadContent FarmerRenderer.accessoriesTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\farmer_base": // Farmer if (Game1.player == null || !Game1.player.IsMale) { return(false); } Game1.player.FarmerRenderer = new FarmerRenderer(key, Game1.player); return(true); case "characters\\farmer\\farmer_girl_base": // Farmer if (Game1.player == null || Game1.player.IsMale) { return(false); } Game1.player.FarmerRenderer = new FarmerRenderer(key, Game1.player); return(true); case "characters\\farmer\\hairstyles": // Game1.LoadContent FarmerRenderer.hairStylesTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\hats": // Game1.LoadContent FarmerRenderer.hatsTexture = content.Load <Texture2D>(key); return(true); case "characters\\farmer\\shirts": // Game1.LoadContent FarmerRenderer.shirtsTexture = content.Load <Texture2D>(key); return(true); /**** ** Content\Data ****/ case "data\\achievements": // Game1.LoadContent Game1.achievements = content.Load <Dictionary <int, string> >(key); return(true); case "data\\bigcraftablesinformation": // Game1.LoadContent Game1.bigCraftablesInformation = content.Load <Dictionary <int, string> >(key); return(true); case "data\\cookingrecipes": // CraftingRecipe.InitShared CraftingRecipe.cookingRecipes = content.Load <Dictionary <string, string> >(key); return(true); case "data\\craftingrecipes": // CraftingRecipe.InitShared CraftingRecipe.craftingRecipes = content.Load <Dictionary <string, string> >(key); return(true); case "data\\farmanimals": // FarmAnimal constructor return(this.ReloadFarmAnimalData()); case "data\\npcdispositions": // NPC constructor return(this.ReloadNpcDispositions(content, key)); case "data\\npcgifttastes": // Game1.LoadContent Game1.NPCGiftTastes = content.Load <Dictionary <string, string> >(key); return(true); case "data\\objectinformation": // Game1.LoadContent Game1.objectInformation = content.Load <Dictionary <int, string> >(key); return(true); /**** ** Content\Fonts ****/ case "fonts\\spritefont1": // Game1.LoadContent Game1.dialogueFont = content.Load <SpriteFont>(key); return(true); case "fonts\\smallfont": // Game1.LoadContent Game1.smallFont = content.Load <SpriteFont>(key); return(true); case "fonts\\tinyfont": // Game1.LoadContent Game1.tinyFont = content.Load <SpriteFont>(key); return(true); case "fonts\\tinyfontborder": // Game1.LoadContent Game1.tinyFontBorder = content.Load <SpriteFont>(key); return(true); /**** ** Content\LooseSprites\Lighting ****/ case "loosesprites\\lighting\\greenlight": // Game1.LoadContent Game1.cauldronLight = content.Load <Texture2D>(key); return(true); case "loosesprites\\lighting\\indoorwindowlight": // Game1.LoadContent Game1.indoorWindowLight = content.Load <Texture2D>(key); return(true); case "loosesprites\\lighting\\lantern": // Game1.LoadContent Game1.lantern = content.Load <Texture2D>(key); return(true); case "loosesprites\\lighting\\sconcelight": // Game1.LoadContent Game1.sconceLight = content.Load <Texture2D>(key); return(true); case "loosesprites\\lighting\\windowlight": // Game1.LoadContent Game1.windowLight = content.Load <Texture2D>(key); return(true); /**** ** Content\LooseSprites ****/ case "loosesprites\\controllermaps": // Game1.LoadContent Game1.controllerMaps = content.Load <Texture2D>(key); return(true); case "loosesprites\\cursors": // Game1.LoadContent Game1.mouseCursors = content.Load <Texture2D>(key); foreach (DayTimeMoneyBox menu in Game1.onScreenMenus.OfType <DayTimeMoneyBox>()) { foreach (ClickableTextureComponent button in new[] { menu.questButton, menu.zoomInButton, menu.zoomOutButton }) { button.texture = Game1.mouseCursors; } } return(true); case "loosesprites\\cursors2": // Game1.LoadContent Game1.mouseCursors2 = content.Load <Texture2D>(key); return(true); case "loosesprites\\daybg": // Game1.LoadContent Game1.daybg = content.Load <Texture2D>(key); return(true); case "loosesprites\\font_bold": // Game1.LoadContent SpriteText.spriteTexture = content.Load <Texture2D>(key); return(true); case "loosesprites\\font_colored": // Game1.LoadContent SpriteText.coloredTexture = content.Load <Texture2D>(key); return(true); case "loosesprites\\nightbg": // Game1.LoadContent Game1.nightbg = content.Load <Texture2D>(key); return(true); case "loosesprites\\shadow": // Game1.LoadContent Game1.shadowTexture = content.Load <Texture2D>(key); return(true); /**** ** Content\TileSheets ****/ case "tilesheets\\critters": // Critter constructor this.ReloadCritterTextures(content, key); return(true); case "tilesheets\\crops": // Game1.LoadContent Game1.cropSpriteSheet = content.Load <Texture2D>(key); return(true); case "tilesheets\\debris": // Game1.LoadContent Game1.debrisSpriteSheet = content.Load <Texture2D>(key); return(true); case "tilesheets\\emotes": // Game1.LoadContent Game1.emoteSpriteSheet = content.Load <Texture2D>(key); return(true); case "tilesheets\\furniture": // Game1.LoadContent Furniture.furnitureTexture = content.Load <Texture2D>(key); return(true); case "tilesheets\\projectiles": // Game1.LoadContent Projectile.projectileSheet = content.Load <Texture2D>(key); return(true); case "tilesheets\\rain": // Game1.LoadContent Game1.rainTexture = content.Load <Texture2D>(key); return(true); case "tilesheets\\tools": // Game1.ResetToolSpriteSheet Game1.ResetToolSpriteSheet(); return(true); case "tilesheets\\weapons": // Game1.LoadContent Tool.weaponsTexture = content.Load <Texture2D>(key); return(true); /**** ** Content\Maps ****/ case "maps\\menutiles": // Game1.LoadContent Game1.menuTexture = content.Load <Texture2D>(key); return(true); case "maps\\springobjects": // Game1.LoadContent Game1.objectSpriteSheet = content.Load <Texture2D>(key); return(true); case "maps\\walls_and_floors": // Wallpaper Wallpaper.wallpaperTexture = content.Load <Texture2D>(key); return(true); /**** ** Content\Minigames ****/ case "minigames\\clouds": // TitleMenu { if (Game1.activeClickableMenu is TitleMenu titleMenu) { titleMenu.cloudsTexture = content.Load <Texture2D>(key); return(true); } } return(false); case "minigames\\titlebuttons": // TitleMenu { if (Game1.activeClickableMenu is TitleMenu titleMenu) { Texture2D texture = content.Load <Texture2D>(key); titleMenu.titleButtonsTexture = texture; foreach (TemporaryAnimatedSprite bird in titleMenu.birds) { bird.texture = texture; } return(true); } } return(false); /**** ** Content\TileSheets ****/ case "tilesheets\\animations": // Game1.LoadContent Game1.animations = content.Load <Texture2D>(key); return(true); case "tilesheets\\buffsicons": // Game1.LoadContent Game1.buffsIcons = content.Load <Texture2D>(key); return(true); case "tilesheets\\bushes": // new Bush() Bush.texture = new Lazy <Texture2D>(() => content.Load <Texture2D>(key)); return(true); case "tilesheets\\craftables": // Game1.LoadContent Game1.bigCraftableSpriteSheet = content.Load <Texture2D>(key); return(true); case "tilesheets\\fruittrees": // FruitTree FruitTree.texture = content.Load <Texture2D>(key); return(true); /**** ** Content\TerrainFeatures ****/ case "terrainfeatures\\flooring": // Flooring Flooring.floorsTexture = content.Load <Texture2D>(key); return(true); case "terrainfeatures\\hoedirt": // from HoeDirt HoeDirt.lightTexture = content.Load <Texture2D>(key); return(true); case "terrainfeatures\\hoedirtdark": // from HoeDirt HoeDirt.darkTexture = content.Load <Texture2D>(key); return(true); case "terrainfeatures\\hoedirtsnow": // from HoeDirt HoeDirt.snowTexture = content.Load <Texture2D>(key); return(true); case "terrainfeatures\\mushroom_tree": // from Tree return(this.ReloadTreeTextures(content, key, Tree.mushroomTree)); case "terrainfeatures\\tree_palm": // from Tree return(this.ReloadTreeTextures(content, key, Tree.palmTree)); case "terrainfeatures\\tree1_fall": // from Tree case "terrainfeatures\\tree1_spring": // from Tree case "terrainfeatures\\tree1_summer": // from Tree case "terrainfeatures\\tree1_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.bushyTree)); case "terrainfeatures\\tree2_fall": // from Tree case "terrainfeatures\\tree2_spring": // from Tree case "terrainfeatures\\tree2_summer": // from Tree case "terrainfeatures\\tree2_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.leafyTree)); case "terrainfeatures\\tree3_fall": // from Tree case "terrainfeatures\\tree3_spring": // from Tree case "terrainfeatures\\tree3_winter": // from Tree return(this.ReloadTreeTextures(content, key, Tree.pineTree)); } // dynamic textures if (this.IsInFolder(key, "Animals")) { return(this.ReloadFarmAnimalSprites(content, key)); } if (this.IsInFolder(key, "Buildings")) { return(this.ReloadBuildings(content, key)); } if (this.KeyStartsWith(key, "LooseSprites\\Fence")) { return(this.ReloadFenceTextures(key)); } // dynamic data if (this.IsInFolder(key, "Characters\\Dialogue")) { return(this.ReloadNpcDialogue(key)); } if (this.IsInFolder(key, "Characters\\schedules")) { return(this.ReloadNpcSchedules(key)); } return(false); }