資源簡介
壓縮包里面有21點、百變方塊、打字游戲、單機坦克、對對碰、俄羅斯方塊、拱豬、漢諾塔、黑白棋、華容道、計算器、連連看、七巧板、人物拼圖游戲、掃雷游戲、貪吃蛇、坦克大戰、停車場、涂鴉游戲、推箱子、網絡軍旗、中國象棋、智力問答游戲。
代碼片段和文件信息
//08-5-23?將VB.net的轉換成C#
using?System;
using?System.Runtime.InteropServices;
using?System.Windows.Forms;
//add
namespace?cards_csharp
{
????public?partial?class?Form1?:?Form
????{
????????private?card[]?Deck;
????????private?int?TopCard;
????????private?int?dealerAce;?//莊家已有A牌個數
????????private?int?dealerCount;?//莊家已有點數
????????private?int?g_height?=?100;
????????private?int?g_width?=?75;
????????private?int?idcard;?//莊家已有撲克牌數
????????private?int?ipcard;?//玩家已有撲克牌數
????????private?int?playerAce;?//玩家已有A牌個數
????????private?int?playerCount;?//玩家已有點數
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????//初始化函數?
????????[DllImport(“cards.dll“)]
????????public?static?extern?bool?cdtInit(ref?int?width?ref?int?height);
????????//顯示撲克牌的函數?
????????[DllImport(“cards.dll“)]
????????public?static?extern?bool?cdtDrawExt(IntPtr?hdc?int?x?int?y?int?dx?int?dy?int?card?int?mode?int?color);
????????//結束使用cards.dll函數?
????????[DllImport(“cards.dll“)]
????????public?static?extern?void?cdtTerm();
????????private?void?GetDeck()?//生成牌
????????{
????????????int?i;
????????????int?j;
????????????for?(i?=?0;?i?<=?3;?i++)
????????????{
????????????????for?(j?=?0;?j?<=?12;?j++)
????????????????{
????????????????????Deck[j?+?13*i].face?=?j;
????????????????????Deck[j?+?13*i].suit?=?i;
????????????????????if?(j?10)
????????????????????{
????????????????????????Deck[j?+?13*i].count?=?j?+?1;
????????????????????}
????????????????????else
????????????????????{
????????????????????????Deck[j?+?13*i].count?=?10;
????????????????????}
????????????????????Deck[j?+?13*i].faceup?=?false;
????????????????}
????????????}
????????}
????????private?void?Shuffle()?//洗牌?
????????{
????????????int?i?j?k;
????????????card?tc;
????????????Random?r?=?new?Random((int)?DateTime.Now.Ticks);
????????????for?(k?=?1;?k?<=?500;?k++)
????????????{
????????????????i?=?r.Next(52);
????????????????j?=?r.Next(52);
????????????????tc?=?Deck[i];
????????????????Deck[i]?=?Deck[j];
????????????????Deck[j]?=?tc;
????????????}
????????????TopCard?=?0;
????????}
????????private?void?delay(int?dt)
????????{
????????????int?t;
????????????t?=?(int)?DateTime.Now.Ticks;
????????????do
????????????{
????????????????if?((int)?DateTime.Now.Ticks?>=?t?+?dt)
????????????????????break;
????????????}?while?(true);
????????}
????????private?void?DrawCard(int?x?int?y)
????????{
????????????cdtDrawExt(base.CreateGraphics().GetHdc()?x?y?75?100?(Deck[TopCard].face*4?+?Deck[TopCard].suit)?0?0);
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????Deck?=?new?card[52];
????????????GetDeck();
????????????Shuffle();?//洗牌?????????????
????????????cdtInit(ref?g_width?ref?g_height);
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)?//發牌
????????{
????????????button1.Enabled?=?false;
????????????label1.Text
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-05-20?15:05??21點\
?????目錄???????????0??2018-05-20?15:31??21點\21點\
?????目錄???????????0??2018-05-20?15:31??21點\21點\.vs\
?????目錄???????????0??2018-05-20?15:31??21點\21點\.vs\21點\
?????目錄???????????0??2018-05-20?15:32??21點\21點\.vs\21點\v15\
?????文件???????31232??2018-05-20?15:34??21點\21點\.vs\21點\v15\.suo
?????目錄???????????0??2018-05-20?15:32??21點\21點\.vs\21點\v15\Server\
?????目錄???????????0??2018-05-20?15:34??21點\21點\.vs\21點\v15\Server\sqlite3\
?????文件???????????0??2018-05-20?15:32??21點\21點\.vs\21點\v15\Server\sqlite3\db.lock
?????文件??????471040??2018-05-20?15:34??21點\21點\.vs\21點\v15\Server\sqlite3\storage.ide
?????文件????????5194??2018-05-20?15:33??21點\21點\21點.csproj
?????文件?????????452??2012-08-20?11:19??21點\21點\21點.csproj.user
?????文件?????????899??2012-08-20?11:16??21點\21點\21點.sln
?????文件???????13824??2012-08-20?11:21??21點\21點\21點.suo
?????目錄???????????0??2018-05-20?15:05??21點\21點\DLL\
?????文件??????359936??2011-07-07?14:58??21點\21點\DLL\Cards.dll
?????文件????????4872??2011-07-02?15:36??21點\21點\Form1.Designer.cs
?????文件????????9361??2012-08-20?11:21??21點\21點\Form1.cs
?????文件????????5814??2011-07-02?15:36??21點\21點\Form1.resx
?????文件?????????455??2012-08-20?11:21??21點\21點\Program.cs
?????目錄???????????0??2018-05-20?15:05??21點\21點\Properties\
?????文件????????1162??2012-08-20?11:21??21點\21點\Properties\AssemblyInfo.cs
?????文件????????2852??2012-08-20?11:15??21點\21點\Properties\Resources.Designer.cs
?????文件????????5612??2008-05-24?02:21??21點\21點\Properties\Resources.resx
?????文件????????1095??2012-08-20?11:15??21點\21點\Properties\Settings.Designer.cs
?????文件?????????249??2012-08-20?11:15??21點\21點\Properties\Settings.settings
?????目錄???????????0??2018-05-20?15:05??21點\21點\bin\
?????目錄???????????0??2018-05-20?15:33??21點\21點\bin\Debug\
?????目錄???????????0??2018-05-20?15:33??21點\21點\bin\Debug\DLL\
?????文件??????359936??2011-07-07?14:58??21點\21點\bin\Debug\DLL\Cards.dll
?????文件???????12800??2018-05-20?15:33??21點\21點\bin\Debug\cards_csharp.exe
............此處省略1758個文件信息
- 上一篇:MATLAB GUI設計學習手記(羅華飛)
- 下一篇:ERP實施方法論
評論
共有 條評論