Ejemplo n.º 1
0
 /// <summary>
 /// Populates the <see cref="AllTiles"/>
 /// </summary>
 private void InitlializeTiles()
 {
     AllTiles.Clear();
     for (int i = 0; i < Rows; i++)
     {
         for (int j = 0; j < Columns; j++)
         {
             AllTiles.Add(new Tile()
             {
                 Row    = i,
                 Column = j,
                 State  = TileState.Covered
             });
         }
     }
 }
Ejemplo n.º 2
0
 public void CreateAllTiles()
 {
     foreach (Tile t in Tiles)
     {
         Tile tmp = t;
         AllTiles.Add(tmp);
         AllTiles.Add(tmp.FlipLeftRight());
         AllTiles.Add(tmp.FlipTopDown());
         for (int i = 0; i < 3; i++)
         {
             tmp = tmp.RotateRight();
             AllTiles.Add(tmp);
             if (i == 0)
             {
                 AllTiles.Add(tmp.FlipLeftRight());
                 AllTiles.Add(tmp.FlipTopDown());
             }
         }
     }
 }
Ejemplo n.º 3
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("База ресурсов не содержит информации от тайлах.");
            }
        }