www.pudn.com > Roulette.rar > Round.pas


unit Round; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, ComCtrls, ExtCtrls, Grids, ImgList, Buttons, TltConst; 
 
type 
  TRoundMonitorForm = class(TForm) 
    Panel1: TPanel; 
    Label1: TLabel; 
    Label2: TLabel; 
    Image1: TImage; 
    Image2: TImage; 
    Image3: TImage; 
    LabelBet1: TLabel; 
    Shape1: TShape; 
    Shape2: TShape; 
    Label6: TLabel; 
    Label7: TLabel; 
    LabelBet2: TLabel; 
    LabelBet3: TLabel; 
    LabelT1: TLabel; 
    Label15: TLabel; 
    Label17: TLabel; 
    Label18: TLabel; 
    Label19: TLabel; 
    Label21: TLabel; 
    Label20: TLabel; 
    ImageList1: TImageList; 
    Label16: TLabel; 
    LabelV1: TLabel; 
    LabelV2: TLabel; 
    LabelV3: TLabel; 
    SBR1: TSpeedButton; 
    SBR2: TSpeedButton; 
    SBR3: TSpeedButton; 
    Label30: TLabel; 
    LabelWillValue: TLabel; 
    LabelResult: TLabel; 
    LabelValueTotal: TLabel; 
    LabelCaici: TLabel; 
    Label36: TLabel; 
    LabelT2: TLabel; 
    SpeedButton4: TSpeedButton; 
    Timer1: TTimer; 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure Timer1Timer(Sender: TObject); 
    procedure SBR1Click(Sender: TObject); 
    procedure SBR2Click(Sender: TObject); 
    procedure SBR3Click(Sender: TObject); 
    procedure SpeedButton4Click(Sender: TObject); 
  private 
 
    function GetColorIndex(Num: integer): integer; 
    { Private declarations } 
 
  public 
    { Public declarations } 
  end; 
 
var 
  RoundMonitorForm: TRoundMonitorForm; 
 
implementation 
 
uses DM1, main, ManagerInterpreter, player, playeredit, 
  RoundQuery, SConnectEx, Setting; 
 
{$R *.dfm} 
 
procedure TRoundMonitorForm.FormClose(Sender: TObject; 
  var Action: TCloseAction); 
begin 
  RoundMonitorForm := nil; 
  Action := caFree; 
end; 
 
function TRoundMonitorForm.GetColorIndex(Num : integer): integer; 
begin 
  result := -1; 
  case Num of 
    1, 3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36: 
      Result := 0; 
    2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35: 
      Result := 1; 
    0: Result := 2; 
    else Result := -1; 
  end; 
end; 
 
 
procedure TRoundMonitorForm.Timer1Timer(Sender: TObject); 
var 
  RoundInfo : TRoundInfo; 
  BetTime : integer; 
  I : integer; 
const 
  ColorByIndex : array [0..2] of TColor =(clRed, clBlack, clGreen); 
  ColorNameByIndex : array [0..2] of String =('红色', '黑色', '绿色'); 
begin 
  if RoundMonitorForm = nil then Exit; 
  if rltInterpreter = nil then Exit; 
  if TimeSetting.BetTimeSet=0 then TimeSetting := rltInterpreter.CallGetTimeSetting; 
  RoundInfo := rltInterpreter.CallGetRoundInfo; 
  with RoundInfo do 
  begin 
    Label2.Caption :=IntToStr(RoundInfo.CurrentRound.No) +'-'+ IntToStr(RoundInfo.CurrentRound.WheelNo); 
    LabelBet1.Caption := IntToStr(RoundInfo.CurrentBetCount[0]); 
    LabelBet2.Caption := IntToStr(RoundInfo.CurrentBetCount[1]); 
    LabelBet3.Caption := IntToStr(RoundInfo.CurrentBetCount[2]); 
    LabelV1.Caption := IntTostr(-CurrentBetCount[0]+CurrentBetCount[1]+ CurrentBetCount[2]); 
    LabelV2.Caption := IntTostr(CurrentBetCount[0]-CurrentBetCount[1]+ CurrentBetCount[2]); 
    LabelV3.Caption := IntTostr(CurrentBetCount[0]+CurrentBetCount[1]-35* CurrentBetCount[2]); 
    LabelValueTotal.Caption := IntTostr(CurrentBetCount[0]+CurrentBetCount[1]+ CurrentBetCount[2]); 
    LabelCaici.Caption := IntToStr(TotalValue); 
    BetTime := TimeSetting.BeforeWheelTimeSet - RoundInfo.CurrentRound.CountDown; 
    if BetTime <0 then BetTime := 0; 
    LabelT1.Caption := IntToStr(BetTime); 
    LabelT2.Caption := IntToStr(TimeSetting.WheelEndSet - RoundInfo.CurrentRound.CountDown); 
    if BetTime< TimeSetting.BetTimeSet then 
    begin 
      if GetColorIndex(RoundInfo.WillResult) =0 then SBR1.Down := true; 
      if GetColorIndex(RoundInfo.WillResult) =1 then SBR2.Down := true; 
      if GetColorIndex(RoundInfo.WillResult) =2 then SBR3.Down := true; 
    end 
    else 
    begin 
      SBR1.Down := false; 
      SBR2.Down := false; 
      SBR3.Down := false; 
    end; 
    if RoundInfo.CurrentRound.CountDown>= TimeSetting.BeforeWheelTimeSet then 
    begin 
      SBR1.Enabled := false; 
      SBR2.Enabled := false; 
      SBR3.Enabled := false; 
    end else 
    begin 
      SBR1.Enabled := true; 
      SBR2.Enabled := true; 
      SBR3.Enabled := true; 
    end; 
 
  end; 
  for I := 0 to ComponentCount-1 do 
  begin 
    if Components[i] is TLabel then 
    begin 
      if pos('-',(Components[i] as TLabel).Caption)>0 then 
        (Components[i] as TLabel).Font.Color := clRed 
      else if Components[i].Tag = 1 then 
        (Components[i] as TLabel).Font.Color := clGreen; 
    end; 
  end; 
  if (RoundInfo.CurrentRound.No=1) and (RoundInfo.CurrentRound.WheelNo=1) then 
    Label30.Caption := '-' 
  else 
    Label30.Caption := IntToStr(RoundInfo.OldResult)+'号,' 
    +ColorNameByIndex[GetColorIndex(RoundInfo.OldResult)]; 
    Label30.Font.Color := ColorByIndex[GetColorIndex(RoundInfo.OldResult)]; 
  if (RoundInfo.CurrentRound.WheelResult>=0) then 
  begin 
    LabelResult.Caption := IntToStr(RoundInfo.CurrentRound.WheelResult)+'号,' 
    +ColorNameByIndex[GetColorIndex(RoundInfo.CurrentRound.WheelResult)]; 
    LabelResult.Font.Color := ColorByIndex[GetColorIndex(RoundInfo.CurrentRound.WheelResult)]; 
  end else 
    LabelResult.Caption := '-'; 
 
  LabelWillValue.Caption := IntToStr(RoundInfo.ObjectValue); 
end; 
 
procedure TRoundMonitorForm.SBR1Click(Sender: TObject); 
begin 
  if rltInterpreter = nil then Exit; 
  rltInterpreter.CallSetRoundResult(0); 
end; 
 
procedure TRoundMonitorForm.SBR2Click(Sender: TObject); 
begin 
  if rltInterpreter = nil then Exit; 
  rltInterpreter.CallSetRoundResult(1); 
end; 
 
procedure TRoundMonitorForm.SBR3Click(Sender: TObject); 
begin 
  if rltInterpreter = nil then Exit; 
  rltInterpreter.CallSetRoundResult(2); 
end; 
 
procedure TRoundMonitorForm.SpeedButton4Click(Sender: TObject); 
var 
  CGameParams : TGameParams; 
begin 
  if rltInterpreter = nil then Exit; 
  if not rltInterpreter.CallGetGameParams(CGameParams) then Exit; 
  //提示对话框 
  //读取配置 
  //设置配置 
  if SetGame(CGameParams) then 
  begin 
    CGameParams.AdminStr := '(nochange)'; 
    if rltInterpreter.CallSetGameParams(CGameParams) then 
    begin 
      MessageBox(Handle, '设置游戏参数成功!','',MB_OK); 
    end else 
    begin 
      MessageBox(Handle, '设置游戏参数失败!','',MB_OK or MB_ICONERROR); 
    end; 
  end; 
end; 
 
end.