bao
This commit is contained in:
@@ -18,10 +18,12 @@ namespace HxGame.Data
|
||||
[Serializable]
|
||||
public class MapRegions
|
||||
{
|
||||
public int mapWidth;
|
||||
public int mapHeight;
|
||||
public int regionWidth;
|
||||
public int regionHeight;
|
||||
public int regionRowNum;
|
||||
public int regionColNum;
|
||||
public float regionWidth;
|
||||
public float regionHeight;
|
||||
public float cellWidthPixel;
|
||||
public float cellHeightPixel;
|
||||
public Region[,] regions;
|
||||
|
||||
|
||||
@@ -57,10 +59,12 @@ namespace HxGame.Data
|
||||
private void SaveMapInfoConfig(int mapId, XmlElement xmlSettings)
|
||||
{
|
||||
xmlSettings.SetAttribute("mapID", mapId.ToString());
|
||||
xmlSettings.SetAttribute("mapWidth", mapWidth.ToString());
|
||||
xmlSettings.SetAttribute("mapHeight", mapHeight.ToString());
|
||||
xmlSettings.SetAttribute("regionRowNum", regionRowNum.ToString());
|
||||
xmlSettings.SetAttribute("regionColNum", regionColNum.ToString());
|
||||
xmlSettings.SetAttribute("regionWidth", regionWidth.ToString());
|
||||
xmlSettings.SetAttribute("regionHeight", regionHeight.ToString());
|
||||
xmlSettings.SetAttribute("cellWidthPixel", cellWidthPixel.ToString());
|
||||
xmlSettings.SetAttribute("cellHeightPixel", cellHeightPixel.ToString());
|
||||
}
|
||||
|
||||
private void SaveRegions(XmlDocument xml, XmlElement xmlRegions)
|
||||
@@ -108,20 +112,19 @@ namespace HxGame.Data
|
||||
|
||||
private void LoadMapInfoConfig(XmlNode xmlSettings)
|
||||
{
|
||||
mapWidth = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("mapWidth").Value);
|
||||
mapHeight = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("mapHeight").Value);
|
||||
regionRowNum = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("regionRowNum").Value);
|
||||
regionColNum = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("regionColNum").Value);
|
||||
regionWidth = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("regionWidth").Value);
|
||||
regionHeight = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("regionHeight").Value);
|
||||
regionHeight = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("regionHeight").Value);
|
||||
cellWidthPixel = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("cellWidthPixel").Value);
|
||||
cellHeightPixel = Convert.ToInt32(xmlSettings.Attributes.GetNamedItem("cellHeightPixel").Value);
|
||||
}
|
||||
|
||||
private void LoadRegions(XmlNode xmlRegions)
|
||||
{
|
||||
int row = mapWidth / MapManager.CELLSCALE / regionWidth;
|
||||
int col = mapHeight / MapManager.CELLSCALE / regionHeight;
|
||||
|
||||
XmlNode xmlNode = null;
|
||||
XmlNodeList xmlNodeList = xmlRegions.ChildNodes;
|
||||
regions = new Region[row, col];
|
||||
regions = new Region[regionRowNum, regionColNum];
|
||||
for (int i = 0; i < xmlNodeList.Count; i++)
|
||||
{
|
||||
xmlNode = xmlNodeList.Item(i);
|
||||
|
||||
Reference in New Issue
Block a user