如何保存用户输入 [英] How to save user input

查看:99
本文介绍了如何保存用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已经使用vISUAL C#创建了一个GUI游戏,在游戏开始时,要求用户输入其名称然后保存它,如何保存用户输入?
其次,必须使用在游戏开始时保存的名称来表示该玩家的得分.我该怎么办?
抱歉,这里很新..

hello, i have created a GUI game using vISUAL C# and at the begining of the game the user is required to enter their name and then saves it, how do i save user input?
secondly, the name that was saved at the begining of the game must then be used to represent the score of that player. how do i do that?
Sorry, quite new here..

推荐答案

有两种常见的方法-

1.创建一个数据库,当玩家输入用户名时,它将其输入到db中,然后在游戏结束时,分数更新并与名称一起发布到数据库中.

2.读取玩家的姓名并记入一个文件(excel,单词等),然后在每场比赛开始时读取该文件,并且用户名和分数可用作前10名"或类似的内容. br/>

There are 2 common ways of doing this -

1. create a database and when the player enters the username it enters it into the db and then at the end of the game the score updates and gets posted into the database alongside the name.

2. Read the players name and score into a file(excel,word etc) and then at the start of every game the file is read and the usernames and scores can be used as a "top 10" or something of the sort.


Dan


丹是对的.我会选择数据库解决方案,因为这可以扩展到多个用户.然后,您可以使游戏的所有用户都可以访问高分"提示.
Dan is right. I would opt for the database solution though, because this could scale to multiple users. You could then keep a "high score" tally accessible to all users of the game.


这篇关于如何保存用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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