c# - 将 XNA 3.1 转换为 XNA 4.0。 StorageContainer.TileLocation

标签 c# file-io xna xna-4.0

我正在尝试在我的 XNA 4.0 游戏中保存高分信息。他们的方式我已经阅读了如何使用 StorageContainer.TileLocation,这在 XNA 4.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 给我一个错误,后来我发现它在 XNA 4.0 中不再可用

有什么方法可以在 XNA 4.0 中完成这项工作,如果不能,如何在 XNA 4.0 中完成而不是使用 StorageContainer.TitleLocation?

最佳答案

关于c# - 将 XNA 3.1 转换为 XNA 4.0。 StorageContainer.TileLocation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13553552/

相关文章:

c# - 打开加载项时出现诊断显示

matlab - 在 MATLAB 中加载文本文件?

matlab - matlab中的load命令加载空白文件

c# - 从 LINQ 查询中获取第一个结果 - 为什么 ElementAt<T>(0) 在 First<T>() 成功时失败?

c# - VB 中的异步文件下载不起作用

c - txt 文件中的第一个字符在 C 中不打印

c# - 使用 SpriteBatch 在 XNA 中绘制矩形

c# - Box2dx : Usage of World. 查询AABB?

XNA 游戏组件

c# - SQL AZURE 中的设计联合