mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-09 04:36:04 +03:00
Getting further with the json support
This commit is contained in:
parent
5626614acd
commit
1168917c23
38 changed files with 1072 additions and 269 deletions
|
@ -0,0 +1,30 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"compression":"gzip",
|
||||
"data":"H4sIAAAAAAAACmNgoD0AAMrGiJlkAAAA",
|
||||
"encoding":"base64",
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="base64" compression="gzip">
|
||||
H4sIAAAAAAAACmNgoD0AAMrGiJlkAAAA
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
|
@ -0,0 +1,30 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"compression":"zlib",
|
||||
"data":"eJxjYKA9AAAAZAAB",
|
||||
"encoding":"base64",
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYKA9AAAAZAAB
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
|
@ -0,0 +1,30 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"compression":"",
|
||||
"data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"encoding":"base64",
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="base64">
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
32
DotTiled.Tests/Serialization/TestData/Map/empty-map-csv.tmj
Normal file
32
DotTiled.Tests/Serialization/TestData/Map/empty-map-csv.tmj
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
12
DotTiled.Tests/Serialization/TestData/Map/empty-map-csv.tmx
Normal file
12
DotTiled.Tests/Serialization/TestData/Map/empty-map-csv.tmx
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
|
@ -0,0 +1,56 @@
|
|||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map EmptyMapWithProperties() => new Map
|
||||
{
|
||||
Version = "1.10",
|
||||
TiledVersion = "1.11.0",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
RenderOrder = RenderOrder.RightDown,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
Infinite = false,
|
||||
NextLayerID = 2,
|
||||
NextObjectID = 1,
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
GlobalTileIDs = [
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["MapBool"] = new BoolProperty { Name = "MapBool", Value = true },
|
||||
["MapColor"] = new ColorProperty { Name = "MapColor", Value = new Color { R = 255, G = 0, B = 0, A = 255 } },
|
||||
["MapFile"] = new FileProperty { Name = "MapFile", Value = "file.png" },
|
||||
["MapFloat"] = new FloatProperty { Name = "MapFloat", Value = 5.2f },
|
||||
["MapInt"] = new IntProperty { Name = "MapInt", Value = 42 },
|
||||
["MapObject"] = new ObjectProperty { Name = "MapObject", Value = 5 },
|
||||
["MapString"] = new StringProperty { Name = "MapString", Value = "string in map" }
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"properties":[
|
||||
{
|
||||
"name":"MapBool",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"MapColor",
|
||||
"type":"color",
|
||||
"value":"#ffff0000"
|
||||
},
|
||||
{
|
||||
"name":"MapFile",
|
||||
"type":"file",
|
||||
"value":"file.png"
|
||||
},
|
||||
{
|
||||
"name":"MapFloat",
|
||||
"type":"float",
|
||||
"value":5.2
|
||||
},
|
||||
{
|
||||
"name":"MapInt",
|
||||
"type":"int",
|
||||
"value":42
|
||||
},
|
||||
|
||||
{
|
||||
"name":"MapObject",
|
||||
"type":"object",
|
||||
"value":5
|
||||
},
|
||||
{
|
||||
"name":"MapString",
|
||||
"type":"string",
|
||||
"value":"string in map"
|
||||
}],
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<properties>
|
||||
<property name="MapBool" type="bool" value="true"/>
|
||||
<property name="MapColor" type="color" value="#ffff0000"/>
|
||||
<property name="MapFile" type="file" value="file.png"/>
|
||||
<property name="MapFloat" type="float" value="5.2"/>
|
||||
<property name="MapInt" type="int" value="42"/>
|
||||
<property name="MapObject" type="object" value="5"/>
|
||||
<property name="MapString" value="string in map"/>
|
||||
</properties>
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
47
DotTiled.Tests/Serialization/TestData/Map/empty-map.cs
Normal file
47
DotTiled.Tests/Serialization/TestData/Map/empty-map.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map EmptyMapWithEncodingAndCompression(DataEncoding dataEncoding, DataCompression? compression) => new Map
|
||||
{
|
||||
Version = "1.10",
|
||||
TiledVersion = "1.11.0",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
RenderOrder = RenderOrder.RightDown,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
Infinite = false,
|
||||
NextLayerID = 2,
|
||||
NextObjectID = 1,
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = dataEncoding,
|
||||
Compression = compression,
|
||||
GlobalTileIDs = [
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
94
DotTiled.Tests/Serialization/TestData/Map/map-with-group.cs
Normal file
94
DotTiled.Tests/Serialization/TestData/Map/map-with-group.cs
Normal file
|
@ -0,0 +1,94 @@
|
|||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map MapWithGroup() => new Map
|
||||
{
|
||||
Version = "1.10",
|
||||
TiledVersion = "1.11.0",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
RenderOrder = RenderOrder.RightDown,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
Infinite = false,
|
||||
NextLayerID = 5,
|
||||
NextObjectID = 2,
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 4,
|
||||
Name = "Tile Layer 2",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
GlobalTileIDs = [
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
}
|
||||
},
|
||||
new Group
|
||||
{
|
||||
ID = 3,
|
||||
Name = "Group 1",
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
GlobalTileIDs = [
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
}
|
||||
},
|
||||
new ObjectLayer
|
||||
{
|
||||
ID = 2,
|
||||
Name = "Object Layer 1",
|
||||
Objects = [
|
||||
new RectangleObject
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Name",
|
||||
X = 35.5f,
|
||||
Y = 26,
|
||||
Width = 64.5f,
|
||||
Height = 64.5f,
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
80
DotTiled.Tests/Serialization/TestData/Map/map-with-group.tmj
Normal file
80
DotTiled.Tests/Serialization/TestData/Map/map-with-group.tmj
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"height":5,
|
||||
"id":4,
|
||||
"name":"Tile Layer 2",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"id":3,
|
||||
"layers":[
|
||||
{
|
||||
"data":[0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"draworder":"topdown",
|
||||
"id":2,
|
||||
"name":"Object Layer 1",
|
||||
"objects":[
|
||||
{
|
||||
"height":64.5,
|
||||
"id":1,
|
||||
"name":"Name",
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":64.5,
|
||||
"x":35.5,
|
||||
"y":26
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
"visible":true,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"name":"Group 1",
|
||||
"opacity":1,
|
||||
"type":"group",
|
||||
"visible":true,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":5,
|
||||
"nextobjectid":2,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
26
DotTiled.Tests/Serialization/TestData/Map/map-with-group.tmx
Normal file
26
DotTiled.Tests/Serialization/TestData/Map/map-with-group.tmx
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="5" nextobjectid="2">
|
||||
<layer id="4" name="Tile Layer 2" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<group id="3" name="Group 1">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="2" name="Object Layer 1">
|
||||
<object id="1" name="Name" x="35.5" y="26" width="64.5" height="64.5"/>
|
||||
</objectgroup>
|
||||
</group>
|
||||
</map>
|
|
@ -0,0 +1,125 @@
|
|||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map MapWithObjectTemplate() => new Map
|
||||
{
|
||||
Version = "1.10",
|
||||
TiledVersion = "1.11.0",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
RenderOrder = RenderOrder.RightDown,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
Infinite = false,
|
||||
NextLayerID = 3,
|
||||
NextObjectID = 3,
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
GlobalTileIDs = [
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
}
|
||||
},
|
||||
new ObjectLayer
|
||||
{
|
||||
ID = 2,
|
||||
Name = "Object Layer 1",
|
||||
Objects = [
|
||||
new RectangleObject
|
||||
{
|
||||
ID = 1,
|
||||
Template = "map-with-object-template.tx",
|
||||
Name = "Thingy 2",
|
||||
X = 94.5749f,
|
||||
Y = 33.6842f,
|
||||
Width = 37.0156f,
|
||||
Height = 37.0156f,
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Bool"] = new BoolProperty { Name = "Bool", Value = true },
|
||||
["TestClassInTemplate"] = new ClassProperty
|
||||
{
|
||||
Name = "TestClassInTemplate",
|
||||
PropertyType = "TestClass",
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Amount"] = new FloatProperty { Name = "Amount", Value = 37 },
|
||||
["Name"] = new StringProperty { Name = "Name", Value = "I am here" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new RectangleObject
|
||||
{
|
||||
ID = 2,
|
||||
Template = "map-with-object-template.tx",
|
||||
Name = "Thingy",
|
||||
X = 29.7976f,
|
||||
Y = 33.8693f,
|
||||
Width = 37.0156f,
|
||||
Height = 37.0156f,
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Bool"] = new BoolProperty { Name = "Bool", Value = true },
|
||||
["TestClassInTemplate"] = new ClassProperty
|
||||
{
|
||||
Name = "TestClassInTemplate",
|
||||
PropertyType = "TestClass",
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Amount"] = new FloatProperty { Name = "Amount", Value = 4.2f },
|
||||
["Name"] = new StringProperty { Name = "Name", Value = "Hello there" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new RectangleObject
|
||||
{
|
||||
ID = 3,
|
||||
Template = "map-with-object-template.tx",
|
||||
Name = "Thingy 3",
|
||||
X = 5,
|
||||
Y = 5,
|
||||
Width = 37.0156f,
|
||||
Height = 37.0156f,
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Bool"] = new BoolProperty { Name = "Bool", Value = true },
|
||||
["TestClassInTemplate"] = new ClassProperty
|
||||
{
|
||||
Name = "TestClassInTemplate",
|
||||
PropertyType = "TestClass",
|
||||
Properties = new Dictionary<string, IProperty>
|
||||
{
|
||||
["Amount"] = new FloatProperty { Name = "Amount", Value = 4.2f },
|
||||
["Name"] = new StringProperty { Name = "Name", Value = "I am here 3" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"draworder":"topdown",
|
||||
"id":2,
|
||||
"name":"Object Layer 1",
|
||||
"objects":[
|
||||
{
|
||||
"height":37.0156,
|
||||
"id":1,
|
||||
"template":"map-with-object-template.tj",
|
||||
"name":"Thingy 2",
|
||||
"properties":[
|
||||
{
|
||||
"name":"Bool",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"TestClassInTemplate",
|
||||
"propertytype":"TestClass",
|
||||
"type":"class",
|
||||
"value":
|
||||
{
|
||||
"Amount":37,
|
||||
"Name":"I am here"
|
||||
}
|
||||
}],
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":37.0156,
|
||||
"x":94.5749,
|
||||
"y":33.6842
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"template":"map-with-object-template.tj",
|
||||
"x":29.7976,
|
||||
"y":33.8693
|
||||
},
|
||||
{
|
||||
"height":37.0156,
|
||||
"id":3,
|
||||
"template":"map-with-object-template.tj",
|
||||
"name":"Thingy 3",
|
||||
"properties":[
|
||||
{
|
||||
"name":"Bool",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"TestClassInTemplate",
|
||||
"propertytype":"TestClass",
|
||||
"type":"class",
|
||||
"value":
|
||||
{
|
||||
"Name":"I am here 3"
|
||||
}
|
||||
}],
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":37.0156,
|
||||
"x":5,
|
||||
"y":5
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
"visible":true,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":3,
|
||||
"nextobjectid":3,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="3" nextobjectid="3">
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="2" name="Object Layer 1">
|
||||
<object id="1" template="map-with-object-template.tx" name="Thingy 2" x="94.5749" y="33.6842">
|
||||
<properties>
|
||||
<property name="Bool" type="bool" value="true"/>
|
||||
<property name="TestClassInTemplate" type="class" propertytype="TestClass">
|
||||
<properties>
|
||||
<property name="Amount" type="float" value="37"/>
|
||||
<property name="Name" value="I am here"/>
|
||||
</properties>
|
||||
</property>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="2" template="map-with-object-template.tx" x="29.7976" y="33.8693"/>
|
||||
<object id="3" template="map-with-object-template.tx" name="Thingy 3" x="5" y="5">
|
||||
<properties>
|
||||
<property name="TestClassInTemplate" type="class" propertytype="TestClass">
|
||||
<properties>
|
||||
<property name="Name" value="I am here 3"/>
|
||||
</properties>
|
||||
</property>
|
||||
</properties>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
|
@ -0,0 +1,65 @@
|
|||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map SimpleMapWithEmbeddedTileset() => new Map
|
||||
{
|
||||
Version = "1.10",
|
||||
TiledVersion = "1.11.0",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
RenderOrder = RenderOrder.RightDown,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
Infinite = false,
|
||||
NextLayerID = 2,
|
||||
NextObjectID = 1,
|
||||
Tilesets = [
|
||||
new Tileset
|
||||
{
|
||||
FirstGID = 1,
|
||||
Name = "Tileset 1",
|
||||
TileWidth = 32,
|
||||
TileHeight = 32,
|
||||
TileCount = 8,
|
||||
Columns = 4,
|
||||
Image = new Image
|
||||
{
|
||||
Format = ImageFormat.Png,
|
||||
Source = "tiles.png",
|
||||
Width = 128,
|
||||
Height = 64
|
||||
}
|
||||
}
|
||||
],
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
Compression = null,
|
||||
GlobalTileIDs = [
|
||||
1,1,1,1,1,
|
||||
1,1,1,1,1,
|
||||
1,1,1,1,1,
|
||||
2,2,2,2,2,
|
||||
2,2,2,2,2
|
||||
],
|
||||
FlippingFlags = [
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2],
|
||||
"height":5,
|
||||
"id":1,
|
||||
"name":"Tile Layer 1",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":5,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[
|
||||
{
|
||||
"columns":4,
|
||||
"firstgid":1,
|
||||
"image":"tiles.png",
|
||||
"imageheight":64,
|
||||
"imagewidth":128,
|
||||
"margin":0,
|
||||
"name":"Tileset 1",
|
||||
"spacing":0,
|
||||
"tilecount":8,
|
||||
"tileheight":32,
|
||||
"tilewidth":32
|
||||
}],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.10",
|
||||
"width":5
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" name="Tileset 1" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
||||
<image source="tiles.png" width="128" height="64"/>
|
||||
</tileset>
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
1,1,1,1,1,
|
||||
1,1,1,1,1,
|
||||
1,1,1,1,1,
|
||||
2,2,2,2,2,
|
||||
2,2,2,2,2
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
|
@ -0,0 +1,28 @@
|
|||
{ "object":
|
||||
{
|
||||
"height":37.0156,
|
||||
"id":2,
|
||||
"name":"Thingy",
|
||||
"properties":[
|
||||
{
|
||||
"name":"Bool",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"TestClassInTemplate",
|
||||
"propertytype":"TestClass",
|
||||
"type":"class",
|
||||
"value":
|
||||
{
|
||||
"Amount":4.2,
|
||||
"Name":"Hello there"
|
||||
}
|
||||
}],
|
||||
"rotation":0,
|
||||
"type":"",
|
||||
"visible":true,
|
||||
"width":37.0156
|
||||
},
|
||||
"type":"template"
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
<object name="Thingy" width="37.0156" height="37.0156">
|
||||
<properties>
|
||||
<property name="Bool" type="bool" value="true"/>
|
||||
<property name="TestClassInTemplate" type="class" propertytype="TestClass">
|
||||
<properties>
|
||||
<property name="Amount" type="float" value="4.2"/>
|
||||
<property name="Name" value="Hello there"/>
|
||||
</properties>
|
||||
</property>
|
||||
</properties>
|
||||
</object>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue