I'm using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate to serialize / deserialize a few things, and so far it worked great.
But now, i did a level editor and it doesn't seem to write the data properly for my tiles. All i get is:
<XnaContent xmlns:WorldClasses="XRpgLibrary.WorldClasses">
<Asset Type="WorldClasses:MapData">
<MapName>Village</MapName>
<Layers>
<Item>
<MapLayerName>Base</MapLayerName>
<Width>32</Width>
<Height>32</Height>
<Layer>
<Item />
<Item />
<Item />
<Item />
As you see, the Item fields are all empty when they should contain some tile values. Everything else works perfectly.
Even if i debug my game step by step, i can see that the right data is passed to the Serializer; it just doesn't seem to write them! :S (Check screenshot at the end)
Here's my Tile class, just in case:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XRpgLibrary.TileEngine
{
public class Tile
{
#region Field Region
int tileIndex;
int tileSetIndex;
#endregion
#region Property Region
private Tile()
{
}
public int TileIndex
{
get { return tileIndex; }
private set { tileIndex = value; }
}
public int TileSetIndex
{
get { return tileSetIndex; }
private set { tileSetIndex = value; }
}
#endregion
#region Constructor Region
public Tile(int tileIndex, int tileset)
{
TileIndex = tileIndex;
TileSetIndex = tileset;
}
#endregion
}
}
So anyway, as you can see, the data is passed properly and in that case, should have these values in XML:
<Item>
<TileIndex>1</TileIndex>
<TileSetIndex>0</TileSetIndex>
</Item>
So i know it's a lengthy post, but i'm pulling my hair at this. If anyone has any ideas, please let me know!