Esempio n. 1
0
		static object LoadOptions(MiniYaml y)
		{
			var options = new MapOptions();
			var nodesDict = y.ToDictionary();
			if (nodesDict.ContainsKey("Options"))
				FieldLoader.Load(options, nodesDict["Options"]);

			return options;
		}
Esempio n. 2
0
        static object LoadOptions(MiniYaml y)
        {
            var options = new MapOptions();

            if (y.NodesDict.ContainsKey("Options"))
            {
                FieldLoader.Load(options, y.NodesDict["Options"]);
            }

            return(options);
        }
Esempio n. 3
0
        static object LoadOptions(MiniYaml y)
        {
            var options   = new MapOptions();
            var nodesDict = y.ToDictionary();

            if (nodesDict.ContainsKey("Options"))
            {
                FieldLoader.Load(options, nodesDict["Options"]);
            }

            return(options);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new map created by the editor or importer.
        /// The map will not recieve a valid UID until after it has been saved and reloaded.
        /// </summary>
        public Map(TileSet tileset, int width, int height)
        {
            var size = new Size(width, height);

            Grid = Game.ModData.Manifest.Get <MapGrid>();
            var tileRef = new TerrainTile(tileset.Templates.First().Key, (byte)0);

            Title       = "Name your map here";
            Description = "Describe your map here";
            Author      = "Your name here";

            MapSize = new int2(size);
            Tileset = tileset.Id;
            Videos  = new MapVideos();
            Options = new MapOptions();

            MapResources = Exts.Lazy(() => new CellLayer <ResourceTile>(Grid.Type, size));

            MapTiles = Exts.Lazy(() =>
            {
                var ret = new CellLayer <TerrainTile>(Grid.Type, size);
                ret.Clear(tileRef);
                if (Grid.MaximumTerrainHeight > 0)
                {
                    ret.CellEntryChanged += UpdateProjection;
                }
                return(ret);
            });

            MapHeight = Exts.Lazy(() =>
            {
                var ret = new CellLayer <byte>(Grid.Type, size);
                ret.Clear(0);
                if (Grid.MaximumTerrainHeight > 0)
                {
                    ret.CellEntryChanged += UpdateProjection;
                }
                return(ret);
            });

            SpawnPoints = Exts.Lazy(() => new CPos[0]);

            PostInit();
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new map created by the editor or importer.
        /// The map will not recieve a valid UID until after it has been saved and reloaded.
        /// </summary>
        public Map(TileSet tileset, int width, int height)
        {
            containsTest = Contains;

            var size      = new Size(width, height);
            var tileShape = Game.ModData.Manifest.TileShape;
            var tileRef   = new TerrainTile(tileset.Templates.First().Key, (byte)0);

            Title       = "Name your map here";
            Description = "Describe your map here";
            Author      = "Your name here";

            MapSize = new int2(size);
            Tileset = tileset.Id;
            Videos  = new MapVideos();
            Options = new MapOptions();

            MapResources = Exts.Lazy(() => new CellLayer <ResourceTile>(tileShape, size));

            MapTiles = Exts.Lazy(() =>
            {
                var ret = new CellLayer <TerrainTile>(tileShape, size);
                ret.Clear(tileRef);
                return(ret);
            });

            MapHeight = Exts.Lazy(() =>
            {
                var ret = new CellLayer <byte>(tileShape, size);
                ret.Clear(0);
                return(ret);
            });

            SpawnPoints          = Exts.Lazy(() => new CPos[0]);
            TileShape            = tileShape;
            MaximumTerrainHeight = Game.ModData.Manifest.MaximumTerrainHeight;

            PostInit();
        }
Esempio n. 6
0
        static object LoadOptions(MiniYaml y)
        {
            var options = new MapOptions();
            if (y.NodesDict.ContainsKey("Options"))
                FieldLoader.Load(options, y.NodesDict["Options"]);

            return options;
        }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new map created by the editor or importer.
        /// The map will not recieve a valid UID until after it has been saved and reloaded.
        /// </summary>
        public Map(TileSet tileset, int width, int height)
        {
            var size = new Size(width, height);
            var tileShape = Game.ModData.Manifest.TileShape;
            var tileRef = new TerrainTile(tileset.Templates.First().Key, (byte)0);

            Title = "Name your map here";
            Description = "Describe your map here";
            Author = "Your name here";

            MapSize = new int2(size);
            Tileset = tileset.Id;
            Videos = new MapVideos();
            Options = new MapOptions();

            MapResources = Exts.Lazy(() => new CellLayer<ResourceTile>(tileShape, size));

            MapTiles = Exts.Lazy(() =>
            {
                var ret = new CellLayer<TerrainTile>(tileShape, size);
                ret.Clear(tileRef);
                return ret;
            });

            MapHeight = Exts.Lazy(() =>
            {
                var ret = new CellLayer<byte>(tileShape, size);
                ret.Clear(0);
                return ret;
            });

            SpawnPoints = Exts.Lazy(() => new CPos[0]);
            TileShape = tileShape;
            MaximumTerrainHeight = Game.ModData.Manifest.MaximumTerrainHeight;

            PostInit();
        }