Exemplo n.º 1
0
 public DrawTile(CanvasInformation canvas, int x, int y, JsonTileMap jsonMap)
     : base(x, y, jsonMap)
 {
     var imageData = canvas.Context.GetImageData(x, y, jsonMap.TileWidth, jsonMap.TileHeight);
     var data = CanvasInformation.Create(imageData);
     Image = data;
 }
Exemplo n.º 2
0
        public Tile(int x, int y, JsonTileMap jsonMap)
        {
            this.jsonMap = jsonMap;
            TileMapX = x;
            TileMapY = y;

            Collision = RandomCollision();
        }
Exemplo n.º 3
0
        public void LoadTiles(JsonTileMap jsonTileMap, Completed completed)
        {
            int height = jsonTileMap.MapHeight * jsonTileMap.TileHeight;
            int width = jsonTileMap.MapWidth * jsonTileMap.TileWidth;

            for (int x = 0; x < width; x += jsonTileMap.TileWidth) {
                for (int y = 0; y < height; y += jsonTileMap.TileHeight) {
                    //load just the xy width*height of the canvas into a tile object for caching mostly.
                    var tile = new Tile(x, y, jsonTileMap);
                    //store each tile in a hash of name-x-y
                    loadedTiles[tile.Key] = tile;
                }
            }
            completed();
        }
        public void LoadTiles(JsonTileMap jsonTileMap, ImageElement tileImage, Completed completed)
        {
            var canvas = CanvasInformation.Create(tileImage);

            int height = jsonTileMap.MapHeight * jsonTileMap.TileHeight;
            int width = jsonTileMap.MapWidth * jsonTileMap.TileWidth;

            for (int x = 0; x < width; x += jsonTileMap.TileWidth) {
                for (int y = 0; y < height; y += jsonTileMap.TileHeight) {
                    //load just the xy width*height of the canvas into a tile object for caching mostly.
                    var tile = new DrawTile(canvas, x, y, jsonTileMap);
                    //store each tile in a hash of name-x-y
                    loadedTiles[tile.Key] = tile;
                }
            }
            completed();
        }
 public void LoadTiles(JsonTileMap jsonTileMap, Completed completed)
 {
     CHelp.LoadImageFromUrl(jsonTileMap.TileMapURL,
                            (image) => { ( (DrawTileManager) TileManager ).LoadTiles(jsonTileMap, image, completed); });
 }
 public void LoadTiles(JsonTileMap jsonTileMap, Completed completed)
 {
     TileManager.LoadTiles(jsonTileMap, completed);
 }