Exemplo n.º 1
0
		public static void Init(IResourceProvider _resourceProvider, IDrawHelper _drawHelper)
		{
			Rp = _resourceProvider;
			DrawHelper = _drawHelper;

            Rp.RegisterFont(EFonts.COMMON, Constants.RESOURCES_FONT_FILE, 12);
            Rp.RegisterFont(EFonts.SMALL, Constants.RESOURCES_FONT_FILE, 8);

            AllTiles.Add(ETileset.NONE, new TileSet(Rp.CreateTile(0,0,FColor.Empty)));

			if (Constants.GAME_MODE && World.XResourceRoot.TileSets.Count > 0)
			{
				foreach (var xTileSet in World.XResourceRoot.TileSets)
				{
					var set = new TileSet();
					AllTiles.Add(xTileSet.Tileset, set);
					var array = xTileSet.Children.OrderBy(_info => _info.Order).ToArray();
					for (var index = 0; index < array.Length; index++)
					{
						var tileInfo = array[index];
						var atile = Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor());
						TileSetInfoProvider.SetOpacity(xTileSet.Tileset, index, tileInfo.Opacity);
						set.AddTile(atile);
					}
				}
				foreach (var xTileSet in World.XResourceRoot.TerrainSets)
				{
					var set = new TileSet();
					AllTerrainTilesets.Add(xTileSet.Terrains, set);
					foreach (var tileInfo in xTileSet.Children.OrderBy(_info => _info.Order))
					{
						set.AddTile(Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor()));
					}
				}
			}
			else
			{
                throw new ApplicationException("База ресурсов не содержит информации от тайлах.");
            }
		}
Exemplo n.º 2
0
        public static void Init(IResourceProvider _resourceProvider, IDrawHelper _drawHelper)
        {
            Rp         = _resourceProvider;
            DrawHelper = _drawHelper;

            Rp.RegisterFont(EFonts.COMMON, Constants.RESOURCES_FONT_FILE, 12);
            Rp.RegisterFont(EFonts.SMALL, Constants.RESOURCES_FONT_FILE, 8);

            AllTiles.Add(ETileset.NONE, new TileSet(Rp.CreateTile(0, 0, FColor.Empty)));

            if (Constants.GAME_MODE && World.XResourceRoot.TileSets.Count > 0)
            {
                foreach (var xTileSet in World.XResourceRoot.TileSets)
                {
                    var set = new TileSet();
                    AllTiles.Add(xTileSet.Tileset, set);
                    var array = xTileSet.Children.OrderBy(_info => _info.Order).ToArray();
                    for (var index = 0; index < array.Length; index++)
                    {
                        var tileInfo = array[index];
                        var atile    = Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor());
                        TileSetInfoProvider.SetOpacity(xTileSet.Tileset, index, tileInfo.Opacity);
                        set.AddTile(atile);
                    }
                }
                foreach (var xTileSet in World.XResourceRoot.TerrainSets)
                {
                    var set = new TileSet();
                    AllTerrainTilesets.Add(xTileSet.Terrains, set);
                    foreach (var tileInfo in xTileSet.Children.OrderBy(_info => _info.Order))
                    {
                        set.AddTile(Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor()));
                    }
                }
            }
            else
            {
                throw new ApplicationException("База ресурсов не содержит информации от тайлах.");
            }
        }