用C#保存记忆游戏 [英] Saving a memory Game in C#

查看:137
本文介绍了用C#保存记忆游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

谁能帮我用C#保存记忆游戏?

Who can help me to save a Memory Game in C#?

我需要用一个保存游戏按钮,但我无法弄清楚如何..

I need to save the game with a button but i cant figure it out how ..

亲切的问候。

推荐答案

嗯,这取决于你对该游戏的实现。

Well, it depends on your implementation of that game.

最自然的方式是使用
将游戏对象图序列化为XML
内置的.NET .NET序列化
。当你的游戏使用命令模式时,这意味着你也可以保存整个游戏历史。

The most natural way is imho to serialize the games object graph to XML using the built-in XML serialization of .NET. When your game uses the command pattern, than this would mean that you also save the entire game history.

否则你只能序列化棋盘对象图。

Otherwise you can only serialize the boards object graph.


这篇关于用C#保存记忆游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆