我正在尝试在我的XNA 4.0游戏中保存高分信息。他们说,我已经读过如何使用StorageContainer.TileLocation,这显然在XNA4.0中是不可用的。下面是SaveHighScores方法
public static void SaveHighScores(HighScoreData data, string filename)
{
// Get the path of the save game
string fullpath = Path.Combine(StorageContainer.TitleLocation, filename);
// Open the file, creating it if necessary
FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate);
try
{
// Convert the object to XML data and put it in the stream
XmlSerializer serializer = new XmlSerializer(typeof(HighScoreData));
serializer.Serialize(stream, data);
}
finally
{
// Close the file
stream.Close();
}
}TitleLocation给了我一个错误,我后来发现它在XNA4.0中不再可用
有没有办法在XNA4.0中做到这一点?如果没有,在XNA4.0中如何代替使用StorageContainer.TitleLocation来做到这一点?
发布于 2013-01-04 01:07:15
试试StorageContainer.OpenFile method
https://stackoverflow.com/questions/13553552
复制相似问题