• 大小: 88KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-21
  • 语言: C#
  • 标签: c#  翻牌  小游戏  

资源简介

基于Microsoft Visual Studio 2005 用C#开发的翻牌小游戏,16张牌,8组两张相同的牌,点击一张牌,当前牌翻开,当点击第三张牌的时候,前两张牌相同的时候,前两张消失,不同的话,就翻回来。时间100秒。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.IO;

namespace Memorize
{
   public class button
   {
       //static int count = 0;
       public Button b1;
       int width;
       int height;
       int pox;
       int poy;
       private static int[] value = { 1 2 3 4 5 6 7 8 };
       private static int[] frequency = { 0 0 0 0 0 0 0 0 };
       private static int[]x1 = new int [3];
       private static int[]y1 = new int [3];

       public void Dispose()
       {
           b1.Dispose();
       }
        
       public button(Panel p1 int w int h int x int yint iint j)
       {
           width = w;
           height = h;
           b1 = new Button();
           b1.Flatstyle = Flatstyle.Flat;
           int bw = 50;
           int bh = 60;
           b1.Width = bw;
           b1.Height = bh;
           b1.BackColor = SystemColors.ControlDark;
           b1.Top = x;
           b1.Left = y;
           pox = i;
           poy = j;
           b1.Click += new EventHandler(Click);
           p1.Controls.Add(b1);
       }


       public void Show()
       {
           x1[frmMain .count - 1] = pox;
           y1[frmMain.count - 1] = poy;
           if (frmMain.count == 1)
           {
               frmMain.but1[x1[0] y1[0]].b1.Visible = true;
           }
           if (frmMain.count == 2)
           {
               if (frmMain.but1[x1[0] y1[0]].pox == frmMain.but1[x1[1] y1[1]].pox
                   && frmMain.but1[x1[0] y1[0]].poy == frmMain.but1[x1[1] y1[1]].poy)
               {

                   x1[frmMain.count - 2] = pox;
                   y1[frmMain.count - 2] = poy;
                   frmMain.count = 1;
               }


               else if (frmMain.but1[x1[0] y1[0]].b1.Text == frmMain.but1[x1[1] y1[1]].b1.Text)
                   
                    
               {
                   frmMain.but1[x1[0] y1[0]].b1.Visible = false;
                   frmMain.but1[x1[1] y1[1]].b1.Visible = false;
                   frmMain.count = 0;
                   frmMain.totalCount += 2;
                   if (frmMain.totalCount == 16)
                   {
                       frmMain.DisTime();
                       MessageBox.Show(“YOU WIN!“);
                       frmMain.showwin();
                   }

               }

           }



           if (frmMain.count == 3)
           {
              
               frmMain.but1[x1[0] y1[0]].b1.BackgroundImage = Image.FromFile(“Back.jpg“);
               frmMain.but1[x1[1] y1[1]].b1.BackgroundImage = Image.FromFile(“Back.jpg“);
               x1[frmMain.count - 3] = pox;
               y1[frmMain.count - 3] = poy;
               frmMain.count = 1;
           }

       }


       private void Click(object sender System.EventArgs e)
       {

           frmMain.EnableTime(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        913  2008-01-19 12:48  Memorize\Memorize.sln

    ..A..H.     18944  2008-01-23 22:13  Memorize\Memorize.suo

     文件       4460  2008-01-22 15:34  Memorize\Memorize\TopScore.Designer.cs

     文件       4000  2008-01-22 13:33  Memorize\Memorize\Memorize.csproj

     文件       3419  2008-01-19 15:59  Memorize\Memorize\UserInfo.Designer.cs

     文件       5814  2008-01-19 15:59  Memorize\Memorize\UserInfo.resx

     文件       1156  2008-01-19 20:18  Memorize\Memorize\UserInfo.cs

     文件       4102  2008-01-23 22:12  Memorize\Memorize\button.cs

     文件       7689  2008-01-23 22:12  Memorize\Memorize\Main.cs

     文件        469  2008-01-19 13:10  Memorize\Memorize\Program.cs

     文件       5814  2008-01-22 15:34  Memorize\Memorize\TopScore.resx

     文件        973  2008-01-22 15:34  Memorize\Memorize\TopScore.cs

     文件        361  2008-01-23 22:13  Memorize\Memorize\obj\Memorize.csproj.FileList.txt

     文件        180  2008-01-22 19:05  Memorize\Memorize\obj\Debug\Memorize.frmMain.resources

     文件        180  2008-01-19 16:45  Memorize\Memorize\obj\Debug\Memorize.Properties.Resources.resources

     文件        180  2008-01-22 15:34  Memorize\Memorize\obj\Debug\Memorize.frmTopScore.resources

     文件        180  2008-01-19 16:45  Memorize\Memorize\obj\Debug\Memorize.frmUserInfo.resources

     文件      32768  2008-01-23 22:12  Memorize\Memorize\obj\Debug\Memorize.exe

     文件       4608  2008-01-22 13:30  Memorize\Memorize\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        963  2008-01-22 19:05  Memorize\Memorize\obj\Debug\Memorize.csproj.GenerateResource.Cache

     文件      42496  2008-01-23 22:12  Memorize\Memorize\obj\Debug\Memorize.pdb

     文件       5632  2005-12-08 14:51  Memorize\Memorize\bin\Debug\Memorize.vshost.exe

     文件      32768  2008-01-23 22:12  Memorize\Memorize\bin\Debug\Memorize.exe

     文件      42496  2008-01-23 22:12  Memorize\Memorize\bin\Debug\Memorize.pdb

     文件       1868  2008-01-20 09:46  Memorize\Memorize\bin\Debug\Back.jpg

     文件       1710  2008-01-20 13:05  Memorize\Memorize\bin\Debug\8.jpg

     文件       1648  2008-01-20 13:02  Memorize\Memorize\bin\Debug\1.jpg

     文件       1547  2008-01-20 13:04  Memorize\Memorize\bin\Debug\2.jpg

     文件       1687  2008-01-20 13:04  Memorize\Memorize\bin\Debug\3.jpg

     文件       1682  2008-01-20 13:04  Memorize\Memorize\bin\Debug\4.jpg

............此处省略23个文件信息

评论

共有 条评论