Ejemplo n.º 1
0
        internal static void ApplyLocation(Location location)
        {
            AdvancedLocationLoaderMod.Logger.Log(location.ToString(), LogLevel.Trace);
            try
            {
                GameLocation loc;
                ContentRegistry.RegisterXnb(location.FileName, location.FileName);
                xTile.Map map = Game1.content.Load <xTile.Map>(location.FileName);
                switch (location.Type)
                {
                case "Cellar":
                    loc         = new StardewValley.Locations.Cellar(map, location.MapName);
                    loc.objects = new SerializableDictionary <Microsoft.Xna.Framework.Vector2, StardewValley.Object>();
                    break;

                case "BathHousePool":
                    loc = new StardewValley.Locations.BathHousePool(map, location.MapName);
                    break;

                case "Decoratable":
                    loc = new Locations.DecoratableLocation(map, location.MapName);
                    break;

                case "Desert":
                    loc = new Locations.Desert(map, location.MapName);
                    break;

                case "Greenhouse":
                    loc = new Locations.Greenhouse(map, location.MapName);
                    break;

                case "Sewer":
                    loc = new Locations.Sewer(map, location.MapName);
                    break;

                default:
                    loc = new GameLocation(map, location.MapName);
                    break;
                }
                loc.isOutdoors = location.Outdoor;
                loc.isFarm     = location.Farmable;
                Game1.locations.Add(loc);
            }
            catch (Exception err)
            {
                AdvancedLocationLoaderMod.Logger.ExitGameImmediately("Unable to add custom location, a unexpected error occured: " + location.ToString(), err);
            }
        }
Ejemplo n.º 2
0
        internal static void ApplyLocation(IContentPack contentPack, Location location)
        {
            try
            {
                GameLocation loc;
                xTile.Map    map = contentPack.LoadAsset <xTile.Map>(location.FileName);
                switch (location.Type)
                {
                case "Cellar":
                    loc = new StardewValley.Locations.Cellar(map, location.MapName)
                    {
                        objects = new SerializableDictionary <Microsoft.Xna.Framework.Vector2, StardewValley.Object>()
                    };
                    break;

                case "BathHousePool":
                    loc = new StardewValley.Locations.BathHousePool(map, location.MapName);
                    break;

                case "Decoratable":
                    loc = new Locations.DecoratableLocation(map, location.MapName);
                    break;

                case "Desert":
                    loc = new Locations.Desert(map, location.MapName);
                    break;

                case "Greenhouse":
                    loc = new Locations.Greenhouse(map, location.MapName);
                    break;

                case "Sewer":
                    loc = new Locations.Sewer(map, location.MapName);
                    break;

                default:
                    loc = new GameLocation(map, location.MapName);
                    break;
                }
                loc.isOutdoors = location.Outdoor;
                loc.isFarm     = location.Farmable;
                Game1.locations.Add(loc);
            }
            catch (Exception err)
            {
                ModEntry.Logger.ExitGameImmediately("Unable to add custom location, a unexpected error occured: " + location, err);
            }
        }
Ejemplo n.º 3
0
        public static void ApplyLocation(IContentPack contentPack, Configs.Location location)
        {
            try
            {
                GameLocation loc;
                string       mapPath = contentPack.GetActualAssetKey(location.FileName);
                switch (location.Type)
                {
                case "Cellar":
                    loc = new Cellar(mapPath, location.MapName);
                    break;

                case "BathHousePool":
                    loc = new BathHousePool(mapPath, location.MapName);
                    break;

                case "Decoratable":
                    loc = new Locations.DecoratableLocation(mapPath, location.MapName);
                    break;

                case "Desert":
                    loc = new Locations.Desert(mapPath, location.MapName);
                    break;

                case "Greenhouse":
                    loc = new Greenhouse(mapPath, location.MapName);
                    break;

                case "Sewer":
                    loc = new Locations.Sewer(mapPath, location.MapName);
                    break;

                default:
                    loc = new GameLocation(mapPath, location.MapName);
                    break;
                }

                loc.IsOutdoors = location.Outdoor;
                loc.IsFarm     = location.Farmable;
                Game1.locations.Add(loc);
            }
            catch (Exception err)
            {
                ModEntry.Logger.ExitGameImmediately("Unable to add custom location, a unexpected error occured: " + location, err);
            }
        }