Sorry if this question seems silly. I have studied a few web pages on the subject but am unsure how relevant they are to my issue. I have a 2D map designer that i have made. I would like to save the map, so that i can load it and play a game on it. I'm very new to Serialization, and i was wondering what documents i should study and if someone could point me to some web pages that relate to my serialization task. Here is the data structure:
public class ModelMap
{
public ModelMap()
{
this.cellBgImage = new Image();
this.exitImage = new Image();
this.theseus = new Image();
this.minotaur = new Image();
}
public int rows { get; set; }
public int cols { get; set; }
public int boardXPos { get; set; }
public int boardYPos { get; set; }
public int myCellSize { get; set; }
public Image cellBgImage { get; set; }
public string HorizontalWallSource { get; set; }
public string VerticalWallSource { get; set; }
public Image minotaur { get; set; }
public Image theseus { get; set; }
public Image exitImage { get; set; }
public string exitCellPlacement { get; set; }
public int myWidth { get; set; }
public int myHeight { get; set; }
private List<Cell> m_cells = new List<Cell>();
public List<Cell> myCells
{
get
{
return m_cells;
}
set
{
m_cells = value;
}
}
}
}
Cell Class:
public class Cell
{
public Cell(int col, int row, CellSide rightWall, CellSide bottomWall, ModelMap map)
{
this.myColumn = col;
this.myRow = row;
this.myRightWall = rightWall;
this.myBottomWall = bottomWall;
this.myMap = map;
}
public Cell(int col, int row, CellSide rightWall, CellSide bottomWall, ModelMap map, Image bgImage)
{
this.myColumn = col;
this.myRow = row;
this.myRightWall = rightWall;
this.myBottomWall = bottomWall;
this.myMap = map;
this.myBgImage = bgImage;
}
public ModelMap myMap { get; set; }
public Image myBgImage { get; set; }
public bool hasMinotaur { get; set; }
public bool hasTheseus { get; set; }
public bool isExit { get; set; }
public int mySize { get; set; }
public CellSide myRightWall { get; set; }
public CellSide myBottomWall { get; set; }
public int myColumn { get; set; }
public int myRow { get; set; }
}
public class CellSide
{
public CellSide(int hasWall, bool highlighted)
{
this.hasWall = hasWall;
this.isHighlighted = highlighted;
}
public bool isHighlighted { get; set; }
public int hasWall { get; set; }
}
}
Thank you.