mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-02-05 08:52:50 +02:00
Use folder structure namespaces
This commit is contained in:
parent
0a11cdd791
commit
e6d94247c1
90 changed files with 252 additions and 106 deletions
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
test:
|
||||
dotnet test
|
||||
dotnet test src/DotTiled.sln
|
||||
|
||||
BENCHMARK_SOURCES = DotTiled.Benchmark/Program.cs DotTiled.Benchmark/DotTiled.Benchmark.csproj
|
||||
BENCHMARK_OUTPUTDIR = DotTiled.Benchmark/BenchmarkDotNet.Artifacts
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Numerics;
|
||||
using DotTiled.Model;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
using DotTiled.Model.Layers.Objects;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
{
|
||||
internal static void AssertObject(Object expected, Object actual)
|
||||
internal static void AssertObject(Model.Layers.Objects.Object expected, Model.Layers.Objects.Object actual)
|
||||
{
|
||||
// Attributes
|
||||
AssertEqual(expected.ID, actual.ID, nameof(Object.ID));
|
||||
AssertEqual(expected.Name, actual.Name, nameof(Object.Name));
|
||||
AssertEqual(expected.Type, actual.Type, nameof(Object.Type));
|
||||
AssertEqual(expected.X, actual.X, nameof(Object.X));
|
||||
AssertEqual(expected.Y, actual.Y, nameof(Object.Y));
|
||||
AssertEqual(expected.Width, actual.Width, nameof(Object.Width));
|
||||
AssertEqual(expected.Height, actual.Height, nameof(Object.Height));
|
||||
AssertEqual(expected.Rotation, actual.Rotation, nameof(Object.Rotation));
|
||||
AssertEqual(expected.Visible, actual.Visible, nameof(Object.Visible));
|
||||
AssertEqual(expected.Template, actual.Template, nameof(Object.Template));
|
||||
AssertEqual(expected.ID, actual.ID, nameof(Model.Layers.Objects.Object.ID));
|
||||
AssertEqual(expected.Name, actual.Name, nameof(Model.Layers.Objects.Object.Name));
|
||||
AssertEqual(expected.Type, actual.Type, nameof(Model.Layers.Objects.Object.Type));
|
||||
AssertEqual(expected.X, actual.X, nameof(Model.Layers.Objects.Object.X));
|
||||
AssertEqual(expected.Y, actual.Y, nameof(Model.Layers.Objects.Object.Y));
|
||||
AssertEqual(expected.Width, actual.Width, nameof(Model.Layers.Objects.Object.Width));
|
||||
AssertEqual(expected.Height, actual.Height, nameof(Model.Layers.Objects.Object.Height));
|
||||
AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Layers.Objects.Object.Rotation));
|
||||
AssertEqual(expected.Visible, actual.Visible, nameof(Model.Layers.Objects.Object.Visible));
|
||||
AssertEqual(expected.Template, actual.Template, nameof(Model.Layers.Objects.Object.Template));
|
||||
|
||||
AssertProperties(expected.Properties, actual.Properties);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public static partial class DotTiledAssert
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Xml;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System.Globalization;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
using System.Numerics;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Layers.Objects;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
using DotTiled.Serialization.Tmj;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TmjMapReaderTests
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
using DotTiled.Serialization.Tmx;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model;
|
||||
|
||||
public class Color : IParsable<Color>, IEquatable<Color>
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public abstract class BaseLayer
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public enum DataEncoding
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public class Group : BaseLayer
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotTiled;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public class ImageLayer : BaseLayer
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Layers.Objects;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public enum DrawOrder
|
||||
{
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class EllipseObject : Object { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public abstract class Object
|
||||
{
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class PointObject : Object { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class PolygonObject : Object
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class PolylineObject : Object
|
||||
{
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class RectangleObject : Object { }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
|
||||
public enum TextHorizontalAlignment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers.Objects;
|
||||
|
||||
public class TileObject : Object
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Layers;
|
||||
|
||||
public class TileLayer : BaseLayer
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model;
|
||||
|
||||
public enum MapOrientation
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class BoolProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class ClassProperty : IProperty
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public PropertyType Type => DotTiled.PropertyType.Class;
|
||||
public PropertyType Type => Model.Properties.PropertyType.Class;
|
||||
public required string PropertyType { get; set; }
|
||||
public required Dictionary<string, IProperty> Properties { get; set; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class ColorProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
[Flags]
|
||||
public enum CustomClassUseAs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
public enum CustomEnumStorageType
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
public abstract class CustomTypeDefinition
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class FileProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class FloatProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public interface IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class IntProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class ObjectProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public enum PropertyType
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Properties;
|
||||
|
||||
public class StringProperty : IProperty
|
||||
{
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
namespace DotTiled;
|
||||
using DotTiled.Model.Layers.Objects;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled.Model;
|
||||
|
||||
public class Template
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class Frame
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public enum GridOrientation
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public enum ImageFormat
|
||||
{
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class Tile
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class TileOffset
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public enum ObjectAlignment
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class Transformations
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class WangColor
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class WangTile
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using DotTiled.Model.Properties;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Model.Tilesets;
|
||||
|
||||
public class Wangset
|
||||
{
|
|
@ -3,8 +3,11 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization;
|
||||
|
||||
internal static partial class Helpers
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using DotTiled.Model;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization;
|
||||
|
||||
public interface IMapReader : IDisposable
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using DotTiled.Model;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization;
|
||||
|
||||
public interface ITemplateReader : IDisposable
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization;
|
||||
|
||||
public interface ITilesetReader : IDisposable
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal static class ExtensionsJsonElement
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
public class TjTemplateReader : ITemplateReader
|
||||
{
|
||||
|
|
|
@ -5,8 +5,9 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -3,8 +3,12 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -3,8 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -3,8 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -4,8 +4,13 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -3,8 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Layers.Objects;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
@ -37,7 +42,7 @@ internal partial class Tmj
|
|||
_ => throw new JsonException($"Unknown draw order '{s}'.")
|
||||
}, DrawOrder.TopDown);
|
||||
|
||||
var objects = element.GetOptionalPropertyCustom<List<Object>>("objects", e => e.GetValueAsList<Object>(el => ReadObject(el, externalTemplateResolver, customTypeDefinitions)), []);
|
||||
var objects = element.GetOptionalPropertyCustom<List<Model.Layers.Objects.Object>>("objects", e => e.GetValueAsList<Model.Layers.Objects.Object>(el => ReadObject(el, externalTemplateResolver, customTypeDefinitions)), []);
|
||||
|
||||
return new ObjectLayer
|
||||
{
|
||||
|
@ -62,7 +67,7 @@ internal partial class Tmj
|
|||
};
|
||||
}
|
||||
|
||||
internal static Object ReadObject(
|
||||
internal static Model.Layers.Objects.Object ReadObject(
|
||||
JsonElement element,
|
||||
Func<string, Template> externalTemplateResolver,
|
||||
IReadOnlyCollection<CustomTypeDefinition> customTypeDefinitions)
|
||||
|
|
|
@ -3,8 +3,11 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -3,8 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
@ -16,7 +19,7 @@ internal partial class Tmj
|
|||
{
|
||||
var type = element.GetRequiredProperty<string>("type");
|
||||
var tileset = element.GetOptionalPropertyCustom<Tileset?>("tileset", el => ReadTileset(el, externalTilesetResolver, externalTemplateResolver, customTypeDefinitions), null);
|
||||
var @object = element.GetRequiredPropertyCustom<Object>("object", el => ReadObject(el, externalTemplateResolver, customTypeDefinitions));
|
||||
var @object = element.GetRequiredPropertyCustom<Model.Layers.Objects.Object>("object", el => ReadObject(el, externalTemplateResolver, customTypeDefinitions));
|
||||
|
||||
return new Template
|
||||
{
|
||||
|
|
|
@ -3,12 +3,15 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
||||
internal static TileLayer ReadTileLayer(
|
||||
JsonElement element,
|
||||
IReadOnlyCollection<CustomTypeDefinition> customTypeDefinitions)
|
||||
|
|
|
@ -5,8 +5,13 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace DotTiled;
|
||||
|
||||
internal partial class Tmj
|
||||
{
|
||||
}
|
|
@ -3,8 +3,11 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
public class TmjMapReader : IMapReader
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmj;
|
||||
|
||||
public class TsjTilesetReader : ITilesetReader
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Globalization;
|
||||
using System.Xml;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal static class ExtensionsXmlReader
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Xml;
|
||||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -4,8 +4,9 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using DotTiled.Model.Layers;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -3,8 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -4,8 +4,14 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Layers.Objects;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
@ -39,7 +45,7 @@ internal partial class Tmx
|
|||
|
||||
// Elements
|
||||
Dictionary<string, IProperty>? properties = null;
|
||||
List<Object> objects = [];
|
||||
List<Model.Layers.Objects.Object> objects = [];
|
||||
|
||||
reader.ProcessChildren("objectgroup", (r, elementName) => elementName switch
|
||||
{
|
||||
|
@ -71,14 +77,14 @@ internal partial class Tmx
|
|||
};
|
||||
}
|
||||
|
||||
internal static Object ReadObject(
|
||||
internal static Model.Layers.Objects.Object ReadObject(
|
||||
XmlReader reader,
|
||||
Func<string, Template> externalTemplateResolver,
|
||||
IReadOnlyCollection<CustomTypeDefinition> customTypeDefinitions)
|
||||
{
|
||||
// Attributes
|
||||
var template = reader.GetOptionalAttribute("template");
|
||||
Object? obj = null;
|
||||
Model.Layers.Objects.Object? obj = null;
|
||||
if (template is not null)
|
||||
obj = externalTemplateResolver(template).Object;
|
||||
|
||||
|
@ -106,7 +112,7 @@ internal partial class Tmx
|
|||
var visible = reader.GetOptionalAttributeParseable<bool>("visible") ?? visibleDefault;
|
||||
|
||||
// Elements
|
||||
Object? foundObject = null;
|
||||
Model.Layers.Objects.Object? foundObject = null;
|
||||
int propertiesCounter = 0;
|
||||
Dictionary<string, IProperty>? properties = propertiesDefault;
|
||||
|
||||
|
@ -144,7 +150,7 @@ internal partial class Tmx
|
|||
return OverrideObject(obj, foundObject);
|
||||
}
|
||||
|
||||
internal static Object OverrideObject(Object? obj, Object foundObject)
|
||||
internal static Model.Layers.Objects.Object OverrideObject(Model.Layers.Objects.Object? obj, Model.Layers.Objects.Object foundObject)
|
||||
{
|
||||
if (obj is null)
|
||||
return foundObject;
|
||||
|
@ -315,7 +321,7 @@ internal partial class Tmx
|
|||
Tileset? tileset = null;
|
||||
|
||||
// Should contain exactly one of
|
||||
Object? obj = null;
|
||||
Model.Layers.Objects.Object? obj = null;
|
||||
|
||||
reader.ProcessChildren("template", (r, elementName) => elementName switch
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -2,8 +2,13 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -3,8 +3,13 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Layers;
|
||||
using DotTiled.Model.Properties;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
internal partial class Tmx
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
public class TmxMapReader : IMapReader
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
public class TsxTilesetReader : ITilesetReader
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using DotTiled.Model;
|
||||
using DotTiled.Model.Properties.CustomTypes;
|
||||
using DotTiled.Model.Tilesets;
|
||||
|
||||
namespace DotTiled;
|
||||
namespace DotTiled.Serialization.Tmx;
|
||||
|
||||
public class TxTemplateReader : ITemplateReader
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue