Skip to content

Commit

Permalink
Merge pull request #17 from aalmik/v1.1
Browse files Browse the repository at this point in the history
V1.1
  • Loading branch information
aalmik committed Jan 31, 2015
2 parents 486e8fe + 9957d0c commit dc49e03
Show file tree
Hide file tree
Showing 19 changed files with 287 additions and 64 deletions.
Binary file added TmxMapperPCL/Nuget/TmxMapperPCL.1.1.0.nupkg
Binary file not shown.
26 changes: 26 additions & 0 deletions TmxMapperPCL/Nuget/TmxMapperPCL.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>TmxMapperPCL</id>
<version>1.1.0</version>
<title>Tmx Mapper PCL</title>
<authors>Mika Aaltonen</authors>
<owners>Mika Aaltonen</owners>
<licenseUrl>https://github.com/aalmik/tmx-mapper-pcl/blob/master/LICENSE.md</licenseUrl>
<projectUrl>https://github.com/aalmik/tmx-mapper-pcl</projectUrl>
<iconUrl>https://github.com/aalmik/tmx-mapper-pcl/blob/master/tmx_mapper_pcl.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Tiled map file parser for Windows Runtime apps</summary>
<description>
Tiled map file parser for Windows Runtime apps.
This Portable Class library works in both Windows Phone Store 8.1 and Windows Store 8.1 application projects started from universal application template.
Library is targeted for portable-netcore451+wpa81
</description>
<releaseNotes>First NuGet package version of the library targeted for portable-netcore451+wpa81</releaseNotes>
<copyright>Copyright 2015</copyright>
<tags>tmx tiled tmxmapper game tile map winrt</tags>
</metadata>
<files>
<file src="lib\portable-netcore451+wpa81\TmxMapperPCL.dll" target="lib\portable-netcore451+wpa81\TmxMapperPCL.dll" />
</files>
</package>
5 changes: 4 additions & 1 deletion TmxMapperPCL/TmxMapperPCL/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ public class Data
[XmlAttribute(DataType="string", AttributeName="compression")]
public string Compression { get; set; }

[XmlElement("tile")]
[XmlElement(ElementName = "tile")]
public List<DataTile> Tiles { get; set; }

[XmlText]
public string Value { get; set; }
}

public class DataTile
Expand Down
19 changes: 10 additions & 9 deletions TmxMapperPCL/TmxMapperPCL/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@ namespace TmxMapperPCL
// <image width="128" height="128" source="TilesPack/7.png"/>
public class Image
{
// source
[XmlAttribute(DataType = "string", AttributeName = "source")]
public string Source { get; set; }

// width
[XmlAttribute(DataType="int", AttributeName="width")]
public int Width { get; set; }

// source
[XmlAttribute(DataType="string", AttributeName="source")]
public string Source { get; set; }


// height
[XmlAttribute(DataType="int", AttributeName="height")]
public int Height { get; set; }

// format - optional
// format
[XmlAttribute(DataType="string", AttributeName="format")]
public string Format { get; set; }

// trans - optional
// trans
[XmlAttribute(DataType="string", AttributeName="trans")]
public string Trans { get; set; }

// TODO:

// Can contain: data (since 0.9.0)
[XmlElement(ElementName = "data")]
public Data Data { get; set; }
}
}
36 changes: 36 additions & 0 deletions TmxMapperPCL/TmxMapperPCL/ImageLayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace TmxMapperPCL
{
public class ImageLayer
{
[XmlAttribute(DataType="string", AttributeName="name")]
public string Name { get; set; }

[XmlAttribute(DataType = "int", AttributeName = "x")]
public int X { get; set; }

[XmlAttribute(DataType = "int", AttributeName = "y")]
public int Y { get; set; }

// opacity
[XmlAttribute(DataType = "boolean", AttributeName = "opacity")]
public bool Opacity { get; set; }

// visible
[XmlAttribute(DataType = "boolean", AttributeName = "visible")]
public bool Visible { get; set; }

[XmlElement(ElementName = "image")]
public Image Image { get; set; }

[XmlArray("properties")]
[XmlArrayItem("property")]
public List<Property> Properties { get; set; }
}
}
22 changes: 13 additions & 9 deletions TmxMapperPCL/TmxMapperPCL/Layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,27 @@ public class Layer
[XmlAttribute(DataType = "int", AttributeName = "width")]
public int Width { get; set; }


// height
[XmlAttribute(DataType = "int", AttributeName = "height")]
public int Height { get; set; }

// opacity
[XmlAttribute(DataType = "int", AttributeName = "opacity")]
public int Opacity { get; set; }

// visible
[XmlAttribute(DataType = "int", AttributeName = "visible")]
public int Visible { get; set; }
[XmlAttribute(DataType = "boolean", AttributeName = "opacity")]
public bool Opacity { get; set; }

[XmlElement("data")]
// visible
[XmlAttribute(DataType = "boolean", AttributeName = "visible")]
public bool Visible { get; set; }

// data
[XmlElement(ElementName = "data")]
public Data Data { get; set; }

// TODO: properties
// properties
[XmlArray("properties")]
[XmlArrayItem("property")]
public List<Property> Properties { get; set; }

// Can contain: properties, data
}
}
15 changes: 11 additions & 4 deletions TmxMapperPCL/TmxMapperPCL/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,23 @@ public class Map

// Can contain: properties, tileset, layer, objectgroup, imagelayer

// What is the proper data type?

[XmlElement(ElementName = "tileset")]
public TileSet TileSet { get; set; }

// Layer
[XmlElement("layer")]
[XmlElement(ElementName = "layer")]
public List<Layer> Layers { get; set; }

// TODO: ObjectGroup
// TODO: ImageLayer
// ObjectGroup
[XmlElement(ElementName= "objectgroup")]
public List<ObjectGroup> ObjectGroups { get; set; }


// ImageLayer
[XmlElement(ElementName = "imagelayer")]
public ImageLayer ImageLayer { get; set; }


public static async Task<Map> Load(StorageFile storageFile)
{
Expand Down
80 changes: 80 additions & 0 deletions TmxMapperPCL/TmxMapperPCL/Object.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace TmxMapperPCL
{
public class Object
{
// name
[XmlAttribute(DataType = "string", AttributeName = "name")]
public string Name { get; set; }

// type
[XmlAttribute(DataType = "string", AttributeName = "type")]
public string Type { get; set; }

// x
[XmlAttribute(DataType = "int", AttributeName = "x")]
public int X { get; set; }

// y
[XmlAttribute(DataType = "int", AttributeName = "y")]
public int Y { get; set; }

// width
[XmlAttribute(DataType = "int", AttributeName = "width")]
public int Width { get; set; }

// height
[XmlAttribute(DataType = "int", AttributeName = "height")]
public int Height { get; set; }

// rotation
[XmlAttribute(DataType = "int", AttributeName = "rotation")]
public int Rotation { get; set; }

// gid
[XmlAttribute(DataType = "int", AttributeName = "gid")]
public int GID { get; set; }

// visible
[XmlAttribute(DataType = "boolean", AttributeName = "visible")]
public bool Visible { get; set; }

// Can contain: properties, ellipse (since 0.9.0), polygon, polyline, image
[XmlElement(ElementName = "image")]
public Image Image { get; set; }

[XmlElement(ElementName = "ellipse")]
public Ellipse Ellipse { get; set; }

// TODO: polygon
[XmlElement(ElementName = "polygon")]
public Polygon Polygon { get; set; }

// TODO: polyline
[XmlElement(ElementName= "polyline")]
public Polyline Polyline { get; set; }
}

public class Ellipse
{
// left blanc
}

public class Polygon
{
[XmlAttribute(DataType="string", AttributeName="points")]
public string Points { get; set; }
}

public class Polyline
{
[XmlAttribute(DataType = "string", AttributeName = "points")]
public string Points { get; set; }
}
}
31 changes: 31 additions & 0 deletions TmxMapperPCL/TmxMapperPCL/ObjectGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace TmxMapperPCL
{
public class ObjectGroup
{
[XmlAttribute(DataType="string", AttributeName="name")]
public string Name { get; set; }

[XmlAttribute(DataType = "string", AttributeName = "color")]
public string Color { get; set; }

[XmlAttribute(DataType = "boolean", AttributeName = "opacity")]
public bool Opacity { get; set; }

[XmlAttribute(DataType = "boolean", AttributeName = "visible")]
public bool Visible { get; set; }

[XmlArray("properties")]
[XmlArrayItem("property")]
public List<Property> Properties { get; set; }

[XmlElement(ElementName = "object")]
public List<Object> Objects { get; set; }
}
}
11 changes: 5 additions & 6 deletions TmxMapperPCL/TmxMapperPCL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TmxMapperPCL")]
[assembly: AssemblyDescription("Tiled map file parser for Windows universal apps")]
[assembly: AssemblyTitle("Tmx Mapper PCL")]
[assembly: AssemblyDescription("Tiled map file parser for Windows Runtime apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mika Aaltonen")]
[assembly: AssemblyProduct("TmxMapperPCL")]
Expand All @@ -26,13 +26,12 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Nuget version. http://docs.nuget.org/docs/reference/Versioning
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

// Read this about version: http://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin
// Information about NuGet versioning: http://docs.nuget.org/docs/reference/versioning
// This is used in NuGet package!
// semver1: 2.0.0-alpha1 semver2: 2.0.0-alpha.2.1.4
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]

22 changes: 22 additions & 0 deletions TmxMapperPCL/TmxMapperPCL/Terrain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace TmxMapperPCL
{
public class Terrain
{
[XmlAttribute(DataType="string", AttributeName="name")]
public string Name { get; set; }

[XmlAttribute(DataType = "string", AttributeName = "tile")]
public string TileId { get; set; }

[XmlArray("properties")]
[XmlArrayItem("property")]
public List<Property> Properties { get; set; }
}
}
24 changes: 17 additions & 7 deletions TmxMapperPCL/TmxMapperPCL/Tile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,29 @@ namespace TmxMapperPCL
{
public class Tile
{
[XmlAttribute(DataType="int", AttributeName="id")]
public int ID { get; set; }
// id
[XmlAttribute(DataType="string", AttributeName="id")]
public string TileID { get; set; }

// terrain
[XmlElement(ElementName = "terrain")]
public Terrain Terrain { get; set; }

// probability
[XmlAttribute(DataType="string", AttributeName="probability")]
public string Probability { get; set; }

// image
[XmlElement(ElementName = "image")]
public Image Image { get; set; }

// TODO: optional - terrain
// TODO: optional - probability
// ObjectGroup
[XmlElement(ElementName = "objectgroup")]
public List<ObjectGroup> ObjectGroups { get; set; }

// properties
[XmlArray("properties")]
[XmlArrayItem("property")]
public List<Property> Property { get; set; }

// TODO: objectgroup
public List<Property> Properties { get; set; }
}
}
Loading

0 comments on commit dc49e03

Please sign in to comment.