C# xna中windows phone的tilemap
我正在尝试使用流文件为windows phone制作平铺贴图这件事在windows游戏中对我有效,但它不适用于windows phone我正在使用xna任何人都可以帮我吗C# xna中windows phone的tilemap,c#,xna,C#,Xna,我正在尝试使用流文件为windows phone制作平铺贴图这件事在windows游戏中对我有效,但它不适用于windows phone我正在使用xna任何人都可以帮我吗 public void LoadMapData(string name) { string path = "leveles/" + name + ".txt"; // Width and height of our tile array int width = 0; int height =
public void LoadMapData(string name)
{
string path = "leveles/" + name + ".txt";
// Width and height of our tile array
int width = 0;
int height = File.ReadLines(path).Count();
StreamReader sReader = new StreamReader(path);
string line = sReader.ReadLine();
string[] tileNo = line.Split(',');
width = tileNo.Count();
mapLength = width * 40;
// Creating a new instance of the tile Coin
tileMap = new char[height, width];
sReader.Close();
// Re-initialising sReader
sReader = new StreamReader(path);
for (int y = 0; y < height; y++)
{
line = sReader.ReadLine();
tileNo = line.Split(',');
for (int x = 0; x < width; x++)
{
tileMap[y, x] = Convert.ToChar(tileNo[x]);
}
}
sReader.Close();
}
public void LoadMapData(字符串名称)
{
string path=“leveles/”+name+“.txt”;
//我们的瓷砖阵列的宽度和高度
整数宽度=0;
int height=File.ReadLines(path.Count();
StreamReader sReader=新的StreamReader(路径);
string line=sReader.ReadLine();
字符串[]tileNo=line.Split(',');
宽度=tileNo.Count();
最大长度=宽度*40;
//创建瓦片硬币的新实例
tileMap=新字符[高度、宽度];
sReader.Close();
//重新初始化sReader
sReader=新的StreamReader(路径);
对于(int y=0;y
您遇到了什么错误?尝试访问方法失败system.io.streamwriter..ctor(system.string)我不确定您是如何遇到streamwriter问题的,因为您给出的代码中似乎没有使用streamwriter。手机上的文件与桌面上的文件不同。给我这个我想把文本文件转换成2D aryy ho我能在windows phone中做什么你能帮我吗?你似乎已经在做了。您可能需要做的唯一更改是处理这些文件。