public bool reloadMapContent(string folder) { try { if (this.TextureSequences == null) this.TextureSequences = new List<TileSequence>(); if (this.ObjectSequences == null) this.ObjectSequences = new List<TileSequence>(); if (this.TileEvents == null) this.TileEvents = new List<TileEvent>(); this.UpdateTileMapGraphicsContent(); //Creer le tableau a 2D des tiles this.TabTiles = new Tile[this.NbLines, this.NbColumns]; JSONTileMap jsonMap = new JSONTileMap(); jsonMap.deserialize(folder, this); jsonMap = null; for (int i = 0; i < this.NbLines; i++) { for (int j = 0; j < this.NbColumns; j++) { Tile tile = new Tile(i, j, this.TilesWidth, this.TilesHeight, true, this) ; int indexTileInTab = i * this.NbColumns + j; if (this.textureContent != null) { int indexTexture = this.textureContent[indexTileInTab]; if (indexTexture > -1 && this.TileModelsTextureUsed.Count > indexTexture) { tile.setTexture(this.TileModelsTextureUsed[indexTexture]); } } if (this.objectContent != null) { int indexObject = this.objectContent[indexTileInTab]; if (indexObject > -1 && this.TileModelsObjectsUsed.Count > indexObject) tile.setObjectImage(this.TileModelsObjectsUsed[indexObject]); } if (this.textureSequenceContent != null) { int indexSequenceTexture = this.textureSequenceContent[indexTileInTab]; if (indexSequenceTexture > -1 && this.TextureSequences.Count > indexSequenceTexture) tile.setTextureSequence(this.TextureSequences[indexSequenceTexture]); } if (this.objectSequenceContent != null) { int indexSequenceObject = this.objectSequenceContent[indexTileInTab]; if (indexSequenceObject > -1 && this.ObjectSequences.Count > indexSequenceObject) tile.setObjectSequence(this.ObjectSequences[indexSequenceObject]); } if (this.collisionContent != null) { int collide = this.collisionContent[indexTileInTab]; if (collide == 0) tile.IsCrossable = true; else tile.IsCrossable = false; } if (this.eventContent != null) { int indexEvent = this.eventContent[indexTileInTab]; if (indexEvent > -1 && this.TileEvents.Count > indexEvent) tile.setEvent(this.TileEvents[indexEvent]); } this.TabTiles[i, j] = tile; } } return true; } catch(Exception ex) { return false; } }