intermedia

This commit is contained in:
polten0 2024-08-15 21:47:35 +03:00
parent 24332f240b
commit 90fe705ee9
4 changed files with 36 additions and 1 deletions

View file

@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
public int TileHeight { get; set; }
public int TileWidth { get; set; }
public List<TileSetInfo> TileSets { get; set; }
public List<Layer> Layers { get; set; }
}
}

View file

@ -19,5 +19,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
public int TileHeight { get; set; }
public int TileWidth { get; set; }
public int Columns { get; set; }
public int FirstGid { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.MapManager.MapElements
{
public class TileSetInfo
{
public int FirstGid { get; set; }
public string Source { get; set; }
}
}

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
@ -26,8 +27,26 @@ namespace ZoFo.GameCore.GameManagers.MapManager
List<TileSet> tileSets = new List<TileSet>();
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
{
tileSets.Add(LoadTileSet(tileSetInfo.Source));
TileSet tileSet = LoadTileSet(tileSetInfo.Source);
tileSet.FirstGid = tileSetInfo.FirstGid;
tileSets.Add(tileSet);
}
foreach (var chunk in tileMap.Layers[0].Chunks)
{
foreach (var id in chunk.Data)
{
for (int i = 0; i < tileSets.Count; i++)
{
if (tileSets[i].FirstGid - id < 0)
{
int number = id - tileSets[i].FirstGid;
}
}
}
}
}
private TileSet LoadTileSet(string path)