📄 sjform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading ;
namespace 自娱自乐
{
/// <summary>
/// SJ 的摘要说明。
/// </summary>
public class SJForm : System.Windows.Forms.Form
{
//声明纸牌对象
private struct Squeezer
{
//Num : 0:大小王 1 - 13 对应于 A - K
//Type : 1:黑桃(小王) 2:红桃(大王) 3:梅花 4:方片
//Power: 牌的大小,每级均不一样
public int Num,Type,Power;
public PictureBox Pic;
}
private System.Windows.Forms.Button ButBegin;
private System.Windows.Forms.Button ButExit;
private System.Windows.Forms.Button ButOut;
private System.Windows.Forms.Panel Player1;
private System.Windows.Forms.Panel Player3;
private System.Windows.Forms.Panel Player2;
private System.Windows.Forms.Panel Player4;
private System.Windows.Forms.Panel OutShow1;
private System.Windows.Forms.Panel OutShow2;
private System.Windows.Forms.Panel OutShow3;
private System.Windows.Forms.Panel OutShow4;
private System.Windows.Forms.Label CurrentLevTitle;
private System.Windows.Forms.Label CurrentLevShow;
private System.Windows.Forms.Label CurrentTypeTitle;
private System.Windows.Forms.Label CurrentTypeShow;
private System.ComponentModel.IContainer components;
//声明全局的牌组
private Squeezer[] Card = new Squeezer[54];
//声明玩家牌组、底牌牌组、已出牌组、当前牌组
private ArrayList PlayerCard1 = new ArrayList();
private ArrayList PlayerCard2 = new ArrayList();
private ArrayList PlayerCard3 = new ArrayList();
private ArrayList PlayerCard4 = new ArrayList();
private ArrayList PlayerOut1 = new ArrayList();
private ArrayList PlayerOut2 = new ArrayList();
private ArrayList PlayerOut3 = new ArrayList();
private ArrayList PlayerOut4 = new ArrayList();
private ArrayList BottomCard = new ArrayList();
private ArrayList OutCard = new ArrayList();
//当前出牌次序
private int[] OutSeq = new int[4] ;
//定义全局变量
//游戏状态,已发牌数,庄家,甲组级别,已组级别,当前级别,当前主类型
private int GameStatus,DealNum,Banker,ALev,BLev,CurrentLev,CurrentType,CurrentSuccess ;
private System.Windows.Forms.Panel BottomShow;
private System.Windows.Forms.Label BankerTitle;
private System.Windows.Forms.Label BankerShow;
private System.Windows.Forms.Label LevOwnerShow;
private System.Windows.Forms.Label LevOwnerTitle;
private System.Windows.Forms.Label NamePlayer2;
private System.Windows.Forms.Label NamePlayer3;
private System.Windows.Forms.Label NamePlayer4;
private System.Windows.Forms.Label SuccessTitle;
private System.Windows.Forms.Label SuccessShow;
private System.Windows.Forms.Timer GameTime;
public SJForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SJForm));
this.ButBegin = new System.Windows.Forms.Button();
this.ButExit = new System.Windows.Forms.Button();
this.Player1 = new System.Windows.Forms.Panel();
this.ButOut = new System.Windows.Forms.Button();
this.Player3 = new System.Windows.Forms.Panel();
this.Player2 = new System.Windows.Forms.Panel();
this.Player4 = new System.Windows.Forms.Panel();
this.OutShow1 = new System.Windows.Forms.Panel();
this.OutShow2 = new System.Windows.Forms.Panel();
this.OutShow3 = new System.Windows.Forms.Panel();
this.OutShow4 = new System.Windows.Forms.Panel();
this.CurrentLevTitle = new System.Windows.Forms.Label();
this.CurrentLevShow = new System.Windows.Forms.Label();
this.CurrentTypeShow = new System.Windows.Forms.Label();
this.CurrentTypeTitle = new System.Windows.Forms.Label();
this.GameTime = new System.Windows.Forms.Timer(this.components);
this.BottomShow = new System.Windows.Forms.Panel();
this.BankerShow = new System.Windows.Forms.Label();
this.BankerTitle = new System.Windows.Forms.Label();
this.LevOwnerShow = new System.Windows.Forms.Label();
this.LevOwnerTitle = new System.Windows.Forms.Label();
this.NamePlayer2 = new System.Windows.Forms.Label();
this.NamePlayer3 = new System.Windows.Forms.Label();
this.NamePlayer4 = new System.Windows.Forms.Label();
this.SuccessShow = new System.Windows.Forms.Label();
this.SuccessTitle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// ButBegin
//
this.ButBegin.BackColor = System.Drawing.Color.Transparent;
this.ButBegin.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.ButBegin.ForeColor = System.Drawing.Color.Yellow;
this.ButBegin.Location = new System.Drawing.Point(10, 480);
this.ButBegin.Name = "ButBegin";
this.ButBegin.Size = new System.Drawing.Size(70, 25);
this.ButBegin.TabIndex = 0;
this.ButBegin.Text = "开 始";
this.ButBegin.Click += new System.EventHandler(this.ButBegin_Click);
//
// ButExit
//
this.ButExit.BackColor = System.Drawing.Color.Transparent;
this.ButExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.ButExit.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.ButExit.ForeColor = System.Drawing.Color.Yellow;
this.ButExit.Location = new System.Drawing.Point(10, 510);
this.ButExit.Name = "ButExit";
this.ButExit.Size = new System.Drawing.Size(70, 25);
this.ButExit.TabIndex = 1;
this.ButExit.Text = "退 出";
this.ButExit.Click += new System.EventHandler(this.ButExit_Click);
//
// Player1
//
this.Player1.BackColor = System.Drawing.Color.Transparent;
this.Player1.Location = new System.Drawing.Point(140, 413);
this.Player1.Name = "Player1";
this.Player1.Size = new System.Drawing.Size(360, 120);
this.Player1.TabIndex = 3;
//
// ButOut
//
this.ButOut.BackColor = System.Drawing.Color.Transparent;
this.ButOut.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.ButOut.ForeColor = System.Drawing.Color.Yellow;
this.ButOut.Location = new System.Drawing.Point(10, 450);
this.ButOut.Name = "ButOut";
this.ButOut.Size = new System.Drawing.Size(70, 25);
this.ButOut.TabIndex = 2;
this.ButOut.Text = "出 牌";
this.ButOut.Visible = false;
this.ButOut.Click += new System.EventHandler(this.ButOut_Click);
//
// Player3
//
this.Player3.BackColor = System.Drawing.Color.Transparent;
this.Player3.Location = new System.Drawing.Point(150, 0);
this.Player3.Name = "Player3";
this.Player3.Size = new System.Drawing.Size(360, 100);
this.Player3.TabIndex = 5;
//
// Player2
//
this.Player2.BackColor = System.Drawing.Color.Transparent;
this.Player2.Location = new System.Drawing.Point(10, 70);
this.Player2.Name = "Player2";
this.Player2.Size = new System.Drawing.Size(90, 360);
this.Player2.TabIndex = 4;
//
// Player4
//
this.Player4.BackColor = System.Drawing.Color.Transparent;
this.Player4.Location = new System.Drawing.Point(540, 70);
this.Player4.Name = "Player4";
this.Player4.Size = new System.Drawing.Size(90, 360);
this.Player4.TabIndex = 6;
//
// OutShow1
//
this.OutShow1.BackColor = System.Drawing.Color.Transparent;
this.OutShow1.Location = new System.Drawing.Point(250, 310);
this.OutShow1.Name = "OutShow1";
this.OutShow1.Size = new System.Drawing.Size(150, 100);
this.OutShow1.TabIndex = 7;
//
// OutShow2
//
this.OutShow2.BackColor = System.Drawing.Color.Transparent;
this.OutShow2.Location = new System.Drawing.Point(115, 160);
this.OutShow2.Name = "OutShow2";
this.OutShow2.Size = new System.Drawing.Size(90, 160);
this.OutShow2.TabIndex = 8;
//
// OutShow3
//
this.OutShow3.BackColor = System.Drawing.Color.Transparent;
this.OutShow3.Location = new System.Drawing.Point(250, 105);
this.OutShow3.Name = "OutShow3";
this.OutShow3.Size = new System.Drawing.Size(150, 100);
this.OutShow3.TabIndex = 9;
//
// OutShow4
//
this.OutShow4.BackColor = System.Drawing.Color.Transparent;
this.OutShow4.Location = new System.Drawing.Point(440, 160);
this.OutShow4.Name = "OutShow4";
this.OutShow4.Size = new System.Drawing.Size(90, 160);
this.OutShow4.TabIndex = 10;
//
// CurrentLevTitle
//
this.CurrentLevTitle.BackColor = System.Drawing.Color.Transparent;
this.CurrentLevTitle.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.CurrentLevTitle.ForeColor = System.Drawing.Color.Yellow;
this.CurrentLevTitle.Location = new System.Drawing.Point(520, 440);
this.CurrentLevTitle.Name = "CurrentLevTitle";
this.CurrentLevTitle.Size = new System.Drawing.Size(50, 20);
this.CurrentLevTitle.TabIndex = 11;
this.CurrentLevTitle.Text = "级别:";
this.CurrentLevTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// CurrentLevShow
//
this.CurrentLevShow.BackColor = System.Drawing.Color.Transparent;
this.CurrentLevShow.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.CurrentLevShow.ForeColor = System.Drawing.Color.Yellow;
this.CurrentLevShow.Location = new System.Drawing.Point(570, 440);
this.CurrentLevShow.Name = "CurrentLevShow";
this.CurrentLevShow.Size = new System.Drawing.Size(60, 20);
this.CurrentLevShow.TabIndex = 12;
this.CurrentLevShow.Text = "0";
this.CurrentLevShow.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// CurrentTypeShow
//
this.CurrentTypeShow.BackColor = System.Drawing.Color.Transparent;
this.CurrentTypeShow.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.CurrentTypeShow.ForeColor = System.Drawing.Color.Yellow;
this.CurrentTypeShow.Location = new System.Drawing.Point(570, 465);
this.CurrentTypeShow.Name = "CurrentTypeShow";
this.CurrentTypeShow.Size = new System.Drawing.Size(60, 20);
this.CurrentTypeShow.TabIndex = 14;
this.CurrentTypeShow.Text = "无";
this.CurrentTypeShow.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// CurrentTypeTitle
//
this.CurrentTypeTitle.BackColor = System.Drawing.Color.Transparent;
this.CurrentTypeTitle.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.CurrentTypeTitle.ForeColor = System.Drawing.Color.Yellow;
this.CurrentTypeTitle.Location = new System.Drawing.Point(520, 465);
this.CurrentTypeTitle.Name = "CurrentTypeTitle";
this.CurrentTypeTitle.Size = new System.Drawing.Size(50, 20);
this.CurrentTypeTitle.TabIndex = 13;
this.CurrentTypeTitle.Text = "花色:";
this.CurrentTypeTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// GameTime
//
this.GameTime.Interval = 1000;
this.GameTime.Tick += new System.EventHandler(this.GameTime_Tick);
//
// BottomShow
//
this.BottomShow.BackColor = System.Drawing.Color.Transparent;
this.BottomShow.Location = new System.Drawing.Point(250, 207);
this.BottomShow.Name = "BottomShow";
this.BottomShow.Size = new System.Drawing.Size(150, 100);
this.BottomShow.TabIndex = 15;
//
// BankerShow
//
this.BankerShow.BackColor = System.Drawing.Color.Transparent;
this.BankerShow.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.BankerShow.ForeColor = System.Drawing.Color.Yellow;
this.BankerShow.Location = new System.Drawing.Point(570, 490);
this.BankerShow.Name = "BankerShow";
this.BankerShow.Size = new System.Drawing.Size(60, 20);
this.BankerShow.TabIndex = 17;
this.BankerShow.Text = "无";
this.BankerShow.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// BankerTitle
//
this.BankerTitle.BackColor = System.Drawing.Color.Transparent;
this.BankerTitle.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.BankerTitle.ForeColor = System.Drawing.Color.Yellow;
this.BankerTitle.Location = new System.Drawing.Point(520, 490);
this.BankerTitle.Name = "BankerTitle";
this.BankerTitle.Size = new System.Drawing.Size(50, 20);
this.BankerTitle.TabIndex = 16;
this.BankerTitle.Text = "庄家:";
this.BankerTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// LevOwnerShow
//
this.LevOwnerShow.BackColor = System.Drawing.Color.Transparent;
this.LevOwnerShow.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.LevOwnerShow.ForeColor = System.Drawing.Color.Yellow;
this.LevOwnerShow.Location = new System.Drawing.Point(570, 515);
this.LevOwnerShow.Name = "LevOwnerShow";
this.LevOwnerShow.Size = new System.Drawing.Size(60, 20);
this.LevOwnerShow.TabIndex = 19;
this.LevOwnerShow.Text = "无";
this.LevOwnerShow.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// LevOwnerTitle
//
this.LevOwnerTitle.BackColor = System.Drawing.Color.Transparent;
this.LevOwnerTitle.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.LevOwnerTitle.ForeColor = System.Drawing.Color.Yellow;
this.LevOwnerTitle.Location = new System.Drawing.Point(520, 515);
this.LevOwnerTitle.Name = "LevOwnerTitle";
this.LevOwnerTitle.Size = new System.Drawing.Size(50, 20);
this.LevOwnerTitle.TabIndex = 18;
this.LevOwnerTitle.Text = "叫主:";
this.LevOwnerTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// NamePlayer2
//
this.NamePlayer2.BackColor = System.Drawing.Color.Transparent;
this.NamePlayer2.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.NamePlayer2.ForeColor = System.Drawing.Color.Yellow;
this.NamePlayer2.Location = new System.Drawing.Point(16, 48);
this.NamePlayer2.Name = "NamePlayer2";
this.NamePlayer2.Size = new System.Drawing.Size(50, 20);
this.NamePlayer2.TabIndex = 20;
this.NamePlayer2.Text = "瞎打";
this.NamePlayer2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// NamePlayer3
//
this.NamePlayer3.BackColor = System.Drawing.Color.Transparent;
this.NamePlayer3.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.NamePlayer3.ForeColor = System.Drawing.Color.Yellow;
this.NamePlayer3.Location = new System.Drawing.Point(96, 8);
this.NamePlayer3.Name = "NamePlayer3";
this.NamePlayer3.Size = new System.Drawing.Size(50, 20);
this.NamePlayer3.TabIndex = 21;
this.NamePlayer3.Text = "胡打";
this.NamePlayer3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// NamePlayer4
//
this.NamePlayer4.BackColor = System.Drawing.Color.Transparent;
this.NamePlayer4.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.NamePlayer4.ForeColor = System.Drawing.Color.Yellow;
this.NamePlayer4.Location = new System.Drawing.Point(560, 48);
this.NamePlayer4.Name = "NamePlayer4";
this.NamePlayer4.Size = new System.Drawing.Size(50, 20);
this.NamePlayer4.TabIndex = 22;
this.NamePlayer4.Text = "乱打";
this.NamePlayer4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SuccessShow
//
this.SuccessShow.BackColor = System.Drawing.Color.Transparent;
this.SuccessShow.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.SuccessShow.ForeColor = System.Drawing.Color.Yellow;
this.SuccessShow.Location = new System.Drawing.Point(580, 10);
this.SuccessShow.Name = "SuccessShow";
this.SuccessShow.Size = new System.Drawing.Size(50, 20);
this.SuccessShow.TabIndex = 24;
this.SuccessShow.Text = "0";
this.SuccessShow.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SuccessTitle
//
this.SuccessTitle.BackColor = System.Drawing.Color.Transparent;
this.SuccessTitle.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.SuccessTitle.ForeColor = System.Drawing.Color.Yellow;
this.SuccessTitle.Location = new System.Drawing.Point(520, 10);
this.SuccessTitle.Name = "SuccessTitle";
this.SuccessTitle.Size = new System.Drawing.Size(60, 20);
this.SuccessTitle.TabIndex = 23;
this.SuccessTitle.Text = "分数:";
this.SuccessTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SJForm
//
this.AcceptButton = this.ButBegin;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.ForestGreen;
this.CancelButton = this.ButExit;
this.ClientSize = new System.Drawing.Size(642, 543);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.SuccessShow,
this.SuccessTitle,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -