add initial implementation of LDtk importer with data models and scene builder
This commit is contained in:
30
addons/csharp_ldtk_importer/Models/LdtkData.cs
Normal file
30
addons/csharp_ldtk_importer/Models/LdtkData.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CSharpLdtkImporter.Models;
|
||||
|
||||
public class LdtkData
|
||||
{
|
||||
[JsonPropertyName("levels")]
|
||||
public LdtkLevel[] Levels { get; set; }
|
||||
|
||||
[JsonPropertyName("defs")]
|
||||
public LdtkDefinitions Defs { get; set; }
|
||||
}
|
||||
|
||||
public class LdtkDefinitions
|
||||
{
|
||||
[JsonPropertyName("tilesets")]
|
||||
public LdtkTilesetDef[] Tilesets { get; set; }
|
||||
}
|
||||
|
||||
public class LdtkTilesetDef
|
||||
{
|
||||
[JsonPropertyName("uid")]
|
||||
public int Uid { get; set; }
|
||||
|
||||
[JsonPropertyName("relPath")]
|
||||
public string RelPath { get; set; }
|
||||
|
||||
[JsonPropertyName("tileGridSize")]
|
||||
public int TileGridSize { get; set; }
|
||||
}
|
1
addons/csharp_ldtk_importer/Models/LdtkData.cs.uid
Normal file
1
addons/csharp_ldtk_importer/Models/LdtkData.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://8f7a424k36sb
|
12
addons/csharp_ldtk_importer/Models/LdtkEntityInstance.cs
Normal file
12
addons/csharp_ldtk_importer/Models/LdtkEntityInstance.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CSharpLdtkImporter.Models;
|
||||
|
||||
public class LdtkEntityInstance
|
||||
{
|
||||
[JsonPropertyName("__identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[JsonPropertyName("px")]
|
||||
public int[] Px { get; set; }
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://ck2tr052fmrx2
|
27
addons/csharp_ldtk_importer/Models/LdtkLayerInstance.cs
Normal file
27
addons/csharp_ldtk_importer/Models/LdtkLayerInstance.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CSharpLdtkImporter.Models;
|
||||
|
||||
public class LdtkLayerInstance
|
||||
{
|
||||
[JsonPropertyName("__identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[JsonPropertyName("__type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonPropertyName("__gridSize")]
|
||||
public int GridSize { get; set; }
|
||||
|
||||
[JsonPropertyName("__tilesetDefUid")]
|
||||
public int? TilesetDefUid { get; set; } // Nullable for entity layers
|
||||
|
||||
[JsonPropertyName("gridTiles")]
|
||||
public LdtkTileInstance[] GridTiles { get; set; }
|
||||
|
||||
[JsonPropertyName("autoLayerTiles")]
|
||||
public LdtkTileInstance[] AutoLayerTiles { get; set; }
|
||||
|
||||
[JsonPropertyName("entityInstances")]
|
||||
public LdtkEntityInstance[] EntityInstances { get; set; }
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://crre3v7sfnqq6
|
12
addons/csharp_ldtk_importer/Models/LdtkLevel.cs
Normal file
12
addons/csharp_ldtk_importer/Models/LdtkLevel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CSharpLdtkImporter.Models;
|
||||
|
||||
public class LdtkLevel
|
||||
{
|
||||
[JsonPropertyName("identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[JsonPropertyName("layerInstances")]
|
||||
public LdtkLayerInstance[] LayerInstances { get; set; }
|
||||
}
|
1
addons/csharp_ldtk_importer/Models/LdtkLevel.cs.uid
Normal file
1
addons/csharp_ldtk_importer/Models/LdtkLevel.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c5kc2tyb2kf1e
|
18
addons/csharp_ldtk_importer/Models/LdtkTileInstance.cs
Normal file
18
addons/csharp_ldtk_importer/Models/LdtkTileInstance.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CSharpLdtkImporter.Models;
|
||||
|
||||
public class LdtkTileInstance
|
||||
{
|
||||
// Pixel coordinates [x,y]
|
||||
[JsonPropertyName("px")]
|
||||
public int[] Px { get; set; }
|
||||
|
||||
// Tile ID in the tileset
|
||||
[JsonPropertyName("t")]
|
||||
public int TileId { get; set; }
|
||||
|
||||
// Flip bits (0=none, 1=X, 2=Y, 3=X&Y)
|
||||
[JsonPropertyName("f")]
|
||||
public int FlipBits { get; set; }
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://dal7woqq2nlrd
|
Reference in New Issue
Block a user