我一直在使用外部txt文件来保存乐谱和选手名字(我只在两个不同的文件中保存了一个乐谱和一个名字)
当有新的高分时,它会比旧的高分节省。在我发布项目之前,我一直都在完美地工作,现在它无法找到该文件。
我嵌入了 txt 文件,但我无法写入它。
我正在使用以下代码。
using (StreamWriter write = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "highscore.txt")) // read the high score text file
{
write.WriteLine(player.score); // saves the new high score
write.Close(); // closes the file
}
using (StreamWriter write = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "nickname.txt")) // reads the high score text file
{
write.WriteLine(player.nickname); // save new highscore name
write.Close(); // close file
}
当我从 USB 或 CD 运行游戏时,它们不会读取 -
所以我的问题是 - 如何将 txt 文件放入我的游戏可以看到/找到的目录中?