• 大小: 303KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-28
  • 语言: C#
  • 标签: C#  剪刀  石头布  游戏  

资源简介

一个基于C#编写的剪刀石头布的小游戏,适合于教学用,适合于初学者学习用

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SX4_3
{
    public partial class MainForm : Form
    {
        int intMyScore;//我赢的局数
        int intComputerScore;//电脑赢的局数
        bool blReady; //开始按钮的状态
        int intMySelect; //我每次的选择
        int intComputerSelect; //电脑每次的选择
        int intTotal; //总局数
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender EventArgs e)
        {
            blReady = true;
            if (blReady)
            {
                this.btnComputer1.Visible = false;
                this.btnComputer2.Visible = false;
                this.btnComputer3.Visible = false;
                this.btnMy1.Visible = false;
                this.btnMy2.Visible = false;
                this.btnMy3.Visible = false;
                this.lblResult.Visible = false;
                intMyScore = 0;
                intComputerScore = 0;
                this.lblComputer.Text = (intTotal).ToString() + “局“ + intComputerScore.ToString() + “胜“;
                this.lblMy.Text = (intTotal).ToString() + “局“ + intMyScore.ToString() + “胜“;
                this.btnStart.Text = “开始“;
                intMySelect=-1;
                intComputerSelect=-1;
                intTotal=0;
            }
        }

        private void btnStart_Click(object sender EventArgs e)
        {
            if (blReady)
            {
                this.btnStart.Text = “再来一次“;
                this.btnMy1.Visible = true;
                this.btnMy2.Visible = true;
                this.btnMy3.Visible = true;
                this.lblResult.Visible = false;
                blReady = false;
            }
            else
            {
                this.btnComputer1.Visible = false;
                this.btnComputer2.Visible = false;
                this.btnComputer3.Visible = false;
                this.btnMy1.Visible = false;
                this.btnMy2.Visible = false;
                this.btnMy3.Visible = false;
                this.lblResult.Visible = false;
                this.lblComputer.Text = (intMyScore + intComputerScore).ToString() + “局“ + intComputerScore.ToString() + “胜“;
                this.lblComputer.Text = (intMyScore + intComputerScore).ToString() + “局“ + intMyScore.ToString() + “胜“;
                this.btnStart.Text = “开始“;
                blReady = true;
            }
        }

        private void btnMy1_Click(object sender EventArgs e)
        {
            intMySelect = 1;
            btnMy2.Visible = false;
            btnMy3.Visible = false;
            btnComputer1.Visible = true;
            btnComputer2.Visible = true;
            btnComputer3.Visible = true;
            ComputerAutoSelect();
        }

        private void btnMy2_Click(object sender E

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-08-30 19:28  SX4-3\
     目录           0  2012-08-30 19:28  SX4-3\bin\
     目录           0  2012-08-30 19:28  SX4-3\bin\Debug\
     文件      208896  2010-05-11 15:58  SX4-3\bin\Debug\SX4-3.exe
     文件       28160  2010-05-11 15:58  SX4-3\bin\Debug\SX4-3.pdb
     文件       11608  2011-10-13 07:58  SX4-3\bin\Debug\SX4-3.vshost.exe
     文件         490  2010-03-17 22:39  SX4-3\bin\Debug\SX4-3.vshost.exe.manifest
     目录           0  2011-09-29 10:07  SX4-3\bin\Release\
     文件        6816  2010-05-11 15:58  SX4-3\MainForm.cs
     文件       12423  2010-04-19 15:19  SX4-3\MainForm.Designer.cs
     文件      281228  2009-09-19 19:14  SX4-3\MainForm.resx
     目录           0  2012-08-30 19:28  SX4-3\obj\
     目录           0  2012-08-30 19:28  SX4-3\obj\Debug\
     文件        5481  2011-09-29 10:07  SX4-3\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2011-06-16 06:43  SX4-3\obj\Debug\Refactor\
     文件         242  2011-10-13 07:58  SX4-3\obj\Debug\SX4-3.csproj.FileListAbsolute.txt
     文件         845  2010-04-19 15:15  SX4-3\obj\Debug\SX4-3.csproj.GenerateResource.Cache
     文件      208896  2010-05-11 15:58  SX4-3\obj\Debug\SX4-3.exe
     文件       28160  2010-05-11 15:58  SX4-3\obj\Debug\SX4-3.pdb
     文件      184320  2010-04-19 15:17  SX4-3\obj\Debug\SX4_3.MainForm.resources
     文件         180  2010-04-19 15:15  SX4-3\obj\Debug\SX4_3.Properties.Resources.resources
     目录           0  2012-08-30 19:28  SX4-3\obj\Debug\TempPE\
     文件        4608  2011-09-29 10:07  SX4-3\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
     文件         971  2010-10-25 08:02  SX4-3\obj\SX4-3.csproj.FileListAbsolute.txt
     文件         467  2010-04-19 15:17  SX4-3\Program.cs
     目录           0  2012-08-30 19:28  SX4-3\Properties\
     文件        1174  2010-04-19 15:12  SX4-3\Properties\AssemblyInfo.cs
     文件        2848  2011-09-29 10:07  SX4-3\Properties\Resources.Designer.cs
     文件        5612  2010-04-19 15:12  SX4-3\Properties\Resources.resx
     文件        1103  2011-09-29 10:07  SX4-3\Properties\Settings.Designer.cs
     文件         249  2010-04-19 15:12  SX4-3\Properties\Settings.settings
............此处省略2个文件信息

评论

共有 条评论