unit main;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, fcImager, Menus,about, DeckCard, ExtCtrls, Buttons, fcButton, fcImgBtn, fcShapeBtn;
type TForm1 = class(TForm) MainMenu1: TMainMenu; N1: TMenuItem; B1: TMenuItem; N2: TMenuItem; X1: TMenuItem; O1: TMenuItem; H1: TMenuItem; I1: TMenuItem; N3: TMenuItem; A1: TMenuItem; Timer1: TTimer; SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton; SpeedButton5: TSpeedButton; SpeedButton6: TSpeedButton; SpeedButton7: TSpeedButton; procedure A1Click(Sender: TObject); procedure CardsClick(Sender: TObject); procedure CardsdbClick(Sender: TObject); procedure B1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure fcShapeBtn1Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure SpeedButton4Click(Sender: TObject); procedure SpeedButton5Click(Sender: TObject); procedure SpeedButton6Click(Sender: TObject); procedure SpeedButton7Click(Sender: TObject); procedure I1Click(Sender: TObject); procedure X1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } procedure init_card_value; procedure init_game; procedure TISHI_LIANGPAI(); procedure jiaopai(ower,cardcolor:integer); procedure qidipai(ower:integer); procedure sortcard(ower,dipai:integer); procedure liangdipai(); procedure pause(pausetime:integer); procedure diandipai(ower:integer); procedure chupai(ower:integer); function countcolornum(ower,color:integer):integer;
public { Public declarations } end;
var Form1: TForm1; currentstage,stage1,stage2,playower,currentcardnum,i,j,k,zhupaicolor:integer; cardarray:array [1..108] of tdeckcards; thebox:twincontrol; chupai_ower,chupai_color,chupai_num,chupai_value:integer; implementation
{$R *.DFM}
procedure TForm1.A1Click(Sender: TObject); begin ShowAboutBox; end; {新游戏开始} procedure tform1.init_game; begin stage1:=2; stage2:=2; playower:=0; end; {新局开始初始化值} procedure tform1.init_card_value; var nTemp,k1,k2,k3: Integer; begin timer1.Enabled:=false; zhupaicolor:=-1; fcshapebtn1.orientation:=soup; fcshapebtn1.hint:=''; speedbutton3.enabled:=FALSE; speedbutton4.enabled:=FALSE; speedbutton5.enabled:=FALSE; speedbutton6.enabled:=FALSE; speedbutton7.enabled:=FALSE; TheBox := TWinControl.create( self ); currentcardnum:=0; for i := 1 to 54 do begin cardarray[i] := TdeckCards.create( self ); cardarray[i].parent := thebox; CardArray[i].value := i; cardarray[i+54] := TdeckCards.create( self ); cardarray[i+54].parent := thebox; cardarray[i+54].value:=i; end; Randomize; val(TimeToStr(Time),k3,i); for i := 1 to k3 do for j := 1 to 108 do begin k1:= Random(108) + 1; k2:= Random(108) + 1; nTemp := CardArray[k1].value; CardArray[k1].value := CardArray[k2].value; CardArray[k2].value := nTemp; end; end;