所以我在 XNA 中做了一个游戏,为了从文件中获取分数,我做了这样的事情......
private void GetScore()
{
if (File.Exists(scoreFilename))
{
using (StreamReader sr = new StreamReader(scoreFilename))
{
hiScore = Convert.ToInt16(sr.ReadLine());
}
}
else
{
FileStream fs = File.Create(scoreFilename);
fs.Close();
using (StreamWriter sw = new StreamWriter(scoreFilename))
{
sw.Write("0");
}
hiScore = 0;
}
}
这适用于 Windows,但我将如何为 Android 执行此操作?