資源簡介
用C#寫的蘋果打字游戲,有蘋果落下來,蘋果上帶有字母,按下鍵盤上的相應字母,蘋果就消失了,這是個完整的程序,用VS2010寫的,可以直接運行

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Media;
namespace?打字游戲
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????int?right?=?0;
????????int?wrong?=?0;
????????string?code1?=?“a“;
????????string?code2?=?“b“;
????????string?code3?=?“w“;
????????int?number?=?0;
????????int?time?=?0;
????????private?void?Form1_KeyPress(object?sender?KeyPressEventArgs?e)
????????{
????????????int?x?=?0?x1?=?0?x2?=?0;
????????????int?y?=?28?y1?=?28?y2?=?28;
????????????if?(number?==?0)
????????????{
????????????????x?=?new?Random().Next(0?409);
????????????????x1?=?new?Random().Next(528?this.ClientRectangle.Width?-?230);
????????????}
????????????if?(number?==?1)
????????????{
????????????????x?=?new?Random().Next(0?200);
????????????????x1?=?new?Random().Next(327?527);
????????????????x2?=?new?Random().Next(654?893);
????????????}
????????????
????????????//判斷下降的速度高低
????????????
????????????string?receive1?=?e.KeyChar.ToString();
????????????
????????????if?(receive1.Equals(code1))
????????????{
????????????????right++;
????????????????//顯示正確的個數
????????????????this.LabelScore1.Text?=?“當前正確數:??????“?+?right.ToString();
????????????????this.panel1.Location?=?new?Point(x?y);
????????????????BOMB();
????????????????this.label1.Text?=?GetCode1().ToString();
????????????????//令高度從新開始
????????????}
????????????
????????????else?if?(receive1.Equals(code2))
????????????{
????????????????right++;
????????????????//顯示正確的個數?
????????????????this.LabelScore1.Text?=?“當前正確數:??????“?+?right.ToString();
????????????????this.panel2.Location?=?new?Point(x1?y1);
????????????????BOMB();
????????????????this.label2.Text?=?GetCode2().ToString();
????????????????//令高度從新開始
????????????}
????????????else?if?(number?==?1)
????????????{
????????????????if?(receive1.Equals(code3))
????????????????{
????????????????????right++;
????????????????????//顯示正確的個數?
????????????????????this.LabelScore1.Text?=?“當前正確數:??????“?+?right.ToString();
????????????????????this.panel3.Location?=?new?Point(x2?y2);
????????????????????BOMB();
????????????????????this.label3.Text?=?GetCode3().ToString();
????????????????????//令高度從新開始
????????????????}
????????????}
????????????else
????????????{
????????????????wrong++;
????????????????this.LabelLost1.Text?=?“?????“?+?“當前錯誤數:?????????“?+?wrong.ToString();
????????????????LOSS();
????????????}
????????}
????????private?void?BOMB()
????????{
????????????SoundPlayer?player?=?new?SoundPlayer(“1.wav“);
????????????player.Play();
????????}
????????private?void?LOSS()
????????{
????????????SoundPlayer?player?=?new?SoundPlayer(“2.WAV“);
????????????player.Play();
????????}
????????
????????public?string?GetCode1()
????????{
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????73786??2012-06-03?22:46??打字游戲\打字游戲\bin\Debug\1.wav
?????文件?????431104??2012-10-17?13:07??打字游戲\打字游戲\bin\Debug\打字游戲.exe
?????文件??????48640??2012-10-17?13:07??打字游戲\打字游戲\bin\Debug\打字游戲.pdb
?????文件??????11600??2012-10-17?13:08??打字游戲\打字游戲\bin\Debug\打字游戲.vshost.exe
?????文件????????490??2010-03-17?22:39??打字游戲\打字游戲\bin\Debug\打字游戲.vshost.exe.manifest
?????文件???????7039??2012-06-17?16:56??打字游戲\打字游戲\Form1.cs
?????文件??????16321??2012-06-17?16:56??打字游戲\打字游戲\Form1.Designer.cs
?????文件?????504246??2012-06-17?16:56??打字游戲\打字游戲\Form1.resx
?????文件???????4440??2012-06-17?08:31??打字游戲\打字游戲\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6275??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????562??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????398??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件???????7897??2012-06-17?08:31??打字游戲\打字游戲\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件???????4608??2012-06-17?14:17??打字游戲\打字游戲\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????700??2012-10-17?13:08??打字游戲\打字游戲\obj\x86\Debug\打字游戲.csproj.FileListAbsolute.txt
?????文件?????431104??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\打字游戲.exe
?????文件?????332231??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\打字游戲.Form1.resources
?????文件??????48640??2012-10-17?13:07??打字游戲\打字游戲\obj\x86\Debug\打字游戲.pdb
?????文件??????82423??2012-06-17?16:34??打字游戲\打字游戲\obj\x86\Debug\打字游戲.Properties.Resources.resources
?????文件????????493??2012-06-16?22:57??打字游戲\打字游戲\Program.cs
?????文件???????1356??2012-06-16?22:57??打字游戲\打字游戲\Properties\AssemblyInfo.cs
?????文件???????3113??2012-06-17?14:17??打字游戲\打字游戲\Properties\Resources.Designer.cs
?????文件???????6199??2012-06-17?14:17??打字游戲\打字游戲\Properties\Resources.resx
?????文件???????1097??2012-06-16?22:57??打字游戲\打字游戲\Properties\Settings.Designer.cs
?????文件????????249??2012-06-16?22:57??打字游戲\打字游戲\Properties\Settings.settings
?????文件??????53258??2012-06-17?14:17??打字游戲\打字游戲\Resources\蘋果.png
?????文件???????3796??2012-06-17?16:34??打字游戲\打字游戲\打字游戲.csproj
?????文件????????878??2012-06-16?22:57??打字游戲\打字游戲.sln
????..A..H.?????18432??2012-10-17?13:08??打字游戲\打字游戲.suo
?????目錄??????????0??2012-06-17?14:17??打字游戲\打字游戲\obj\x86\Debug\TempPE
............此處省略13個文件信息
- 上一篇:C#做的QQ仿QQ
- 下一篇:C#項目 員工管理信息系統
評論
共有 條評論