我正在尝试使用流文件为Windows手机做平铺地图这个东西在Windows游戏中对我工作但是它不适用于Windows手机我正在使用xna任何人都可以帮助我
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();
}