Initial commit

This commit is contained in:
2026-06-12 22:37:02 +08:00
commit 94e46587da
77 changed files with 168188 additions and 0 deletions
+115
View File
@@ -0,0 +1,115 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GlobalUnit.h"
#include "ActCodeFormUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TActCodeForm *ActCodeForm = NULL;
//---------------------------------------------------------------------------
__fastcall TActCodeForm::TActCodeForm(TComponent* Owner, String code, int exp)
: TForm(Owner)
{
m_sCode = code;
m_tExpire = exp;
}
//---------------------------------------------------------------------------
void __fastcall TActCodeForm::FormCreate(TObject *Sender)
{
m_leActCode->Text = m_sCode;
m_leActCode->OnChange = OnCodeChange;
if(m_sCode.Length()){
if(!m_tExpire)
m_lbTips->Caption = "授权验证失败,请重新验证";
else if(m_tExpire < time(NULL))
m_lbTips->Caption = "授权码已过期,请延期或更换";
else{
tm* dt = localtime((long*)&m_tExpire);
m_lbTips->Caption = Format(String("有效期至:%.4d-%.2d-%.2d %.2d:%.2d"),
ARRAYOFCONST((dt->tm_year+1900, dt->tm_mon+1, dt->tm_mday, dt->tm_hour, dt->tm_min)));
}
}
else
m_lbTips->Caption = "请输入授权码并验证";
}
//---------------------------------------------------------------------------
void __fastcall TActCodeForm::OnCodeChange(TObject *Sender)
{
m_btnOk->Caption = "验证";
m_btnOk->Enabled = m_leActCode->Text.Length()>0;
if(m_tExpire>0){
m_tExpire = 0;
m_lbTips->Caption = "请输入授权码并验证";
}
}
//---------------------------------------------------------------------------
void __fastcall TActCodeForm::OnCodeKeyPress(TObject *Sender, System::WideChar &Key)
{
if(Key==13)
OnOkClick(NULL);
else if(Key<0x1E)
return;
if((Key>'9' || Key<'0') && (Key<'A' || Key>'F'))
Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TActCodeForm::OnOkClick(TObject *Sender)
{
if(m_btnOk->Caption=="关闭"){
ModalResult = mrCancel;
return;
}
String code = m_leActCode->Text;
if(code.Length()<9 || code.Length()>10){
MessageBox(Handle, L"无效的授权码", L"验证", MB_ICONERROR | MB_OK);
return;
}
for(int i=1; i<=code.Length(); i++){
char Key = code[i];
if((Key>'9' || Key<'0') && (Key<'A' || Key>'F')){
MessageBox(Handle, L"无效的授权码", L"验证", MB_ICONERROR | MB_OK);
return;
}
}
m_sCode = code;
Enabled = false;
Screen->Cursor = crHourGlass;
PostMessage(Application->MainFormHandle, UM_USERCONFIRM, UR_VERIFY, 0 );
}
//---------------------------------------------------------------------------
void __fastcall TActCodeForm::UMUserConfirm(TMessage &msg)
{
Screen->Cursor = crDefault;
Enabled = true;
if(msg.WParam==102)
m_lbTips->Caption = "无效的授权码,请重新输入";
else if(msg.WParam==106)
m_lbTips->Caption = "该授权码正在其它设备上使用";
else if(msg.WParam>0)
m_lbTips->Caption = "授权验证异常,请稍后重试";
else{
m_tExpire = (int)msg.LParam;
if(m_tExpire < time(NULL))
m_lbTips->Caption = "授权码已过期,请延期或更换";
else{
tm* dt = localtime((long*)&m_tExpire);
m_lbTips->Caption = Format(String("有效期至:%.4d-%.2d-%.2d %.2d:%.2d"),
ARRAYOFCONST((dt->tm_year+1900, dt->tm_mon+1, dt->tm_mday, dt->tm_hour, dt->tm_min)));
m_btnOk->Caption = "关闭";
}
}
}
//---------------------------------------------------------------------------
+60
View File
@@ -0,0 +1,60 @@
object ActCodeForm: TActCodeForm
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = #25480#26435
ClientHeight = 126
ClientWidth = 299
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poMainFormCenter
OnCreate = FormCreate
TextHeight = 15
object m_lbTips: TLabel
Left = 11
Top = 63
Width = 283
Height = 15
Alignment = taCenter
AutoSize = False
Caption = #35831#36755#20837#25480#26435#30721#24182#39564#35777
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object m_leActCode: TLabeledEdit
Left = 96
Top = 27
Width = 153
Height = 23
AutoSize = False
EditLabel.Width = 45
EditLabel.Height = 23
EditLabel.Hint = #35831#36755#20837#25480#26435#30721
EditLabel.Caption = #25480#26435#30721' '
EditLabel.ParentShowHint = False
EditLabel.ShowAccelChar = False
EditLabel.ShowHint = False
LabelPosition = lpLeft
TabOrder = 0
Text = ''
OnKeyPress = OnCodeKeyPress
end
object m_btnOk: TButton
Left = 113
Top = 91
Width = 75
Height = 25
Caption = #39564#35777
TabOrder = 1
OnClick = OnOkClick
end
end
+41
View File
@@ -0,0 +1,41 @@
//---------------------------------------------------------------------------
#ifndef ActCodeFormUnitH
#define ActCodeFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Mask.hpp>
#define UR_VERIFY 0x00
//---------------------------------------------------------------------------
class TActCodeForm : public TForm
{
__published: // IDE-managed Components
TLabeledEdit *m_leActCode;
TButton *m_btnOk;
TLabel *m_lbTips;
void __fastcall FormCreate(TObject *Sender);
void __fastcall OnCodeChange(TObject *Sender);
void __fastcall OnCodeKeyPress(TObject *Sender, System::WideChar &Key);
void __fastcall OnOkClick(TObject *Sender);
private: // User declarations
int m_tExpire;
MESSAGE void __fastcall UMUserConfirm(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(UM_USERCONFIRM, TMessage, UMUserConfirm)
END_MESSAGE_MAP(TForm)
public: // User declarations
String m_sCode;
__fastcall TActCodeForm(TComponent* Owner, String code, int exp);
};
//---------------------------------------------------------------------------
extern PACKAGE TActCodeForm *ActCodeForm;
//---------------------------------------------------------------------------
#endif
+352
View File
@@ -0,0 +1,352 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <System.StrUtils.hpp>
#include <System.JSON.hpp>
#include <stdio.h>
#include <time.h>
#pragma hdrstop
#include "BacABThread.h"
#include "TableUnit.h"
#include "GlobalUnit.h"
#include "UtilityUnit.h"
#include "HookJS.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
/////////////////////////////////////////////////////////////////////////////
// TAutoBetThread
__fastcall TAutoBetThread::TAutoBetThread(int iG)
{
m_iGame = iG;
}
//---------------------------------------------------------------------------
void __fastcall TAutoBetThread::Execute()
{
TGame *pGame = g_aGames.GetGame(m_iGame);
if(pGame){
for(int i=0; i<pGame->aManBets.size(); i++){ //优先处理手工下注
TManBet& rMB = pGame->aManBets[i];
if(rMB.state==ST_INIT){
rMB.state = ST_BETTING;
int ret = RealBet(pGame, rMB.chips);
if(!Terminated && ret!=0)
pGame->BetResp(ret, rMB.chips);
goto EXIT; //一个线程只处理一个下注
}
}
if(pGame->iState==ST_BETSET){
pGame->iState = ST_BETTING;
if(pGame->nChip>0 && pGame->nChip<g_MinOnBet){
pGame->BetResp(10, NULL);
goto EXIT;
}
else if(pGame->nChip>g_MaxOnBet){
pGame->BetResp(11, NULL);
goto EXIT;
}
int tmMinDelay = pGame->timeout - (pGame->timeout>15 ? 12 : 9);
if( tmMinDelay>=0 ){
int tmMin = tmMinDelay >= 2 ? 2000 : tmMinDelay * 1000,
tmMax = (pGame->timeout - (pGame->timeout>15 ? 10 : 7))*1000,
tmHalt = tmMin + Random(tmMax - tmMin);
if( tmHalt>0 && !Halt(tmHalt) )
goto EXIT;
}
if( pGame->nChip>=0 && pGame->iState==ST_BETTING && pGame->CanBet() ){//再次确认下注状态
if(g_bSimulate){
pGame->bReal = false;
if(g_settings.bSimAccOn && g_settings.bNoBetLow && g_settings.fSimAcc < pGame->nChip)
pGame->BetResp(26, NULL);
else
pGame->BetResp(0, NULL);
}
else if(!g_bTesting && g_fBalance < pGame->nChip){
pGame->BetResp(26, NULL);
}
else{
pGame->bReal = true;
if(pGame->nChip==0){
pGame->BetResp(0, NULL);
}
else{
int ret= RealBet(pGame, NULL);
if(!Terminated && ret!=0)
pGame->BetResp(ret, NULL);
}
}
}
}
}
EXIT:
if( !Terminated )
PostMessage( Application->MainFormHandle, UM_AUTOBETEND, 0, Handle );
}
//---------------------------------------------------------------------------
int __fastcall TAutoBetThread::RealBet(TGame* pG, int chips[])
{
_di_ICefFrame frame = GetCefFrame(MAIN_FRAME);
if( !frame ) return -1;
String strJS;
if( g_iPlatform==PF_PA ){
strJS = "{"
"if(VideoGameCore.LinkStoreFactory.instance){"
"const tab=VideoGameCore.LinkStoreFactory.instance.getBetTableStore('" + pG->vid + "');"
"if(tab && tab.betEnabled){";
// "console.log('======"+pG->vid+" is betEnable');";
if(chips){
for(int i=0; i<3; i++){
if(chips[i]>0){
strJS += "tab.addChipByPlayType(" + IntToStr(i+1) + "," + IntToStr(chips[i]) + ");";
}
}
}
else{
strJS += "tab.addChipByPlayType(" + IntToStr(pG->iBet) + "," + IntToStr(pG->nChip) + ");";
}
if(g_bTesting){ //测试时模拟下注反馈
int chip[3] = {0};
if(chips)
memcpy(chip, chips, sizeof(chip));
else
chip[pG->iBet-1] = pG->nChip;
strJS += "tab.cancelBet();"
"setTimeout(function(){"
"const msg = '6|"+pG->vid+"|0|"+pG->gmcode;
for(int i=0; i<3; i++)
strJS += "|" + IntToStr(chip[i]);
strJS += "';"
"cefApp.OnJSMessage(msg);"
"},1000);";
}
else{
strJS += "tab.confirmBet();";
}
strJS += "cefApp.ReturnJQValue('0');"
"}else if(!tab || tab.isGameMaintaining){"// VideoGameCore.isGameMaintain('"+pG->vid+"')){"
"cefApp.ReturnJQValue('2');";
if(g_bTesting)
strJS +=
"console.log('======"+pG->vid+" is maintaining');";
strJS +=
"}else{"
"const gms = tab.gameSnapshot ? tab.gameSnapshot.gmstatus : -1;"
"const sSkt = VideoGameCore.singleSocket;"
"const pSkt = VideoGameCore.PlazaSocket.instance;"
"cefApp.ReturnJQValue(gms>=2 && sSkt.connected ? '3' : '');";
if(g_bTesting)
strJS +=
"console.log('======"+pG->vid+" is not betEnable',"
"'gmstatus:', gms,"
"'sSkt:', sSkt.connected, sSkt.readyState,"
"'pSkt:', pSkt.connected, pSkt.readyState);";
strJS += "if(!sSkt.connected && sSkt.readyState>1){";
if(g_bTesting)
strJS += "console.log('singleSocket connect: ', sSkt.connected, sSkt.readyState);";
strJS += "sSkt.connect();"
"}"
"if(pSkt && !pSkt.connected && pSkt.readyState>1){";
if(g_bTesting)
strJS += "console.log('PlazaSocket connect: ', pSkt.connected, pSkt.readyState);";
strJS += "pSkt.connect();"
"}"
"}"
"}else{"
"cefApp.ReturnJQValue('');";
if(g_bTesting)
strJS +=
"console.log('======myGameLink closed');";
strJS +=
"}"
"}";
}
else if( g_iPlatform==PF_AB ){
strJS = "{"
"const tid = " + IntToStr(pG->iGame) + ";"
"const bts = [";
if(chips){
for(int i=0; i<3; i++){
if(chips[i]>0){
strJS += IntToStr(i+1001) + ",";// [1001|1002|1003];
}
}
}
else{
strJS += IntToStr(pG->iBet+1000); //[1001|1002|1003];
}
strJS += "];"
"const bas = [";
if(chips){
for(int i=0; i<3; i++){
if(chips[i]>0){
strJS += IntToStr(chips[i] * 100) + ",";
}
}
}
else{
strJS += IntToStr(pG->nChip * 100);
}
strJS += "];";
strJS += "const gh = Netbet.component.entity.gameHallDO.getInstance();"
"const td = gh ? gh.getTableDO(tid) : null;"
"const gst = td ? td.getCurGameStatusText(td.getGameRoundId()) : 'INVALID';"
"if(gst=='BETTING'){";
if(g_bTesting){ //测试时模拟下注反馈
int chip[3] = {0};
if(chips)
memcpy(chip, chips, sizeof(chip));
else
chip[pG->iBet-1] = pG->nChip;
strJS += "setTimeout(function(){"
"const msg = '6|" + IntToStr(pG->iGame) + "|0|" + pG->gmcode;
for(int i=0; i<3; i++)
strJS += "|" + IntToStr(chip[i]);
strJS += "';"
// "console.log(msg);"
"cefApp.OnJSMessage(msg);"
"},1000);";
}
else{
strJS += "multiTableBet(tid, bts, bas);";
}
strJS += "cefApp.ReturnJQValue('0');"
"}else{";
if(g_bTesting)
strJS +=
"console.log('==="+IntToStr(pG->iGame)+"==="+pG->vid+" status is '+gst);";
strJS +=
"cefApp.ReturnJQValue(gst=='NO_USE_STATUS'? '2' : '');"
"};"
"}";
}
else if( g_iPlatform==PF_DB ){
strJS =
"(async function(){"
"const multi = App.PresenterManager.presenterDic.dict.MultiplayPresenter;"
"if(multi && multi.model){"
"const g = multi.model.getGameTalbeInfo("+ IntToStr(pG->iGame) + ");"
"if(g){"
"if(g.gameStatus!=2){"
"cefApp.ReturnJQValue(3);"
"return;"
"}"
"let res = 0;";
if(!g_bTesting){// || g_fBalance>0){ //单独测试pushChip
if(chips){
for(int i=0; i<3; i++){
if(chips[i]>0){
strJS +=
"if(!res){"
"res = await pushChip(" + IntToStr(pG->iGame) + ","
+ IntToStr(i+1) + "," + IntToStr(chips[i]) + ");"
// "console.log('pushChip result:', res);"
"if(res){"
"cancelBet(" + IntToStr(pG->iGame) + ");"
"cefApp.ReturnJQValue(res);"
"return;"
"}"
"}";
}
}
}
else{
strJS +=
"res = await pushChip(" + IntToStr(pG->iGame) + ","
+ IntToStr(pG->iBet) + "," + IntToStr(pG->nChip) + ");"
// "console.log('pushChip:', res);"
"if(res){"
"cefApp.ReturnJQValue(res);"
"return;"
"}";
}
}
if(g_bTesting){ //测试时模拟下注反馈
int chip[3] = {0};
if(chips)
memcpy(chip, chips, sizeof(chip));
else
chip[pG->iBet-1] = pG->nChip;
strJS +=//"cancelBet(" + IntToStr(pG->iGame) + ");"
"setTimeout(function(){"
"const msg = '6|" + IntToStr(pG->iGame) + "|0|" + pG->gmcode;
for(int i=0; i<3; i++)
strJS += "|" + IntToStr(chip[i]);
strJS += "';"
"cefApp.OnJSMessage(msg);"
"},1000);";
}
else{
strJS +="sureBet(" + IntToStr(pG->iGame) + ");";
}
strJS += "cefApp.ReturnJQValue('0');"
"return;"
"}"
"}"
"cefApp.ReturnJQValue('');" //非正常状态返回
"})()";
}
// DebugPrint(((AnsiString)strJS).c_str());
int ret = -1;
while( !Terminated && pG->timeout>1 ){
String sMsg;
TStringList* strlst = GetJQValue( strJS, frame );
if( strlst ){
if(strlst->Count==1)
sMsg = (*strlst)[0];
delete strlst;
}
if(sMsg.Length()>0)
TryStrToInt(sMsg, ret);
else
DebugPrint("GetJQValue return: %s", strlst ? "''" : "null");
if( ret>=0 || !Halt(1000) ) //得到结果 或 用户cancel中途退出
break;
if(chips==NULL && g_bSimulate){ //改变了模式
if(g_settings.bSimAccOn && g_settings.bNoBetLow && g_settings.fSimAcc < pG->nChip){
pG->BetResp(26, NULL);
}
else{
pG->bReal = false;
pG->BetResp(0, NULL);
}
ret = 0;
break;
}
}
#ifdef _DEBUG
if( !Terminated && ret<0 )
DebugPrint("%s 下注超时", ((AnsiString)pG->vid).c_str());
#endif
return ret<0 ? 25 : ret;
}
/////////////////////////////////////////////////////////////////////////////
+28
View File
@@ -0,0 +1,28 @@
//---------------------------------------------------------------------------
#ifndef BacABThreadH
#define BacABThreadH
//---------------------------------------------------------------------------
#include <vector>
#include "BaseThread.h"
#include "GameUnit.h"
using namespace std;
//---------------------------------------------------------------------------
class TAutoBetThread : public TBaseThread
{
private:
int m_iGame;
int m_iOp; //0=bet, 1=gameon
int __fastcall RealBet(TGame* pG, int chips[]);
protected:
virtual void __fastcall Execute();
public:
__fastcall TAutoBetThread(int iG);
};
#endif
+495
View File
@@ -0,0 +1,495 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <stdio.h>
#include <time.h>
#pragma hdrstop
#include "BacDPThread.h"
#include "GlobalUnit.h"
#include "GameUnit.h"
#include "UtilityUnit.h"
#include "TableUnit.h"
//#include "ActiveFormUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//软件过期时间
#define TM_ABORT 125000
void __fastcall WriteData( char* msg )
{
SYSTEMTIME st;
GetLocalTime(&st);
char szDataFile[256];
sprintf( szDataFile, "%s/data/%04d%02d%02d.txt", g_AppPath, st.wYear, st.wMonth, st.wDay);
// FILE* fp = NULL;
// if(!FileExists(szDataFile)){
// fp = fopen(szDataFile, "w");
// if(fp)
// fprintf( fp, "时间,台桌,手数,结果\n" );
// }
// else{
// fp = fopen(szDataFile, "a");
// }
FILE* fp = fopen(szDataFile, "r+");
if(!fp){
fp = fopen(szDataFile, "w");
if(fp)
fprintf( fp, "时间,台桌,手数,结果\n" );
}
else
fseek(fp, 0, SEEK_END);
if( fp ){
fprintf( fp, "%02d:%02d:%02d,%s\n", st.wHour, st.wMinute, st.wSecond, msg );
fclose( fp );
}
else{
g_bBacData = false;
ShowMessage("导出数据失败! errno=" + IntToStr((int)GetLastError()));
}
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// TBetWayThread
__fastcall TDataParseThread::TDataParseThread()
{
m_hDataEvent = CreateEvent(NULL, FALSE, TRUE, NULL);
// m_tmGST = 0;
// m_tmExpire = GetCompileTime() + 30 * 86400; //编译时间后30天过期
}
//---------------------------------------------------------------------------
__fastcall TDataParseThread::~TDataParseThread()
{
CloseHandle( m_hDataEvent );
}
//---------------------------------------------------------------------------
void __fastcall TDataParseThread::Reset()
{
WaitForSingleObject(m_hDataEvent, 5000);
m_aData.clear();
SetEvent(m_hDataEvent);
}
//---------------------------------------------------------------------------
void __fastcall TDataParseThread::ParseData(String sData)
{
WaitForSingleObject(m_hDataEvent, 5000);
m_aData.push_back(sData);
SetEvent(m_hDataEvent);
Suspended = false;
}
//---------------------------------------------------------------------------
void __fastcall TDataParseThread::Execute()
{
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); //关闭系统休眠
while( !Terminated ){
while(m_aData.size()>0){
String sData = m_aData[0];
// if(sData.Length()<3){
// WaitForSingleObject(m_hDataEvent, 5000);
// m_aData.erase(m_aData.begin());
// SetEvent(m_hDataEvent);
// continue;
// }
// DebugPrint(((AnsiString)sData).c_str());
TStringDynArray arr = SplitString( sData, "|" );
if(arr.Length<2){
WaitForSingleObject(m_hDataEvent, 5000);
m_aData.erase(m_aData.begin());
SetEvent(m_hDataEvent);
continue;
}
int iType = arr[0].ToInt();
if( iType==0 ){ //连接异常断开
DebugPrint("连接异常断开");
int reason = arr[1].ToInt();
PostMessage( Application->MainFormHandle, UM_WEBDEAD, reason, 0 );
}
else if( iType==1 ){ //初始化所有台桌
DebugPrint("!!! init all tables");
g_aGames.Init(arr[1]);
PostMessage( Application->MainFormHandle, UM_ADDTABLE, 0, 0 );
}
else if( iType==2 ){ //台桌Roadmap
if(!g_aGames.empty() && arr[1].Length()){
int iG = Vid2Gid(arr[1]);
TGame* pGame = NULL;
int ind = g_aGames.FindGame(iG, pGame);
if(!pGame && iG>0){
pGame = g_aGames.NewGame(iG, arr[g_iPlatform==PF_PA ? 1 : 2], ind);
PostMessage( Application->MainFormHandle, UM_ADDTABLE, ind, (long)pGame );
}
if(pGame){
int oldSize = pGame->aRes.size(),
newSize = arr[3].Length();
if(oldSize!=newSize && oldSize!=newSize+1){
#ifdef _DEBUG
if(newSize && oldSize && (oldSize>newSize || oldSize<newSize-1)){
char res[128];
for(int i=0; i<oldSize; i++){
res[i] = pGame->aRes[i] + '0';
}
res[oldSize] = 0;
DebugPrint("!!! %s road size %d -> %d with map: %s -> %s",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
oldSize, newSize, res,
((AnsiString)arr[3]).c_str());
}
#endif
if(g_bGameOn && pGame->bRun)
pGame->AutoBetOff();
if(newSize==oldSize+1){
int wt = arr[3][newSize]-'0';
if(wt==0) wt = 3;
pGame->aRes.push_back(wt);
pGame->winCount[wt-1]++;
pGame->BuildRoadmap(wt);
}
else{
pGame->ClearResults();
for(int i=1; i<=newSize; i++){
int wt = arr[3][i]-'0';
if(wt==0) wt = 3;
pGame->aRes.push_back(wt);
pGame->winCount[wt-1]++;
pGame->BuildRoadmap(wt);
}
}
bool bUpdateRoad = true;
if(pGame->gmstatus==12){ //维护台桌
if(oldSize && !newSize) //新局
pGame->AutoBetOn(); //台桌维护中无法正常处理shuffle状态,调用该接口显示和处理新局
}
else{ //正常台桌
pGame->gmstatus = 0; //设置结算状态,避免重复计算
// pGame->gmcode = "";
if(oldSize<newSize){
pGame->HandleResult(oldSize+1==newSize ? 0 : 1); //0=正常处理 1=异常处理
bUpdateRoad = false;
}
}
if(bUpdateRoad && pGame->hTable)
PostMessage(pGame->hTable, UM_TAB_UPDATE, UPDATE_ROAD, 0);
}
}
}
}
else if( iType==3 ){ //台桌状态
// 3 | vid | gmcode | wintype(timeout)
if(!g_aGames.empty() && arr.Length>=4){
int iG = Vid2Gid(arr[1]);
TGame* pGame = NULL;
int ind = g_aGames.FindGame(iG, pGame);
if(!pGame && iG>0){
pGame = g_aGames.NewGame(iG, arr[g_iPlatform==PF_PA ? 1 : 2], ind);
PostMessage( Application->MainFormHandle, UM_ADDTABLE, ind, (long)pGame );
}
if( pGame ){
String gmcode = arr[3];
int status = arr[4].ToInt();
bool bNewStatus = pGame->gmstatus != status,
bNewCode = pGame->gmcode != gmcode;
if(!bNewCode && bNewStatus || bNewCode && (g_iPlatform!=PF_PA
|| gmcode=="" || gmcode > pGame->gmcode)){
#ifdef _DEBUG
if( bNewCode && status!=1 && status<11 && (g_iPlatform!=PF_AB || status!=0) && pGame->gmcode.Length()){
DebugPrint("!!! %s gmcode %s -> %s with status: %d",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
((AnsiString)pGame->gmcode).c_str(),
((AnsiString)gmcode).c_str(),
status);
}
#endif
if(bNewCode)
pGame->gmcode = gmcode;
// pGame->timeout = 0;
if(bNewStatus && pGame->gmstatus==1){
pGame->ManualBetOff();
if(g_bGameOn && pGame->bRun)
pGame->AutoBetOff();
}
if(status==0 && !bNewCode){ //结算
#ifdef _DEBUG
if(pGame->gmstatus!=2 && (g_iPlatform!=PF_AB || pGame->gmstatus!=11))
DebugPrint("!!! %s status %d -> %d",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
pGame->gmstatus, status);
#endif
pGame->gmstatus = status;
if(arr.Length>=8){ //DB特殊处理
if(arr[6].Length()){
pGame->bcard = UnifyCard(arr[6]);
pGame->pcard = UnifyCard(arr[7]);
}
else
pGame->bcard = pGame->pcard = "";
}
int wt = 0;
if(arr.Length>=6 && arr[5].Length()){
wt = arr[5][1]-'0';
if(wt==0) wt = 3;
}
if(wt>0){
pGame->aRes.push_back(wt);
pGame->winCount[wt-1]++;
pGame->BuildRoadmap(wt);
pGame->HandleResult();
if(g_bBacData){
char data[128];
sprintf(data, "%s,%d,%s",
((AnsiString)arr[g_iPlatform==PF_PA ? 1 : 2]).c_str(),
pGame->aRes.size(), wt==1 ? "" : wt==2 ? "" : "");
WriteData( data );
}
}
}
else if(status==1 && bNewStatus){// && pGame->gmstatus!=2){ //开始下注
#ifdef _DEBUG
if(pGame->gmstatus!=0 && pGame->gmstatus<11)
DebugPrint("!!! %s status %d -> %d",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
pGame->gmstatus, status);
#endif
if(bNewStatus && bNewCode && pGame->iState==ST_BETTED){
DebugPrint("!!! %s status %d -> %d with betted",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
pGame->gmstatus, status);
pGame->HandleResult(2);
}
pGame->gmstatus = status;
pGame->timeout = g_iPlatform==PF_AB ? pGame->countdown
: g_iPlatform==PF_DB ? arr[5].ToInt() / 1000
: arr[5].ToInt();
pGame->AutoBetOn();
}
else if(status==2 && !bNewCode){// && pGame->gmstatus==1 ){ //开牌中
#ifdef _DEBUG
if(pGame->gmstatus!=1)
DebugPrint("!!! %s status %d -> %d",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
pGame->gmstatus, status);
#endif
pGame->gmstatus = status;
if(pGame->iState==ST_BETTED)
pGame->timeout = -1; //开始计算超时
pGame->bcard = pGame->pcard = "";
}
else if((status==11 || status==12) && bNewStatus){ //洗牌/维护
if(pGame->iState==ST_BETTED || pGame->iState==ST_EXPIRED){ //超时
DebugPrint("!!! %s status %d -> %d with betted",
((AnsiString)pGame->vid).c_str(),
// ((AnsiString)arr[1]).c_str(),
pGame->gmstatus, status);
pGame->HandleResult(status==12 ? 3 : 2);
}
pGame->gmstatus = status;
if(status==11){
pGame->Shuffle();
if(g_bBacData){
char data[128];
sprintf(data, "%s,,%s",
((AnsiString)arr[g_iPlatform==PF_PA ? 1 : 2]).c_str(),
"洗牌");
WriteData( data );
}
}
else{
pGame->iState = ST_INIT;
#ifdef _DEBUG
DebugPrint("!!! %s 台桌维护中", ((AnsiString)pGame->vid).c_str());//, ((AnsiString)arr[1]).c_str());
SendMessage( Application->MainFormHandle, UM_RESTORE, 0, 0 );
#endif
}
}
if(pGame->hTable)
PostMessage(pGame->hTable, UM_TAB_UPDATE, UPDATE_STATUS, 0);
}
}
}
}
else if(iType==4){ //多台状态
//4 | e.payload.vid
DebugPrint("Enter HALL: %s", ((AnsiString)arr[1]).c_str());
int tab = 2;
if(g_iPlatform==PF_PA){
tab = arr[1]=="LINK" ? 1 : arr[1]=="LOBB" ? 0 : 2;
}
else if(g_iPlatform==PF_AB){
int hId = arr[1].ToInt();
tab = hId==102 ? 1 : hId==100 ? 0 : 2;
}
else if(g_iPlatform==PF_DB){
int hId = arr[1].ToInt();
tab = hId==2 ? 1 : hId==0 ? 0 : 2;
}
PostMessage(Application->MainFormHandle, UM_ENTER_TABLE, tab, 0);
}
else if(iType==5){ //账户余额
//5 | e.val
double amo;
if(TryStrToFloat(arr[1], amo)){
if(!(g_bTesting && g_settings.bSimAccOn)){
g_fBalance = amo;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BALANCE, 0);
}
}
}
else if(iType==6){ //下注反馈
//6 | vid | retCode | gmcode | 庄 | 闲 | 平
if(!g_aGames.empty() && arr[1].Length()){
int iG = Vid2Gid(arr[1]);
TGame* pGame = NULL;
int ind = g_aGames.FindGame(iG, pGame);
if(pGame && pGame->gmcode==arr[3]){
int chips[3] = {0};
chips[0] = arr[4].ToInt();
chips[1] = arr[5].ToInt();
chips[2] = arr[6].ToInt();
int retCode = arr[2].ToInt();
if(retCode!=0){
if(g_iPlatform==PF_AB) //欧博错误码转换
retCode = retCode==101 ? 10 //限红低
: retCode==102 ? 11 //限红高
: retCode==103 || retCode==100015 || retCode==6044 ? 25 //超时
: retCode==10101 || retCode==6035 || retCode==6042 ? 26 //余额不足
: -1;
else if(g_iPlatform==PF_DB) //多宝错误码转换
retCode = retCode==210010 ? 10 //限红低
: retCode==220030 ? 11 //限红高
: retCode==220004 || retCode==220006 || retCode==110041 ? 25 //超时
: retCode==10469 || retCode==20126 ? 26 //余额不足
: retCode;
}
pGame->BetResp(retCode, chips);
}
}
}
else if(iType==7){ //限额
//7 | min | max
int minBet, maxBet;
if(TryStrToInt(arr[1], minBet) && TryStrToInt(arr[2], maxBet)){
if(minBet!=g_MinOnBet || maxBet!=g_MaxOnBet){
g_MinOnBet = minBet;
g_MaxOnBet = maxBet;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_LIMIT, 0);
}
}
}
else if(iType==8){ //倒计时
//8 | countdownList ABG专用
if(!g_aGames.empty() && arr[1].Length()){
g_aGames.SetCountDown(arr[1]);
}
}
else if(iType==9){ //翻牌
//9 | gid | gmcode | bcard | pcard
if(!g_aGames.empty() && !arr[1].IsEmpty() && (!arr[3].IsEmpty() || !arr[4].IsEmpty())){
int iG = Vid2Gid(arr[1]);
TGame* pGame = NULL;
int ind = g_aGames.FindGame(iG, pGame);
if(pGame && pGame->gmstatus==2 && pGame->gmcode==arr[2]){
pGame->bcard = UnifyCard(arr[3]);
pGame->pcard = UnifyCard(arr[4]);
if(pGame->hTable)
PostMessage(pGame->hTable, UM_TAB_UPDATE, UPDATE_STATUS, 0);
if(pGame->iState==ST_BETTED)
pGame->timeout = -1; //重新计算超时
}
}
}
// else if(iType==10){ //撤销注单
// //10 | gid | gmcode
// if(!g_aGames.empty() && arr[1].Length()){
// int iG = Vid2Gid(arr[1]);
// TGame* pGame = NULL;
// int ind = g_aGames.FindGame(iG, pGame);
//
// if(pGame && pGame->gmcode==arr[2]){
// DebugPrint("!!! %s 撤销注单 with status: %d",
// ((AnsiString)pGame->vid).c_str(),
//// ((AnsiString)arr[1]).c_str(),
// pGame->gmstatus);
// pGame->gmstatus = 0;
// pGame->HandleResult(3);
// }
// }
// }
m_aData[0] = "";
if( Terminated )
break;
WaitForSingleObject(m_hDataEvent, 5000);
m_aData.erase(m_aData.begin());
SetEvent(m_hDataEvent);
}
// 等待数据
if( !Terminated )
Suspended = true;
};
SetThreadExecutionState( ES_CONTINUOUS );//打开系统休眠
}
//---------------------------------------------------------------------------
+29
View File
@@ -0,0 +1,29 @@
//---------------------------------------------------------------------------
#ifndef BacDPThreadH
#define BacDPThreadH
//#include <System.JSON.hpp>
#include <vector>
#include "BaseThread.h"
//---------------------------------------------------------------------------
using namespace std;
class TDataParseThread : public TBaseThread
{
private:
HANDLE m_hDataEvent; // Êý¾Ý´¦Àí»¥³â±äÁ¿
vector<String> m_aData;
protected:
virtual void __fastcall Execute();
public:
__fastcall TDataParseThread();
__fastcall ~TDataParseThread();
void __fastcall ParseData(String sData);
void __fastcall Reset();
};
#endif
+162
View File
@@ -0,0 +1,162 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "BacJSThread.h"
#include "UtilityUnit.h"
#include "GlobalUnit.h"
#include "GameUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
/////////////////////////////////////////////////////////////////////////////
// TAutoBetThread
__fastcall TJSHandleThread::TJSHandleThread(int iOp)
{
m_op = iOp;
}
//---------------------------------------------------------------------------
void __fastcall TJSHandleThread::Execute()
{
int ret = 0;
if( m_op==JS_OP_CHECKCEF )
ret = CheckCEF();
// else if( m_op==JS_OP_GETIPADDR )
// ret = GetIPAddr();
else if( m_op>=JS_OP_WSHANDLE0 && m_op<=JS_OP_WSHANDLE3 )
ret = GetWSHandle();
else if( m_op==JS_OP_GAMEON )
ret = GameOn();
if( !Terminated )
PostMessage( Application->MainFormHandle, UM_JSHANDLED, m_op, ret );
}
//---------------------------------------------------------------------------
int __fastcall TJSHandleThread::CheckCEF()
{
int iRet = -1;
for( int i=0; i<10; i++ ){
if( GlobalCEFApp && GlobalCEFApp->GlobalContextInitialized ){
iRet = 1;
break;
}
if( !Halt(500) )
break;
}
return iRet;
}
//---------------------------------------------------------------------------
int __fastcall TJSHandleThread::GetWSHandle()
{
int iRet = -1;
_di_ICefFrame frame = GetCefFrame(MAIN_FRAME);
if( frame ){
String sQuery;
if( g_iPlatform==PF_PA ){
sQuery = "{"
"let iRet = -1;"
"if(Core.LoginStore.instance && VideoGameCore.PlazaSocket.instance){"
"if(Core.LoginStore.instance.loginDone)"
"iRet = VideoGameCore.PlazaSocket.instance.readyState;"
"else "
"iRet = -3;"
"}"
"if(!iRet) iRet = -1;"
"cefApp.ReturnJQValue(iRet);"
"}";
}
else if( g_iPlatform==PF_AB ){
sQuery = "{"
"let iRet = -1;"
"if(Netbet && Netbet.component && Netbet.component.entity"
"&& Netbet.component.entity.manager && Netbet.component.entity.manager.ServiceManager){"
"const instSM = Netbet.component.entity.manager.ServiceManager.getInstance();"
"if(instSM && instSM.isConnected()){"
"const instUD = Netbet.component.entity.UserDO.getInstance();"
"if(instUD && instUD.getLoginSuccessTime()) iRet = 1;"
"else console.log('not login');"
"}"
"else console.log('not connect to Server');"
"}"
"else console.log(!Netbet ? 'no Netbet' : !Netbet.component ? 'no component'"
": !Netbet.component.entity ? 'no entity'"
": !Netbet.component.entity.manager ? 'no manager' : 'no service');"
"cefApp.ReturnJQValue(iRet);"
"}";
}
else if( g_iPlatform==PF_DB ){
sQuery = "{"
"let iRet = -1;"
"if(typeof App!='undefined' && App.Socket){"
"const status = App.Socket.status;"
"console.log('App.Socket.status=', status);"
"if(status==2 && App.user && App.gameManager && App.setting) "
"iRet = 1;"
"else if(status==3){"
"const reason = App.Socket._reConnectReason;"
"console.log('App.Socket._reConnectReason=', reason);"
"iRet = 3;"
"}"
"};"
"cefApp.ReturnJQValue(iRet);"
"}";
}
for( int i=0; i<60 && !Terminated; i++ ){
DebugPrint( "Try to steal websocket data step %d", m_op );
String sRet;
TStringList* strlst = GetJQValue( sQuery, frame );
if( strlst ){
if(strlst->Count==1)
sRet = (*strlst)[0];
delete strlst;
}
DebugPrint("GetJQValue return: %s", strlst ? "sRet" : "null");
if(!sRet.IsEmpty() )
TryStrToInt(sRet, iRet);
if( iRet>0 || !Halt(g_iPlatform==PF_AB ? 800 : 500) )
break;
}
}
if(iRet==3) iRet = -3;
return iRet;
}
//---------------------------------------------------------------------------
int __fastcall TJSHandleThread::GameOn()
{
if( !Halt(100) )
return 0;
for( int i=0; i<g_aGames.size() && !Terminated && g_bGameOn; i++ ){
TGame* pG = g_aGames[i];
if(pG->bRun){
pG->GameOn();
if( !Halt(10) )
break;
}
}
return 0;
}
//---------------------------------------------------------------------------
+36
View File
@@ -0,0 +1,36 @@
//---------------------------------------------------------------------------
#ifndef BacJSThreadH
#define BacJSThreadH
#include "BaseThread.h"
//---------------------------------------------------------------------------
// Êý¾Ý´¦ÀíÏß³Ì
#define JS_OP_CHECKCEF 0
#define JS_OP_WSHANDLE0 1
#define JS_OP_WSHANDLE1 2
#define JS_OP_WSHANDLE2 3
#define JS_OP_WSHANDLE3 4
#define JS_OP_GAMEON 5
//#define JS_OP_TOMULTI 3
class TJSHandleThread : public TBaseThread
{
private:
int __fastcall CheckCEF();
int __fastcall GetWSHandle();
int __fastcall GameOn();
public:
int m_op;
String m_sRet;
__fastcall TJSHandleThread(int iOp);
// __fastcall ~TJSHandleThread();
void __fastcall Execute();
};
#endif
+22
View File
@@ -0,0 +1,22 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Bet02FrameUnit.h"
#include "PolicyUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TBet02Frame *Bet02Frame = NULL;
//---------------------------------------------------------------------------
__fastcall TBet02Frame::TBet02Frame(TComponent* Owner)
: TFrame(Owner)
{
m_rgs[0] = m_rgB3R;
m_rgs[1] = m_rgP3R;
for(int i=0; i<2; i++)
m_rgs[i]->ItemIndex = g_BPAskBet.bet[i];
}
//---------------------------------------------------------------------------
+79
View File
@@ -0,0 +1,79 @@
object Bet02Frame: TBet02Frame
Left = 0
Top = 0
Width = 384
Height = 310
TabOrder = 0
object Label1: TLabel
Left = 40
Top = 24
Width = 117
Height = 15
Caption = #20869#32622#25171#27861#65306#24196#38386#38382#36335
end
object Label2: TLabel
Left = 55
Top = 92
Width = 96
Height = 20
Caption = #24196#38382#36335#20840#32418#65306
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object Label3: TLabel
Left = 55
Top = 144
Width = 96
Height = 20
Caption = #38386#38382#36335#20840#32418#65306
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object m_rgB3R: TRadioGroup
Left = 151
Top = 74
Width = 210
Height = 40
Columns = 3
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
Items.Strings = (
#19981#25171
#25171#24196
#25171#38386)
ParentFont = False
ShowFrame = False
TabOrder = 0
end
object m_rgP3R: TRadioGroup
Tag = 1
Left = 151
Top = 126
Width = 210
Height = 40
Columns = 3
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
Items.Strings = (
#19981#25171
#25171#24196
#25171#38386)
ParentFont = False
ShowFrame = False
TabOrder = 1
end
end
+28
View File
@@ -0,0 +1,28 @@
//---------------------------------------------------------------------------
#ifndef Bet02FrameUnitH
#define Bet02FrameUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TBet02Frame : public TFrame
{
__published: // IDE-managed Components
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TRadioGroup *m_rgB3R;
TRadioGroup *m_rgP3R;
private: // User declarations
public: // User declarations
TRadioGroup *m_rgs[2];
__fastcall TBet02Frame(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TBet02Frame *Bet02Frame;
//---------------------------------------------------------------------------
#endif
+68
View File
@@ -0,0 +1,68 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Bet03FrameUnit.h"
#include "PolicyUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TBet03Frame *Bet03Frame = NULL;
//---------------------------------------------------------------------------
__fastcall TBet03Frame::TBet03Frame(TComponent* Owner)
: TFrame(Owner)
{
m_leBlP->Text = g_BPDiffBet.diff[0];
m_lePlB->Text = g_BPDiffBet.diff[1];
// m_rgBlP->ItemIndex = g_BPDiffBet.bet[0] - 1;
// m_rgPlB->ItemIndex = g_BPDiffBet.bet[1] - 1;
m_edBlP->Text = g_BPDiffBet.bets[0];
m_edPlB->Text = g_BPDiffBet.bets[1];
}
//---------------------------------------------------------------------------
void __fastcall TBet03Frame::DiffEditExit(TObject *Sender)
{
TEdit* pE = (TEdit*)Sender;
int num = 0;
if(!TryStrToInt(pE->Text, num) || num<=0 || num>=30 ){
ShowMessage("请输入 1 - 30 之间的差值");
pE->Text = "5";
pE->SetFocus();
}
}
//---------------------------------------------------------------------------
void __fastcall TBet03Frame::BetEditKeyPress(TObject *Sender, System::WideChar &Key)
{
if(Key<0x1E)
return;
if(Key!='a' && Key!='s' && Key!='d' && Key!='x' && Key!='z')
Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TBet03Frame::BetEditExit(TObject *Sender)
{
TEdit* pE = (TEdit*)Sender;
String txt = pE->Text;
if(txt.Length()==0 || txt.Length()>15){
ShowMessage("请输入 1 - 15 个下注项");
pE->Text = pE==m_edBlP ? g_BPDiffBet.bets[0] : g_BPDiffBet.bets[1];
pE->SetFocus();
}
else{
for(int i=1; i<=txt.Length(); i++){
char Key = txt[i];
if(Key!='a' && Key!='s' && Key!='d' && Key!='x' && Key!='z'){
ShowMessage("请按说明输入合法下注项");
pE->SetFocus();
return;
}
}
}
}
//---------------------------------------------------------------------------
+170
View File
@@ -0,0 +1,170 @@
object Bet03Frame: TBet03Frame
Left = 0
Top = 0
Width = 384
Height = 310
TabOrder = 0
object Label1: TLabel
Left = 40
Top = 24
Width = 104
Height = 15
Caption = #20869#32622#25171#27861#65306#24196#38386#24046
end
object Label2: TLabel
Left = 152
Top = 91
Width = 101
Height = 20
AutoSize = False
Caption = #20010#21450#20197#19978#19979#27880
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object Label3: TLabel
Left = 152
Top = 155
Width = 101
Height = 20
AutoSize = False
Caption = #20010#21450#20197#19978#19979#27880
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlue
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object m_leBlP: TLabeledEdit
Left = 109
Top = 88
Width = 39
Height = 28
Hint = '1 - 30 '#20043#38388#30340#24046#20540
Alignment = taCenter
EditLabel.Width = 64
EditLabel.Height = 28
EditLabel.Caption = #24196#27604#38386#22810
EditLabel.Font.Charset = DEFAULT_CHARSET
EditLabel.Font.Color = clRed
EditLabel.Font.Height = -15
EditLabel.Font.Name = 'Segoe UI'
EditLabel.Font.Style = []
EditLabel.ParentFont = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
LabelPosition = lpLeft
MaxLength = 2
NumbersOnly = True
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
Text = '5'
OnExit = DiffEditExit
end
object m_lePlB: TLabeledEdit
Left = 109
Top = 152
Width = 39
Height = 28
Hint = '1 - 30 '#20043#38388#30340#24046#20540
Alignment = taCenter
EditLabel.Width = 64
EditLabel.Height = 28
EditLabel.Caption = #38386#27604#24196#22810
EditLabel.Font.Charset = DEFAULT_CHARSET
EditLabel.Font.Color = clBlue
EditLabel.Font.Height = -15
EditLabel.Font.Name = 'Segoe UI'
EditLabel.Font.Style = []
EditLabel.ParentFont = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlue
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
LabelPosition = lpLeft
MaxLength = 2
NumbersOnly = True
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
Text = '5'
OnExit = DiffEditExit
end
object m_edBlP: TEdit
Left = 257
Top = 88
Width = 88
Height = 28
Hint = #28165#36755#20837'1-15'#20010#19979#27880#39033
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 2
Text = 'a'
OnExit = BetEditExit
OnKeyPress = BetEditKeyPress
end
object m_edPlB: TEdit
Left = 257
Top = 152
Width = 88
Height = 28
Hint = #28165#36755#20837'1-15'#20010#19979#27880#39033
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 3
Text = 's'
OnExit = BetEditExit
OnKeyPress = BetEditKeyPress
end
object StaticText1: TStaticText
Left = 46
Top = 223
Width = 238
Height = 19
Caption = #35828#26126#65306#19979#27880#39033#20026#19968#20010#25110#22810#20010#20197#19979#26377#25928#23383#27597
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
TabOrder = 4
end
object StaticText2: TStaticText
Left = 46
Top = 249
Width = 299
Height = 19
Caption = #65288' a='#24196#65292's='#38386#65292'd='#21644#65292'x='#26412#25163#19981#19979#65292'z='#26412#23616#32467#26463' '#65289
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
TabOrder = 5
end
end
+35
View File
@@ -0,0 +1,35 @@
//---------------------------------------------------------------------------
#ifndef Bet03FrameUnitH
#define Bet03FrameUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Mask.hpp>
//---------------------------------------------------------------------------
class TBet03Frame : public TFrame
{
__published: // IDE-managed Components
TLabel *Label1;
TLabeledEdit *m_leBlP;
TLabel *Label2;
TLabeledEdit *m_lePlB;
TLabel *Label3;
TEdit *m_edBlP;
TEdit *m_edPlB;
TStaticText *StaticText1;
TStaticText *StaticText2;
void __fastcall DiffEditExit(TObject *Sender);
void __fastcall BetEditKeyPress(TObject *Sender, System::WideChar &Key);
void __fastcall BetEditExit(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TBet03Frame(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TBet03Frame *Bet03Frame;
//---------------------------------------------------------------------------
#endif
+447
View File
@@ -0,0 +1,447 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <DateUtils.hpp>
#include "BetLogFormUnit.h"
#include "GlobalUnit.h"
#include "UtilityUnit.h"
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TBetLogForm *BetLogForm = NULL;
vector<TBetLog*> g_aBetLogs; //挂机日志
//---------------------------------------------------------------------------
__fastcall TBetLogForm::TBetLogForm(TComponent* Owner)
: TForm(Owner)
{
m_nShowRows = 0;
m_bAutoScroll = true;
m_bSearch = false;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormCreate(TObject *Sender)
{
m_dg->ColWidths[0] = DPIX(120);
m_dg->ColWidths[1] = m_dg->ClientWidth - m_dg->ColWidths[0];
m_dg->Canvas->Font = m_dg->Font;
/////////////////////////////////////////////////////
// test
// int ts = DateTimeToUnix(Now(), false);
// for(int i=0; i<200; i++){
// TBetLog* pLog = new TBetLog;
// pLog->ts = ts++;
// pLog->ev = LOGEVT_START;
// g_aBetLogs.push_back(pLog);
// }
//
////////////////////////////////////////////////////
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormResize(TObject *Sender)
{
int nRows = m_dg->ClientHeight / m_dg->DefaultRowHeight;
if(nRows!=m_nShowRows){
m_nShowRows = nRows;
m_bAutoScroll = (m_dg->TopRow + m_nShowRows) >= m_dg->RowCount;
ShowLogs();
}
int nBlank = m_dg->ClientHeight % m_dg->DefaultRowHeight;
if(nBlank)
ClientHeight -= nBlank;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
ResetIdle();
if(m_sbSearch->Focused()){
if(Key=='A' && Shift.Contains( ssCtrl )){
SearchSelAll();
}
else if(Key==VK_ESCAPE){
m_dg->SetFocus();
}
}
else if(m_dg->ScrollBars==ssVertical){
if(Key==VK_UP){
m_dg->Perform(WM_VSCROLL,SB_LINEUP,0);
}
else if(Key==VK_DOWN){
m_dg->Perform(WM_VSCROLL,SB_LINEDOWN,0);
}
else if(Key==VK_HOME){
m_dg->Perform(WM_VSCROLL,SB_TOP,0);
}
else if(Key==VK_END){
m_dg->Perform(WM_VSCROLL,SB_BOTTOM,0);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::ShowLogs()
{
LockWindowUpdate( m_dg->Handle );
vector<TBetLog*>& aLogs = m_bSearch ? m_aSearchLogs : g_aBetLogs;
if( aLogs.size()+1 < m_nShowRows ){
if(m_dg->RowCount!=m_nShowRows){
m_dg->RowCount = m_nShowRows;
m_dg->ScrollBars = ssNone;
m_bAutoScroll = true;
if(m_dg->TopRow>0){
m_dg->OnTopLeftChanged = NULL;
m_dg->TopRow = 0;
m_dg->OnTopLeftChanged = LogsTopChanged;
}
}
else{
m_dg->Invalidate();
}
}
else{
m_dg->RowCount = aLogs.size() + 1;
if(m_dg->ScrollBars==ssNone)
m_dg->ScrollBars = ssVertical;
if(m_bAutoScroll){
m_dg->OnTopLeftChanged = NULL;
m_dg->TopRow = m_dg->RowCount - m_nShowRows;
m_dg->OnTopLeftChanged = LogsTopChanged;
}
}
LockWindowUpdate( NULL );
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormClose(TObject *Sender, TCloseAction &Action)
{
BetLogForm->Hide();
delete BetLogForm;
BetLogForm = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled)
{
m_dg->Perform(WM_VSCROLL,SB_LINEDOWN,0);
Handled = true;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled)
{
m_dg->Perform(WM_VSCROLL,SB_LINEUP,0);
Handled = true;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::UMLogUpdate(TMessage &msg)
{
if(m_bSearch){
String sT = m_sSearch.UpperCase();
for(int i=m_iSearchEnd; i<g_aBetLogs.size(); i++){
TBetLog* pLog = g_aBetLogs[i];
String txt = GetLogText(pLog, 0xFF);
if(txt.Pos(sT)>0)
m_aSearchLogs.push_back(pLog);
}
m_iSearchEnd = g_aBetLogs.size();
}
ShowLogs();
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::ClearClick(TObject *Sender)
{
m_sbSearch->Text = "";
m_sbSearch->Modified = false;
m_aSearchLogs.clear();
m_bSearch = false;
for(int i=0; i<g_aBetLogs.size(); i++)
delete g_aBetLogs[i];
g_aBetLogs.clear();
ShowLogs();
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SaveClick(TObject *Sender)
{
TSaveDialog *pDlg = new TSaveDialog(this);
pDlg->Filter = "文本文件(*.txt)|*.txt;";
if(pDlg->Execute(Application->MainFormHandle)){
try{
String name = pDlg->FileName;
if(ExtractFileExt(name)!='.txt')
name = ChangeFileExt(name, ".txt");
FILE* fp = fopen( ((AnsiString)name).c_str(), "w" );
if(fp){
vector<TBetLog*>& aLogs = m_bSearch ? m_aSearchLogs : g_aBetLogs;
for(int i=0; i<aLogs.size(); i++){
TBetLog* pLog = aLogs[i];
String txt = GetLogText(pLog, 0xFF);
fprintf(fp, "%s\n", ((AnsiString)txt).c_str());
}
fclose(fp);
}
MessageBox(Application->MainFormHandle, L"文件保存成功", L"保存",
MB_ICONINFORMATION | MB_OK);
}
catch(Exception &exception){
String str = "文件保存失败!\n"+exception.Message;
MessageBox(Application->MainFormHandle, str.c_str(), L"保存",
MB_ICONERROR | MB_OK);
}
}
delete pDlg;
}
//---------------------------------------------------------------------------
String __fastcall TBetLogForm::GetLogText(TBetLog* pLog, int iCol)
{
String txt;
if(pLog){
if(iCol==0 || iCol==0xFF){
TDateTime dt = UnixToDateTime(pLog->ts,false);
txt = dt.FormatString("mm-dd hh:nn:ss ");
}
if(iCol==1 || iCol==0xFF){
txt += pLog->tno;
if(pLog->ev==LOGEVT_START){
txt += "开始挂机 ";
txt += g_bSimulate ? "模拟" : "实打";
if(g_settings.bWaitNew)
txt += " 新局";
if(g_settings.bInitBetChipByStart)
txt += " 重置";
if(g_settings.iFloatMode>0)
txt += " 游台";
}
else if(pLog->ev==LOGEVT_END){
if(pLog->op==1)
txt += "总体止赢 ";
else if(pLog->op==2)
txt += "总体止损 ";
else if(pLog->op==3)
txt += "本金不足 ";
else if(pLog->op==4)
txt += "游台爆缆 ";
else if(pLog->op==5)
txt += "账户止赢 ";
else if(pLog->op==6)
txt += "账户止损 ";
else if(pLog->op==7)
txt += "动态止损 ";
else if(pLog->op==8)
txt += "总体阶梯爆缆 ";
if(pLog->op==4 || pLog->op==8)
txt += "台桌停止";
else
txt += "停止挂机";
}
else if(pLog->ev==LOGEVT_RESET){
if(pLog->op==-1){
txt += "恢复";
}
else if(pLog->op==0){
txt += "重置当期赢利";
}
else{
if(pLog->op==1)
txt += "总体止赢 ";
else if(pLog->op==2)
txt += "总体止损 ";
else if(pLog->op==7)
txt += "动态止损 ";
if(pLog->num)
txt += "新局重启";
else{
int nPause = pLog->op==7 ? g_settings.nU2DPause
: pLog->op==1 ? g_settings.nTotalWinPause
: g_settings.nTotalLosPause;
txt += "暂停" + IntToStr(nPause) + "分钟";
}
}
}
else if(pLog->ev==LOGEVT_ROUND){
txt += " 新局 ";
}
else if(pLog->ev==LOGEVT_BET){
if(pLog->op==0)
txt += " 本手不下";
else if(pLog->op==4)
txt += " 本局停止";
else{
txt += " 下注 ";
txt += pLog->op==1 ? "" : pLog->op==2 ? "" : "";
txt += IntToStr(pLog->num);
}
}
else if(pLog->ev==LOGEVT_RES){
txt += " 结算 ";
txt += pLog->op==1 ? "" : pLog->op==2 ? "" : "";
txt += IntToStr(pLog->num);
}
else if(pLog->ev==LOGEVT_DEAD || pLog->ev==LOGEVT_STOPWIN || pLog->ev==LOGEVT_STOPLOS){
if(pLog->ev==LOGEVT_DEAD)
txt += " 爆缆 ";
else if(pLog->ev==LOGEVT_STOPWIN)
txt += " 止赢 ";
else
txt += " 止损 ";
if(pLog->op==2){
if(pLog->num)
txt += "暂停" + IntToStr(pLog->num) + "分钟";
else
txt += "立即重启";
}
else if(pLog->op==1)
txt += "新局重启";
else
txt += "本桌停止";
}
else if(pLog->ev==LOGEVT_SWITCH){
if(pLog->op)
txt += "实打转模拟";
else
txt += "模拟转实打";
}
else if(pLog->ev==LOGEVT_QUASH){
txt += " 注单撤销";
}
}
}
return txt;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsDrawCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, TRect &Rect, TGridDrawState State)
{
m_dg->Canvas->Brush-> Color = Graphics::clNone;
m_dg->Canvas->FillRect(Rect);
vector<TBetLog*>& aLogs = m_bSearch ? m_aSearchLogs : g_aBetLogs;
if(ARow<aLogs.size()){
TBetLog* pLog = aLogs[ARow];
TColor clr = pLog->ev==LOGEVT_ROUND ? clLime
: pLog->ev==LOGEVT_BET ? clAqua
: (pLog->ev==LOGEVT_RES || pLog->ev==LOGEVT_QUASH) ? clWebPink
: pLog->ev==LOGEVT_DEAD || pLog->ev==LOGEVT_STOPWIN || pLog->ev==LOGEVT_STOPLOS ? clRed
: clYellow;
m_dg->Canvas->Font->Color = clr;
String txt = GetLogText(pLog, ACol);
TSize szTxt = m_dg->Canvas->TextExtent(txt);
int x = Rect.left + 2,
y = Rect.top;
y += (Rect.Height() - szTxt.cy) / 2;// -- 垂直居中
m_dg->Canvas->TextOut(x,y,txt);
}
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsTopChanged(TObject *Sender)
{
m_bAutoScroll = (m_dg->TopRow + m_nShowRows) >= m_dg->RowCount;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsSelectCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, bool &CanSelect)
{
CanSelect = false;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SearchInvokeSearch(TObject *Sender)
{
if(m_sbSearch->Modified){
m_sbSearch->Modified = false;
m_aSearchLogs.clear();
m_sSearch = m_sbSearch->Text;
if(m_sSearch.Length()){
String sT = m_sSearch.UpperCase();
for(int i=0; i<g_aBetLogs.size(); i++){
TBetLog* pLog = g_aBetLogs[i];
String txt = GetLogText(pLog, 0xFF);
if(txt.Pos(sT)>0)
m_aSearchLogs.push_back(pLog);
}
m_iSearchEnd = g_aBetLogs.size();
m_bSearch = true;
m_bAutoScroll = false;
m_dg->TopRow = 0;
}
else{
m_bSearch = false;
m_bAutoScroll = true;
m_dg->SetFocus();
}
ShowLogs();
}
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SearchExit(TObject *Sender)
{
m_sbSearch->Text = m_sSearch;
m_sbSearch->Color = clWhite;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SearchEnter(TObject *Sender)
{
m_sbSearch->Color = clWebCornSilk;
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SearchDblClick(TObject *Sender)
{
SearchSelAll();
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::SearchSelAll()
{
if(m_sbSearch->Text.Length()){
m_sbSearch->SelStart = 0;
m_sbSearch->SelLength = m_sbSearch->Text.Length();
}
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormDeactivate(TObject *Sender)
{
if(Showing && m_sbSearch->Color!=clWhite)
SearchExit(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::FormActivate(TObject *Sender)
{
m_dg->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TBetLogForm::LogsMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
ResetIdle();
}
//---------------------------------------------------------------------------
+129
View File
@@ -0,0 +1,129 @@
object BetLogForm: TBetLogForm
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
Caption = #25346#26426#26085#24535
ClientHeight = 475
ClientWidth = 354
Color = clBtnFace
CustomTitleBar.Control = m_tbp
CustomTitleBar.Enabled = True
CustomTitleBar.Height = 31
CustomTitleBar.BackgroundColor = clWhite
CustomTitleBar.ForegroundColor = 65793
CustomTitleBar.InactiveBackgroundColor = clWhite
CustomTitleBar.InactiveForegroundColor = 10066329
CustomTitleBar.ButtonForegroundColor = 65793
CustomTitleBar.ButtonBackgroundColor = clWhite
CustomTitleBar.ButtonHoverForegroundColor = 65793
CustomTitleBar.ButtonHoverBackgroundColor = 16053492
CustomTitleBar.ButtonPressedForegroundColor = 65793
CustomTitleBar.ButtonPressedBackgroundColor = 15395562
CustomTitleBar.ButtonInactiveForegroundColor = 10066329
CustomTitleBar.ButtonInactiveBackgroundColor = clWhite
Constraints.MaxWidth = 370
Constraints.MinWidth = 370
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
GlassFrame.Enabled = True
GlassFrame.Top = 31
KeyPreview = True
Position = poDesigned
StyleElements = [seFont, seClient]
StyleName = 'Windows'
OnActivate = FormActivate
OnClose = FormClose
OnCreate = FormCreate
OnDeactivate = FormDeactivate
OnKeyDown = FormKeyDown
OnResize = FormResize
TextHeight = 15
object m_dg: TDrawGrid
Left = 0
Top = 30
Width = 354
Height = 445
Align = alClient
Color = clNone
ColCount = 2
DefaultRowHeight = 27
DefaultDrawing = False
DoubleBuffered = True
FixedCols = 0
RowCount = 16
FixedRows = 0
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
Options = [goThumbTracking]
ParentDoubleBuffered = False
ParentFont = False
PopupMenu = m_pm
ScrollBars = ssNone
TabOrder = 0
OnDrawCell = LogsDrawCell
OnMouseMove = LogsMouseMove
OnMouseWheelDown = LogsMouseWheelDown
OnMouseWheelUp = LogsMouseWheelUp
OnSelectCell = LogsSelectCell
OnTopLeftChanged = LogsTopChanged
end
object m_tbp: TTitleBarPanel
Left = 0
Top = 0
Width = 354
Height = 30
ParentCustomHint = False
CustomButtons = <>
object m_sbSearch: TSearchBox
Left = 181
Top = 5
Width = 132
Height = 23
ParentCustomHint = False
TabStop = False
AutoSelect = False
AutoSize = False
BevelInner = bvSpace
BevelKind = bkTile
BevelOuter = bvSpace
BiDiMode = bdLeftToRight
Color = clWhite
Ctl3D = False
DoubleBuffered = True
ParentBiDiMode = False
ParentCtl3D = False
ParentDoubleBuffered = False
ParentShowHint = False
ShowHint = False
TabOrder = 0
OnDblClick = SearchDblClick
OnEnter = SearchEnter
OnExit = SearchExit
OnInvokeSearch = SearchInvokeSearch
end
end
object m_pm: TPopupMenu
AutoHotkeys = maManual
Left = 120
Top = 64
object save: TMenuItem
AutoHotkeys = maManual
Caption = #20445#23384#20026'...'
OnClick = SaveClick
end
object N1: TMenuItem
Caption = '-'
end
object clear: TMenuItem
AutoHotkeys = maManual
Caption = #28165#31354#20869#23481
OnClick = ClearClick
end
end
end
+74
View File
@@ -0,0 +1,74 @@
//---------------------------------------------------------------------------
#ifndef BetLogFormUnitH
#define BetLogFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ComCtrls.hpp>
#include "GameUnit.h"
#include <Vcl.Menus.hpp>
#include <Vcl.Grids.hpp>
#include <Vcl.WinXCtrls.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.TitleBarCtrls.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TBetLogForm : public TForm
{
__published: // IDE-managed Components
TPopupMenu *m_pm;
TMenuItem *clear;
TMenuItem *save;
TMenuItem *N1;
TDrawGrid *m_dg;
TSearchBox *m_sbSearch;
TTitleBarPanel *m_tbp;
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall LogsMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall LogsMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall ClearClick(TObject *Sender);
void __fastcall SaveClick(TObject *Sender);
void __fastcall LogsDrawCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, TRect &Rect, TGridDrawState State);
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormResize(TObject *Sender);
void __fastcall LogsTopChanged(TObject *Sender);
void __fastcall LogsSelectCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, bool &CanSelect);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall SearchInvokeSearch(TObject *Sender);
void __fastcall SearchExit(TObject *Sender);
void __fastcall SearchEnter(TObject *Sender);
void __fastcall SearchDblClick(TObject *Sender);
void __fastcall FormDeactivate(TObject *Sender);
void __fastcall FormActivate(TObject *Sender);
void __fastcall LogsMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
private: // User declarations
int m_nShowRows;
bool m_bAutoScroll;
vector<TBetLog*> m_aSearchLogs;
int m_iSearchEnd;
String m_sSearch;
bool m_bSearch;
void __fastcall ShowLogs();
String __fastcall GetLogText(TBetLog* pLog, int iCol);
void __fastcall SearchSelAll();
MESSAGE void __fastcall UMLogUpdate(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(UM_LOG_UPDATE, TMessage, UMLogUpdate)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TBetLogForm(TComponent* Owner);
void __fastcall Init(vector<TBetLog*>& aLogs);
};
//---------------------------------------------------------------------------
extern PACKAGE TBetLogForm *BetLogForm;
extern vector<TBetLog*> g_aBetLogs; //¹Ò»úÈÕÖ¾
//---------------------------------------------------------------------------
#endif
+147
View File
@@ -0,0 +1,147 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GameUnit.h"
#include "ChartFormUnit.h"
#include "ContentPanel.h"
#include "GlobalUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TChartForm *ChartForm = NULL;
//char * u_sTimeUnit[] = {"5秒", "10秒", "20秒", "30秒", "1分",
// "2分", "5分", "10分", "30分", "1小时"};
//---------------------------------------------------------------------------
__fastcall TChartForm::TChartForm(TComponent* Owner)
: TForm(Owner)
{
// m_lblTimeUnit->Caption = String(u_sTimeUnit[0]);
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::FormClose(TObject *Sender, TCloseAction &Action)
{
ChartForm->Hide();
delete ChartForm;
ChartForm = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::FormCreate(TObject *Sender)
{
/////////////////////////////////////
//test
// TDot dot;
// for(int i=0; i<4; i++){
// g_aDots[i].clear();
// g_aDots[i].push_back(dot);
// }
//
// int counts[2] = {0};
// int profile = 0;
// int tm = time(NULL);
// for(int i=0; i<2000; i++){
// profile += Random(2000) - 1000;
// dot.val = profile;
// dot.ts = tm++;
// g_aDots[0].push_back(dot);
//
// counts[Random(2)]++;
// dot.val = counts[0] - counts[1];
// dot.ts = tm++;
// g_aDots[3].push_back(dot);
// }
//
///////////////////////////////////////
m_panChart = new TContentPanel(this);
m_panChart->Parent = this;
m_panChart->Align = alClient;
m_panChart->Show();
ShowRunTime();
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::UMChartUpdate(TMessage &msg)
{
int mod = msg.WParam,
op = msg.LParam;
((TContentPanel*)m_panChart)->UpdateView(mod, op);
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::UMRunTime(TMessage &msg)
{
ShowRunTime();
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::ShowRunTime()
{
int d = g_aGames.runTime / 86400,
r = g_aGames.runTime - d * 86400,
h, m, s;
h = r / 3600, r -= h * 3600;
m = r / 60, r -= m * 60;
s = r;
m_lblRunTime->Caption = Format(String("%d天 %.2d:%.2d:%.2d"), ARRAYOFCONST((d, h, m, s)));
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected)
{
TTabSet* pTS = (TTabSet*)Sender;
int w = TabCanvas->TextWidth((*pTS->Tabs)[Index]),
l = ( R.Width() - w ) / 2,
h = TabCanvas->TextHeight((*pTS->Tabs)[Index]),
t = ( R.Height() - h ) /2;
if( Index==0 )
TabCanvas->Font->Color = clBlue;
else if( Index==1 )
TabCanvas->Font->Color = clGreen;
else if( Index==2 )
TabCanvas->Font->Color = clRed;
else
TabCanvas->Font->Color = clWebRoyalBlue;
TabCanvas->TextOut(R.Left + l, R.Top + t, (*pTS->Tabs)[Index]);
TabCanvas->Font->Color = clBlack;
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::TopMeasureTab(TObject *Sender, int Index, int &TabWidth)
{
TabWidth = DPIX(80);
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::FormResize(TObject *Sender)
{
int l = DPIX(150) + (ClientWidth - m_panTU->Width) / 2;
int lB = DPIX(420);
if(l<lB) l = lB;
m_panTU->Left = l;
// if(WindowState==wsMaximized)
// FormStyle = fsNormal;
// else if(Application->MainForm->WindowState==wsMaximized)
// FormStyle = fsStayOnTop;
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::TopChange(TObject *Sender, int NewTab, bool &AllowChange)
{
((TContentPanel*)m_panChart)->SetView(NewTab);
}
//---------------------------------------------------------------------------
void __fastcall TChartForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
ResetIdle();
if(Key==37 || Key==39){
((TContentPanel*)m_panChart)->PanKeyDown(Key);
}
}
//---------------------------------------------------------------------------
+116
View File
@@ -0,0 +1,116 @@
object ChartForm: TChartForm
Left = 0
Top = 0
ParentCustomHint = False
HorzScrollBar.Tracking = True
HorzScrollBar.Visible = False
VertScrollBar.Tracking = True
VertScrollBar.Visible = False
BiDiMode = bdLeftToRight
Caption = #25968#25454#22270#34920
ClientHeight = 461
ClientWidth = 850
Color = clBtnFace
Constraints.MaxHeight = 500
Constraints.MinHeight = 500
Constraints.MinWidth = 680
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
ParentBiDiMode = False
Position = poDesigned
StyleElements = []
StyleName = 'Windows'
OnClose = FormClose
OnCreate = FormCreate
OnKeyDown = FormKeyDown
OnResize = FormResize
TextHeight = 14
object m_tsTop: TTabSet
Left = 0
Top = 0
Width = 850
Height = 25
ParentCustomHint = False
Align = alTop
AutoScroll = False
DoubleBuffered = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentDoubleBuffered = False
ParentShowHint = False
ShowHint = False
SelectedColor = clWhite
Style = tsOwnerDraw
TabHeight = 25
Tabs.Strings = (
#24635#36194#21033
#27169#25311#26412#37329
#36134#25143#20313#39069
#36194#36755#27425#24046)
TabIndex = 0
TabPosition = tpTop
OnChange = TopChange
OnDrawTab = TopDrawTab
OnMeasureTab = TopMeasureTab
end
object m_panTU: TPanel
Left = 350
Top = 0
Width = 163
Height = 23
ParentCustomHint = False
BevelOuter = bvNone
Color = clInactiveBorder
Ctl3D = False
DoubleBuffered = False
ParentBackground = False
ParentCtl3D = False
ParentDoubleBuffered = False
ParentShowHint = False
ShowCaption = False
ShowHint = False
TabOrder = 1
object Label1: TLabel
Left = 0
Top = 0
Width = 64
Height = 23
Align = alLeft
AutoSize = False
Caption = #25346#26426#26102#38271#65306
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
Layout = tlCenter
ExplicitLeft = 3
ExplicitTop = 5
ExplicitHeight = 15
end
object m_lblRunTime: TLabel
Left = 64
Top = 0
Width = 99
Height = 23
Align = alRight
Alignment = taCenter
AutoSize = False
Caption = '0'#22825' 00:00:00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Layout = tlCenter
end
end
end
+48
View File
@@ -0,0 +1,48 @@
//---------------------------------------------------------------------------
#ifndef ChartFormUnitH
#define ChartFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.TitleBarCtrls.hpp>
#include "ContentPanel.h"
#include <Vcl.Tabs.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TChartForm : public TForm
{
__published: // IDE-managed Components
TTabSet *m_tsTop;
TLabel *Label1;
TPanel *m_panTU;
TLabel *m_lblRunTime;
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall FormCreate(TObject *Sender);
void __fastcall TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected);
void __fastcall TopMeasureTab(TObject *Sender, int Index, int &TabWidth);
void __fastcall FormResize(TObject *Sender);
void __fastcall TopChange(TObject *Sender, int NewTab, bool &AllowChange);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
TPanel* m_panChart;
void __fastcall ShowRunTime();
MESSAGE void __fastcall UMRunTime(TMessage &msg);
MESSAGE void __fastcall UMChartUpdate(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(UM_RUN_TIME, TMessage, UMRunTime)
MESSAGE_HANDLER(UM_CHART_UPDATE, TMessage, UMChartUpdate)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TChartForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TChartForm *ChartForm;
//---------------------------------------------------------------------------
#endif
+32
View File
@@ -0,0 +1,32 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Chip02FrameUnit.h"
#include "GameUnit.h"
#include "PolicyUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TChip02Frame *Chip02Frame = NULL;
//---------------------------------------------------------------------------
__fastcall TChip02Frame::TChip02Frame(TComponent* Owner)
: TFrame(Owner)
{
m_leMinChip->Text = g_RandomChip.minChip;
m_leMaxChip->Text = g_RandomChip.maxChip;
}
//---------------------------------------------------------------------------
void __fastcall TChip02Frame::EditChipExit(TObject *Sender)
{
TEdit* pE = (TEdit*)Sender;
int num;
if(!TryStrToInt(pE->Text, num) || num<g_MinOnBet || num>g_MaxOnBet ){
ShowMessage("×¢Âë½ð¶î²»Äܳ¬¹ýÏÞºì");
pE->Text = pE==m_leMinChip ? "20" : "100";
pE->SetFocus();
}
}
//---------------------------------------------------------------------------
+79
View File
@@ -0,0 +1,79 @@
object Chip02Frame: TChip02Frame
Left = 0
Top = 0
Width = 384
Height = 310
Ctl3D = False
ParentCtl3D = False
TabOrder = 0
Visible = False
object Label1: TLabel
Left = 40
Top = 24
Width = 117
Height = 15
Caption = #20869#32622#27880#30721#65306#38543#26426#27880#30721
end
object m_leMinChip: TLabeledEdit
Left = 145
Top = 88
Width = 70
Height = 26
Hint = #38543#26426#27880#30721#26368#23567#20540
Alignment = taCenter
EditLabel.Width = 80
EditLabel.Height = 26
EditLabel.Caption = #19979#27880#33539#22260#65306
EditLabel.Font.Charset = DEFAULT_CHARSET
EditLabel.Font.Color = clWindowText
EditLabel.Font.Height = -15
EditLabel.Font.Name = 'Segoe UI'
EditLabel.Font.Style = []
EditLabel.ParentFont = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
LabelPosition = lpLeft
MaxLength = 5
NumbersOnly = True
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
Text = '20'
OnExit = EditChipExit
end
object m_leMaxChip: TLabeledEdit
Left = 259
Top = 88
Width = 70
Height = 26
Hint = #38543#26426#27880#30721#26368#22823#20540
Alignment = taCenter
EditLabel.Width = 31
EditLabel.Height = 26
EditLabel.Caption = ' '#8212' '
EditLabel.Font.Charset = DEFAULT_CHARSET
EditLabel.Font.Color = clWindowText
EditLabel.Font.Height = -15
EditLabel.Font.Name = 'Segoe UI'
EditLabel.Font.Style = []
EditLabel.ParentFont = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
LabelPosition = lpLeft
MaxLength = 5
NumbersOnly = True
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
Text = '100'
OnExit = EditChipExit
end
end
+27
View File
@@ -0,0 +1,27 @@
//---------------------------------------------------------------------------
#ifndef Chip02FrameUnitH
#define Chip02FrameUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Mask.hpp>
//---------------------------------------------------------------------------
class TChip02Frame : public TFrame
{
__published: // IDE-managed Components
TLabeledEdit *m_leMinChip;
TLabeledEdit *m_leMaxChip;
TLabel *Label1;
void __fastcall EditChipExit(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TChip02Frame(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TChip02Frame *Chip02Frame;
//---------------------------------------------------------------------------
#endif
+101
View File
@@ -0,0 +1,101 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ChipsFormUnit.h"
#include "GlobalUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PNGButton"
#pragma link "PNGButton"
#pragma resource "*.dfm"
TChipsForm *ChipsForm = NULL;
//---------------------------------------------------------------------------
__fastcall TChipsForm::TChipsForm(TComponent* Owner)
: TForm(Owner)
{
m_aChips[0] = m_btnChip1;
m_aChips[1] = m_btnChip5;
m_aChips[2] = m_btnChip10;
m_aChips[3] = m_btnChip20;
m_aChips[4] = m_btnChip50;
m_aChips[5] = m_btnChip100;
m_aChips[6] = m_btnChip500;
m_aChips[7] = m_btnChip1k;
m_aChips[8] = m_btnChip5k;
m_aChips[9] = m_btnChip10k;
m_aValues[0] = 1;
m_aValues[1] = 5;
m_aValues[2] = 10;
m_aValues[3] = 20;
m_aValues[4] = 50;
m_aValues[5] = 100;
m_aValues[6] = 500;
m_aValues[7] = 1000;
m_aValues[8] = 5000;
m_aValues[9] = 10000;
m_iSelChip = 3;
m_nSelChip = 20;
}
//---------------------------------------------------------------------------
void __fastcall TChipsForm::ChipClick(TObject *Sender)
{
TPNGButton* pBtn = (TPNGButton*)Sender;
if(!pBtn->Down){
m_aChips[m_iSelChip]->Down = false;
pBtn->Down = true;
m_iSelChip = pBtn->Tag;
m_nSelChip = m_aValues[m_iSelChip];
}
}
//---------------------------------------------------------------------------
void __fastcall TChipsForm::FormResize(TObject *Sender)
{
int dx = m_btnChip1->Width,
dy = m_btnChip1->Height;
int col = ClientWidth / dx,
row = ClientHeight / dy;
int y = 0, ind = 0;
for(int i=0; i<row && ind<10; i++,y+=dy){
int x = 0;
for(int j=0; j<col && ind<10; j++, x+=dx, ind++){
TPNGButton* pB = m_aChips[ind];
pB->Top = y;
pB->Left = x;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TChipsForm::FormCanResize(TObject *Sender, int &NewWidth, int &NewHeight, bool &Resize)
{
int dx = m_btnChip1->Width,
dy = m_btnChip1->Height,
cx = Width - ClientWidth,
cy = Height - ClientHeight;
int col, row;
if(Width!=NewWidth){
col = (NewWidth - cx) / dx;
row = 10 / col;
if(10%col) row++;
}
else if(Height!=NewHeight){
row = (NewHeight-cy) / dy;
col = 10 / row;
if(10%row) col++;
}
else
return;
NewWidth = col * dx + cx;
NewHeight = row * dy + cy;
}
//---------------------------------------------------------------------------
+3094
View File
File diff suppressed because it is too large Load Diff
+41
View File
@@ -0,0 +1,41 @@
//---------------------------------------------------------------------------
#ifndef ChipsFormUnitH
#define ChipsFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.Buttons.hpp>
#include "PNGButton.hpp"
//---------------------------------------------------------------------------
class TChipsForm : public TForm
{
__published: // IDE-managed Components
TPNGButton *m_btnChip1;
TPNGButton *m_btnChip5;
TPNGButton *m_btnChip10;
TPNGButton *m_btnChip20;
TPNGButton *m_btnChip50;
TPNGButton *m_btnChip100;
TPNGButton *m_btnChip500;
TPNGButton *m_btnChip1k;
TPNGButton *m_btnChip5k;
TPNGButton *m_btnChip10k;
void __fastcall ChipClick(TObject *Sender);
void __fastcall FormResize(TObject *Sender);
void __fastcall FormCanResize(TObject *Sender, int &NewWidth, int &NewHeight, bool &Resize);
private: // User declarations
TPNGButton* m_aChips[10];
int m_aValues[10];
int m_iSelChip;
public: // User declarations
int m_nSelChip;
__fastcall TChipsForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TChipsForm *ChipsForm;
//---------------------------------------------------------------------------
#endif
+646
View File
@@ -0,0 +1,646 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "GameUnit.h"
#include "ContentPanel.h"
#include "GlobalUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TColor clrAxis = TColor(RGB(3,5,7)), //XY轴及边框
clrLineTen = TColor(RGB(215,215,215)), //十倍横线
clrLineNor = TColor(0x00EDEDED),// TColor(RGB(250,250,250)), //普通线
clrHeadFont = TColor(RGB(83,109,165)), //头文字
clrSelect = TColor(RGB(150, 155, 159));
TColor u_clrLink[] = {clBlue, clWebLimeGreen, clRed, clWebRoyalBlue};
//---------------------------------------------------------------------------
__fastcall TContentPanel::TContentPanel(TComponent* AOwner)
: Vcl::Extctrls::TPanel(AOwner)
{
Visible = false;
DoubleBuffered = true;
Ctl3D = false;
Color = clBtnHighlight;//clWhite;
BorderStyle = bsSingle;
OnMouseMove = PanMouseMove;
m_nTopGap = m_nLeftBound = m_nTopBound = 0;
m_nRows = 50;
m_xScaleGap = m_nGap = DPIX(8);
m_yZero = 0;
m_yScaleGap = m_nGap * 5;
m_nRightBound = m_nLeftBound + m_nGap * m_nCols;
m_nBottomBound = m_nTopBound + m_nGap * m_nRows;
m_nAmoUnit = 100;
m_nAmoMax = m_nAmoMin = m_nRowMax = m_nRowMin = 0;
m_iType = m_nOriDots = 0;
m_iSample = 1;
m_iMask = 0;
m_iPeakU = m_iPeakL = -1;
m_xHalfGap = m_xScaleGap>>1;
m_iHint = m_xMaxHint = 0;
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::CreateWnd(void)
{
Vcl::Extctrls::TPanel::CreateWnd();
for(int i=0; i<2; i++){
m_lblHint[i] = new TLabel(NULL);
m_lblHint[i]->Visible = false;
m_lblHint[i]->Parent = this;
m_lblHint[i]->Font->Color = clrHeadFont;
// m_lblHint[i]->AutoSize = false;
// m_lblHint[i]->Width = 52;
// m_lblHint[i]->Height = 16;
// m_lblHint[i]->Alignment = taCenter;
// m_lblHint[i]->Layout = tlCenter;
}
UpdateView(0, true);
}
//---------------------------------------------------------------------------
__fastcall TContentPanel::~TContentPanel()
{
for(int i=0; i<2; i++)
delete m_lblHint[i];
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::SetView(int iType)
{
if(iType!=m_iType){
m_iType = iType;
m_nAmoUnit = iType==3 ? 10 : 100;
UpdateView(iType, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::WMSize(TWMSize &msg)
{
m_nCols = (msg.Width - m_nLeftBound - DPIX(4)) / m_nGap;
m_nRightBound = m_nLeftBound + m_nGap * m_nCols;
m_xScaleGap = m_nGap;
m_xHalfGap = m_xScaleGap>>1;
m_aDots.clear();
m_nOriDots = 0;
m_iSample = 1;
m_iMask = 0;
if(!CalcXUnit())
InvalidateRect(Handle, NULL, TRUE);
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::Paint()
{
TRect rtInvalid = Canvas->ClipRect;
bool bPeakU = m_iPeakU>=0, bPeakL = m_iPeakL>=0;
vector<TDot>& aDots = m_aDots.empty() ? g_aDots[m_iType] : m_aDots;
//绘制选中线
if(m_iHint>0){
int x = m_xZero + m_iHint * m_xScaleGap;
Canvas->Pen->Color = clrSelect;
Canvas->Pen->Width = 1;
Canvas->Pen->Style = psDot;
Canvas->MoveTo(x, m_nTopBound+1);
Canvas->LineTo(x, m_nBottomBound-1);
}
int x0 = m_xZero,
y0 = m_nTopBound,
x1 = x0,
l = ( rtInvalid.left - 1 - x0 ) / m_xScaleGap,
r = ( rtInvalid.right + 1 - x0 ) / m_xScaleGap + 1,
total = aDots.size();
if(total>0)
y0 += (int)((m_nRowMax - aDots[0].val) * m_yScale + 0.5);
Canvas->Pen->Color = u_clrLink[m_iType];
Canvas->Pen->Width = 2;
Canvas->MoveTo( x0, y0 );
for( int i=1; i<total; i++ ){
x1 += m_xScaleGap;
int c = (m_nRowMax - aDots[i].val) * m_yScale + 0.5;
int y1 = m_nTopBound + c;
if(l <= i && r >= i){
//绘制连接线
Canvas->LineTo( x1, y1 );
}
else{
Canvas->MoveTo( x1, y1 );
}
}
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::WMEraseBkgnd(TWMEraseBkgnd &Message)
{
TCanvas* tempCanvas = new TCanvas;
tempCanvas->Handle = Message.DC;
//背景色
TRect rect( 0, 0, ClientWidth, ClientHeight );
tempCanvas->Brush->Color = clBtnFace;//clWhite;
tempCanvas->FillRect( rect );
//外边框
rect.left = m_nLeftBound;
rect.right = m_nRightBound + 1;
rect.top = m_nTopBound;
rect.bottom = m_nBottomBound + 1;
tempCanvas->Brush->Color = clrAxis;
tempCanvas->FrameRect( rect );
//纵线
int x = m_xZero,
t = rect.top+1,
b = rect.bottom-1;
tempCanvas->Pen->Color = clrLineNor;
for( int i=1; i<m_nCols; i++ ){
x += m_nGap;
tempCanvas->MoveTo( x, t );
tempCanvas->LineTo( x, b );
}
//刻度
tempCanvas->Font->Color = clrHeadFont;
tempCanvas->Brush->Style = bsClear;
int y = m_nTopGap,//, iY0 = 0,
num = m_nRowMax;
for( int i=0; i<=10; i++ ){
String sTxt = IntToStr(num);
TSize szTxt = tempCanvas->TextExtent( sTxt );
x = m_nLeftBound - szTxt.cx - 1;
tempCanvas->TextOut( x, y, sTxt );
num -= m_iAmoUnit;
y += m_yScaleGap;
}
//横线
tempCanvas->Brush->Style = bsSolid;
y = m_nTopBound;
int l = m_xZero+1,
r = rect.right-1;
for( int i=1; i<m_nRows; i++ ){
y += m_nGap;
tempCanvas->Pen->Color = i==m_yZero ? clrAxis
: i % 5 ? clrLineNor
: clrLineTen;
tempCanvas->MoveTo( l, y );
tempCanvas->LineTo( r, y );
}
delete tempCanvas;
Message.Result = true;
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::UpdateView(int iType, bool bInit)
{
if(m_iType!=iType)
return;
vector<TDot>& dots = g_aDots[m_iType];
int nTotal = dots.size();
if(bInit){
int nMax(0), nMin(0);
if(nTotal>0){
nMax = nMin = dots[0].val;
for(int i=1; i<nTotal; i++){
int p = dots[i].val;
if(p>nMax){
nMax = p;
m_iPeakU = i;
}
else if(p<nMin){
nMin = p;
m_iPeakL = i;
}
}
}
m_nAmoMax = nMax;
m_nAmoMin = nMin;
m_xScaleGap = m_nGap;
m_xHalfGap = m_xScaleGap>>1;
m_aDots.clear();
m_nOriDots = 0;
m_iSample = 1;
m_iMask = 0;
CalcYUnit(nMax, nMin, true);
return;
}
if(!nTotal || m_nOriDots==nTotal)
return;
int nOriCount = m_nOriDots,
nLocCount = m_aDots.size();
bool bYChange = false;
for(int i=m_nOriDots; i<nTotal; i++){
int p = dots[i].val;
if(!m_aDots.empty()){
m_aDots.push_back(dots[i]);
}
if(p > m_nAmoMax){
m_nAmoMax = p;
bYChange = true;
if(p > m_nRowMax) m_iPeakU = nTotal - 1;
}
else if(p < m_nAmoMin){
m_nAmoMin = p;
bYChange = true;
if(p < m_nRowMin) m_iPeakL = nTotal -1;
}
}
m_nOriDots = nTotal;
if(bYChange && CalcYUnit(m_nAmoMax, m_nAmoMin))
return;
else if(CalcXUnit())
return;
TRect rectDraw;
rectDraw.top = m_nTopBound - 1;
rectDraw.bottom = m_nBottomBound + 1;
if(m_aDots.empty()){
rectDraw.left = m_xZero + (nOriCount-1) * m_xScaleGap;
rectDraw.right = rectDraw.Left + (nTotal-nOriCount) * m_xScaleGap + 2;
}
else{
rectDraw.left = m_xZero + (nLocCount-1) * m_xScaleGap;
rectDraw.right = rectDraw.Left + (m_aDots.size()-nLocCount) * m_xScaleGap + 2;
}
InvalidateRect( Handle, &rectDraw, false );
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::Resample()
{
vector<TDot>& dots = g_aDots[m_iType];
m_aDots.clear();
m_aDots.push_back(dots[0]);
int total = dots.size(),
num = total-20; //保留最少20个点
bool bNoSample = m_iSample==1,
bMask = m_iMask>m_iSample;
int iS = 0,
iM = !bMask,
iMask = m_iMask + 1;
TDot dtMax = dots[0],
dtMin = dots[0];
for(int i=1; i<num; i++){
if(bNoSample || ++iS==m_iSample){
iS = 0;
if(bMask && ++iM==iMask)
iM = 0;
}
if(dots[i].val>dtMax.val)
dtMax = dots[i];
else if(dots[i].val<dtMin.val)
dtMin = dots[i];
if(iM && !iS){
bool bPushMax = true;
int nTmp = m_aDots.back().val;
if(dtMin.val>=nTmp || dtMax.val==m_nAmoMax)
bPushMax = true;
else if(dtMax.val<=nTmp || dtMin.val==m_nAmoMin)
bPushMax = false;
else if(m_aDots.size()>1){
int nSec = m_aDots[m_aDots.size()-2].val;
if(nTmp<nSec)
bPushMax = false;
// else
// bPushMax = true;
}
else if(dtMax.val-nTmp < nTmp-dtMin.val)
bPushMax = false;
// else
// bPushMax = true;
if(bPushMax && dtMax.ts)
m_aDots.push_back(dtMax);
else if(!bPushMax && dtMin.ts)
m_aDots.push_back(dtMin);
dtMax = dtMin = dots[i];
}
}
for(int i=num; i<total; i++)
m_aDots.push_back(dots[i]);
m_xMaxHint = m_nLeftBound + m_aDots.size() * m_xScaleGap - m_xHalfGap;
m_nOriDots = total;
}
//---------------------------------------------------------------------------
bool __fastcall TContentPanel::CalcXUnit()
{
int nWidth = ClientWidth - m_nLeftBound - DPIX(4) - 1;
vector<TDot>& aDots = m_aDots.empty() ? g_aDots[m_iType] : m_aDots;
int total = aDots.size();
int xGap = m_xScaleGap;
int xMinGap = 3;
if(total * xGap < nWidth){
m_xMaxHint = m_nLeftBound + total * m_xScaleGap - m_xHalfGap;
return false;
}
total = g_aDots[m_iType].size();
while(xGap>xMinGap && total * xGap >= nWidth){
xGap--;
}
if(xGap!=m_xScaleGap){
m_xScaleGap = xGap;
m_xHalfGap = m_xScaleGap>>1;
if(total * xGap < nWidth){
// DebugPrint("Change xGap: %d", xGap);
m_xMaxHint = m_nLeftBound + total * xGap - m_xHalfGap;
if(m_iHint>0){
m_iHint = 0;
m_lblHint[0]->Visible = false;
m_lblHint[1]->Visible = false;
}
InvalidateRect( Handle, NULL, true );
return true;
}
}
int nCol = nWidth / xGap;
int iSample = m_iSample,
iMask = m_iMask;
while((total-20) / iSample + 20 + 10 > nCol){
if(iMask<=iSample)
iMask = iSample + 10;
while(iMask>iSample && (total-20) * iMask / ((iMask+1)*iSample) + 20 + 10 > nCol){
iMask--;
}
if(iMask>iSample)
break;
iSample++;
}
if(iSample!=m_iSample || iMask!=m_iMask){
m_iMask = iMask;
m_iSample = iSample;
// DebugPrint("Change sample: %d mask: %d", iSample, iMask);
}
Resample();
if(m_iHint>0){
m_iHint = 0;
m_lblHint[0]->Visible = false;
m_lblHint[1]->Visible = false;
}
InvalidateRect( Handle, NULL, true );
return true;
}
//---------------------------------------------------------------------------
bool __fastcall TContentPanel::CalcYUnit(int nMax, int nMin, bool bInit)
{
if(bInit || nMax > m_nRowMax || nMin < m_nRowMin ){ //初始化||范围变动
int scale = 100 / m_nAmoUnit;
if(nMax==nMin){
m_nRowMax = (nMax / m_nAmoUnit + 1) * m_nAmoUnit;
m_nRowMin = m_nRowMax - 2 * m_nAmoUnit;
if(m_nRowMax>0 && m_nRowMin<0)
m_yZero = 25;
else
m_yZero = 0;
}
else if(nMax>0 && nMin<0){
nMax = (nMax / m_nAmoUnit + ((nMax % m_nAmoUnit) ? 1 : 0)) * m_nAmoUnit;
nMin = (nMin / m_nAmoUnit - ((nMin % m_nAmoUnit) ? 1 : 0)) * m_nAmoUnit;
//找可整除的0轴
int m = (nMax - nMin) * scale / 50;
if(0 == (nMin * scale) % m){
m_nRowMax = nMax;
m_nRowMin = nMin;
}
else{
int rMax = nMax,
rMin = nMin,
tmpMin = nMin,
rm = m_iType==3 ? 10000 : 10000000;
//寻找最佳方案
bool bUp = g_aDots[m_iType].back().val > 0;
for(int m1=m; m1 < (bUp ? rm : rm+1); m1+=2){ //最后的数据为负,优先扩下半区,或者尽量上下同扩
if(m1>m && 0 == tmpMin % m1){
rMax = nMax;
rMin = tmpMin;
rm = m1;
break;
}
int tmpMax = nMax;
for(int m2=m1+2; -tmpMin>=m2 && m2 < (bUp ? rm+1: rm); m2+=2){ //最后的数据为正,优先扩上半区
tmpMax += m_nAmoUnit;
if(0==tmpMin % m2){
rMax = tmpMax;
rMin = tmpMin;
rm = m2;
break;
}
}
tmpMin -= m_nAmoUnit;
}
m_nRowMax = rMax;
m_nRowMin = rMin;
m = rm;
}
int n = - m_nRowMin * scale / m;
if(n<1) n = 1;
else if(n>49) n = 49;
m_yZero = 50 - n;
}
else{
m_nRowMax = nMax / m_nAmoUnit * m_nAmoUnit;
if(nMax > 0 && nMax % m_nAmoUnit) m_nRowMax += m_nAmoUnit;
m_nRowMin = nMin / m_nAmoUnit * m_nAmoUnit;
if(nMin < 0 && nMin % m_nAmoUnit) m_nRowMin -= m_nAmoUnit;
m_yZero = 0;
}
TSize szTxt1 = Canvas->TextExtent(IntToStr(m_nRowMax)),
szTxt2 = Canvas->TextExtent(IntToStr(m_nRowMin));
// int hhTxt = szTxt1.cy / 2;
// if(hhTxt<16){
// m_nTopGap = 16 - hhTxt;
// m_nTopBound = 16;
// }
// else{
// m_nTopGap = 0;
// m_nTopBound = hhTxt;
// }
m_nTopBound = szTxt1.cy;
m_nTopGap = szTxt1.cy / 2;
m_nBottomBound = m_nTopBound + m_nGap * m_nRows;
m_nLeftBound = max(szTxt1.cx, szTxt2.cx) + 2;
m_xZero = m_nLeftBound;
m_iAmoUnit = (m_nRowMax - m_nRowMin) / 10;
m_yScale = 5.0 * m_nGap / m_iAmoUnit;
m_nCols = (ClientWidth - m_nLeftBound - DPIX(4)) / m_nGap;
m_nRightBound = m_nLeftBound + m_nGap * m_nCols;
CalcXUnit();
InvalidateRect( Handle, NULL, true );
return true;
}
return false;
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::PanMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
ResetIdle();
int iHit = HitTest(X, Y);
if(m_iHint!=iHit)
ShowTimeHint(iHit);
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::PanKeyDown(WORD Key)
{
if(Key==37){
if(!m_iHint){
vector<TDot>& aDots = m_aDots.empty() ? g_aDots[m_iType] : m_aDots;
if(aDots.size()>1)
ShowTimeHint(aDots.size()-1);
}
else if(m_iHint>1){
ShowTimeHint(m_iHint-1);
}
}
else if(Key==39){
vector<TDot>& aDots = m_aDots.empty() ? g_aDots[m_iType] : m_aDots;
if(m_iHint>0){
if(m_iHint<aDots.size()-1)
ShowTimeHint(m_iHint+1);
}
else if(aDots.size()>1){
ShowTimeHint(1);
}
}
}
//---------------------------------------------------------------------------
int __fastcall TContentPanel::HitTest(int x, int y)
{
int iHit = 0;
if(y>m_nTopBound && y<m_nBottomBound && x>m_nLeftBound && x<m_xMaxHint){
int dx = x - m_xZero,
p = dx % m_xScaleGap;
if(p <= m_xHalfGap)
iHit = dx / m_xScaleGap;
else
iHit = dx / m_xScaleGap + 1;
}
return iHit;
}
//---------------------------------------------------------------------------
void __fastcall TContentPanel::ShowTimeHint(int iHint)
{
TRect rectDraw;
rectDraw.top = m_nTopBound + 1;
rectDraw.bottom = m_nBottomBound - 1;
if(m_iHint>0){
int x = m_xZero + m_iHint * m_xScaleGap;
rectDraw.left = x - 1;
rectDraw.right = x + 1;
InvalidateRect( Handle, &rectDraw, false );
}
m_iHint = iHint;
if(iHint>0){
int x = m_xZero + iHint * m_xScaleGap;
rectDraw.left = x - 1;
rectDraw.right = x + 1;
InvalidateRect( Handle, &rectDraw, false );
vector<TDot>& aDots = m_aDots.empty() ? g_aDots[m_iType] : m_aDots;
int ts = aDots[iHint].ts - 57600,
r = ts % 86400,
h, m, s;
h = r / 3600, r -= h * 3600;
m = r / 60, r -= m * 60;
s = r;
m_lblHint[0]->Top = m_nTopBound - m_lblHint[0]->Height;
m_lblHint[0]->Caption = IntToStr(aDots[iHint].val);
m_lblHint[1]->Top = m_nBottomBound + 1;
m_lblHint[1]->Caption = Format(String("%.2d:%.2d:%.2d"), ARRAYOFCONST((h, m, s)));
int xMin = m_xZero-1, xMax = m_nRightBound+2;
for(int i=0; i<2; i++){
int l = x - (m_lblHint[i]->Width>>1);
if(l<xMin)
l = xMin;
else if(l > xMax - m_lblHint[i]->Width)
l = xMax - m_lblHint[i]->Width;
m_lblHint[i]->Left = l;
m_lblHint[i]->Visible = true;
}
}
else{
m_lblHint[0]->Visible = false;
m_lblHint[1]->Visible = false;
}
}
//---------------------------------------------------------------------------
+72
View File
@@ -0,0 +1,72 @@
//---------------------------------------------------------------------------
#ifndef ContentPanelH
#define ContentPanelH
#include <vector>
using namespace std;
//---------------------------------------------------------------------------
class TContentPanel : public Extctrls::TPanel
{
private:
//显示相关
int m_nTopGap,
m_nLeftBound,
m_nRightBound,
m_nTopBound,
m_nBottomBound,
m_nGap,
m_nCols,
m_nRows,
m_xZero,
m_yZero,
m_xScaleGap,
m_yScaleGap;
//刻度相关
int m_nAmoMax, m_nAmoMin, m_iAmoUnit, m_nRowMax, m_nRowMin, m_nAmoUnit;
double m_yScale;
//峰值
int m_iPeakU, m_iPeakL;
//点显示与压缩
vector<TDot> m_aDots;
int m_nOriDots, m_iType, m_iSample, m_iMask;
//显示时间
int m_iHint, m_xHalfGap, m_xMaxHint;
TLabel * m_lblHint[2];
bool __fastcall CalcXUnit();
bool __fastcall CalcYUnit(int nMax, int nMin, bool bInit=false);
void __fastcall Resample();
int __fastcall HitTest(int x, int y);
void __fastcall ShowTimeHint(int iHint);
void __fastcall PanMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
MESSAGE void __fastcall WMSize(TWMSize &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
END_MESSAGE_MAP(Vcl::Extctrls::TPanel)
protected:
virtual void __fastcall CreateWnd();
virtual void __fastcall Paint(void);
public:
__fastcall virtual TContentPanel(System::Classes::TComponent* AOwner);
__fastcall ~TContentPanel();
void __fastcall SetView(int iType);
void __fastcall UpdateView(int iType, bool bInit);
void __fastcall PanKeyDown(WORD Key);
};
#endif
+82
View File
@@ -0,0 +1,82 @@
//---------------------------------------------------------------------------
#pragma hdrstop
#include <string.h>
#include "GameSettings.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
void TSettings::FromVersionD(TSettingsD& d)
{
//开始挂机
bWaitNew = d.bWaitNew;
bInitCurProfitByStart = d.bInitCurProfitByStart;
bInitTabProfitByStart = d.bInitTabProfitByStart;
bInitBetChipByStart = d.bInitBetChipByStart;
bInitClearTabLog = d.bInitClearTabLog;
//新局
bInitBetByGame = d.bInitBetByGame;
bInitChipByGame = d.bInitChipByGame;
bInitProfitByGame = d.bInitProfitByGame;
bInitLogByGame = d.bInitLogByGame;
//模拟本金
fSimAcc = d.fSimAcc;
bSimAccOn = d.bSimAccOn;
bNoBetLow = d.bNoBetLow;
bStopLow = d.bStopLow;
bSyncReal = d.bSyncReal;
//止赢止损
bTotalStopLos = d.bTotalStopLos;
bTotalStopWin = d.bTotalStopWin;
bTableStopLos = d.bTableStopLos;
bTableStopWin = d.bTableStopWin;
bAccStopWin = d.bAccStopWin;
bAccStopLos = d.bAccStopLos;
bU2DStop = d.bU2DStop;
bU2DMinPeak = d.bU2DMinPeak;
bU2DPause = d.bU2DPause;
nTotalStopLos = d.nTotalStopLos;
nTotalStopWin = d.nTotalStopWin;
nTableStopLos = d.nTableStopLos;
nTableStopWin = d.nTableStopWin;
nAccStopWin = d.nAccStopWin;
nAccStopLos = d.nAccStopLos;
nTotalWinPause = d.nTotalWinPause;
nTotalLosPause = d.nTotalLosPause;
nTableWinPause = d.nTableWinPause;
nTableLosPause = d.nTableLosPause;
nU2DStop = d.nU2DStop;
nU2DMinPeak = d.nU2DMinPeak;
nU2DPause = d.nU2DPause;
iTotalWinOp = d.iTotalWinOp;
iTotalLosOp = d.iTotalLosOp;
iTableWinOp = d.iTableWinOp;
iTableLosOp = d.iTableLosOp;
//模实转换
bR2SLos = d.bR2SLos;
bR2SWin = d.bR2SWin;
bS2RLos = d.bS2RLos;
bS2RWin = d.bS2RWin;
nR2SLos = d.nR2SLos;
nR2SWin = d.nR2SWin;
nS2RLos = d.nS2RLos;
nS2RWin = d.nS2RWin;
//游台
iFloatMode = d.iFloatMode;
//牌局选项
bHoldBet = d.bHoldBet;
bHaltBet = d.bHaltBet;
nHoldBet = d.nHoldBet;
nHaltBet = d.nHaltBet;
// bBetsNoTie = d.bBetsNoTie;
}
//---------------------------------------------------------------------------
+186
View File
@@ -0,0 +1,186 @@
//---------------------------------------------------------------------------
#ifndef GameSettingsH
#define GameSettingsH
//---------------------------------------------------------------------------
#endif
//兼容USER_GAME_FILE VERSION 0x0D
class TSettingsD{
public:
//开始挂机
bool bWaitNew, //开始挂机等待新局
bInitCurProfitByStart, //开始挂机重置当期赢利
bInitTabProfitByStart, //开始挂机重置台桌赢利
bInitBetChipByStart; //开始挂机重置打法注码
//新局
bool bInitBetByGame, //新局初始化打法
bInitChipByGame, //新局初始化注码
bInitProfitByGame, //新局初始化赢利
bInitLogByGame; //新局清空台桌日志
//模拟本金
double fSimAcc; //模拟账户余额
bool bSimAccOn, //启用模拟本金
bNoBetLow, //模拟余额少于注码时不下注
bStopLow, //模拟余额低于限红时停止挂机
bSyncReal; //实打时同步增减模拟余额
//止赢止损
bool bTotalStopLos, //总体止损
bTotalStopWin, //总体止赢
bTableStopLos, //单桌止损
bTableStopWin, //单桌止赢
bAccStopWin, //账户止赢
bAccStopLos, //账户止损
bU2DStop, //回落止损
bU2DMinPeak, //回落止损有最小峰值
bU2DPause; //回落止损暂停重启
int nTotalStopLos, //总体止损金额
nTotalStopWin, //总体止赢金额
nTableStopLos, //单桌止损金额
nTableStopWin, //单桌止赢金额
nAccStopWin, //账户止赢金额
nAccStopLos, //账户止损金额
nTotalWinPause, //总体止赢暂停分钟数
nTotalLosPause, //总体止损暂停分钟数
nTableWinPause, //单桌止赢暂停分钟数
nTableLosPause, //单桌止损暂停分钟数
nU2DStop, //回落止损金额
nU2DMinPeak, //回落止损最小峰值
nU2DPause; //回落止损暂停分钟数
int iTotalWinOp, //总体止赢后操作
iTotalLosOp, //总体止损后操作
iTableWinOp, //单桌止赢后操作
iTableLosOp; //单桌止损后操作
//模实转换
bool bR2SLos, //实打亏损转模拟
bR2SWin, //实打赢利转模拟
bS2RLos, //模拟亏损转实打
bS2RWin; //模拟赢利转实打
int nR2SLos, //实打转模拟亏损金额
nR2SWin, //实打转模拟赢利金额
nS2RLos, //模拟转实打亏损金额
nS2RWin; //模拟转实打赢利金额
//游台
bool bFloat; //是否开启游台
int iFloatMode; //游台模式:0=不开启游台 1=每项换台 2=洗牌换台 4=输换台 8=赢换台 16=和换台
//开始挂机
bool bInitClearTabLog; //清空台桌下注记录
//牌局选项
bool bHoldBet, //开局X手后开始下注
bHaltBet; //开局X手后停止下注
int nHoldBet, //开局开始下注手数
nHaltBet; //开局停止下注手数
TSettingsD() {
memset( this, 0, sizeof(TSettingsD) );
bInitBetChipByStart = bInitTabProfitByStart = bNoBetLow = nTotalWinPause = nTotalLosPause = 1;
nTotalStopLos = nTotalStopWin = nTableStopLos = nTableStopWin
= nR2SLos = nR2SWin = nS2RLos = nS2RWin = 1000;
fSimAcc = 10000;
nU2DStop = nU2DMinPeak = nAccStopWin = 2000;
nAccStopLos = 500;
nU2DPause = 3;
bInitClearTabLog = 1;
bHoldBet = bHaltBet = false;
nHoldBet = 5, nHaltBet = 50;
};
};
//当前设置
class TSettings{
public:
//开始挂机
bool bWaitNew, //开始挂机等待新局
bInitCurProfitByStart, //开始挂机重置当期赢利
bInitTabProfitByStart, //开始挂机重置台桌赢利
bInitBetChipByStart, //开始挂机重置打法注码
bInitClearTabLog; //清空台桌下注记录
//新局
bool bInitBetByGame, //新局初始化打法
bInitChipByGame, //新局初始化注码
bInitProfitByGame, //新局初始化赢利
bInitLogByGame; //新局清空台桌日志
//模拟本金
double fSimAcc; //模拟账户余额
bool bSimAccOn, //启用模拟本金
bNoBetLow, //模拟余额少于注码时不下注
bStopLow, //模拟余额低于限红时停止挂机
bSyncReal; //实打时同步增减模拟余额
//止赢止损
bool bTotalStopLos, //总体止损
bTotalStopWin, //总体止赢
bTableStopLos, //单桌止损
bTableStopWin, //单桌止赢
bAccStopWin, //账户止赢
bAccStopLos, //账户止损
bU2DStop, //回落止损
bU2DMinPeak, //回落止损有最小峰值
bU2DPause; //回落止损暂停重启
int nTotalStopLos, //总体止损金额
nTotalStopWin, //总体止赢金额
nTableStopLos, //单桌止损金额
nTableStopWin, //单桌止赢金额
nAccStopWin, //账户止赢金额
nAccStopLos, //账户止损金额
nTotalWinPause, //总体止赢暂停分钟数
nTotalLosPause, //总体止损暂停分钟数
nTableWinPause, //单桌止赢暂停分钟数
nTableLosPause, //单桌止损暂停分钟数
nU2DStop, //回落止损金额
nU2DMinPeak, //回落止损最小峰值
nU2DPause; //回落止损暂停分钟数
int iTotalWinOp, //总体止赢后操作
iTotalLosOp, //总体止损后操作
iTableWinOp, //单桌止赢后操作
iTableLosOp; //单桌止损后操作
//模实转换
bool bR2SLos, //实打亏损转模拟
bR2SWin, //实打赢利转模拟
bS2RLos, //模拟亏损转实打
bS2RWin; //模拟赢利转实打
int nR2SLos, //实打转模拟亏损金额
nR2SWin, //实打转模拟赢利金额
nS2RLos, //模拟转实打亏损金额
nS2RWin; //模拟转实打赢利金额
//游台
int iFloatMode; //游台模式:0=不开启游台 1=每项换台 2=洗牌换台 4=输换台 8=赢换台 16=和换台
//牌局选项
bool bHoldBet, //开局X手后开始下注
bHaltBet; //开局X手后停止下注
int nHoldBet, //开局开始下注手数
nHaltBet; //开局停止下注手数
bool bBetsNoTie; //连续下注忽略和
TSettings() {
memset( this, 0, sizeof(TSettings) );
bInitBetChipByStart = bInitTabProfitByStart = bNoBetLow = nTotalWinPause = nTotalLosPause = 1;
nTotalStopLos = nTotalStopWin = nTableStopLos = nTableStopWin
= nR2SLos = nR2SWin = nS2RLos = nS2RWin = 1000;
fSimAcc = 10000;
nU2DStop = nU2DMinPeak = nAccStopWin = 2000;
nAccStopLos = 500;
nU2DPause = 3;
bInitClearTabLog = 1;
bHoldBet = bHaltBet = false;
nHoldBet = 5, nHaltBet = 50;
};
void FromVersionD(TSettingsD& d);
};
+2065
View File
File diff suppressed because it is too large Load Diff
+401
View File
@@ -0,0 +1,401 @@
//---------------------------------------------------------------------------
#ifndef GameUnitH
#define GameUnitH
//---------------------------------------------------------------------------
#include <system.hpp>
#include <vector>
#include "PolicyUnit.h"
#include "SimpleMutex.h"
#include "GameSettings.h"
#define EXCODE_SERVERWAIT 0x01
#define EXCODE_OPCOMPLETE 0x010
#define EXCODE_USERCANCEL 0x1000
#define EXCODE_INSUFFICIENT 0x1001
#define EXCODE_REACHWINLIMIT 0x1003
#define EXCODE_REACHLOSLIMIT 0x1004
#define EXCODE_WEBSITEERROR 0x1005
#define EXCODE_GAMEOVER 0x1006
#define EXCODE_USERINVALID 0x1007
#define EXCODE_USEREXPIRE 0x1008
#define EXCODE_USERLOGOUT 0x1009
#define EXCODE_NOBETWAY 0x100A
#define EXCODE_REACHLIMIT 0x100B
#define EXCODE_SERVERDOWN 0x100C
#define EXCODE_RESPONSEERR 0x100D
#define EXCODE_CANTSETPAGE 0x100E
#define EXCODE_UNKNOWN 0x1100
#define UM_TAB_UPDATE WM_USER+0x2000
#define UM_LOG_UPDATE WM_USER+0x2001
#define UM_CHART_UPDATE WM_USER+0x2002
#define UM_RUN_TIME WM_USER+0x2003
#define UM_STATE_UPDATE WM_USER+0x2004
#define UM_CHANGE_ROAD WM_USER+0x2005
#define UM_MANUAL_SET WM_USER+0x2006
#define UM_ENTER_TABLE WM_USER+0x2007
#define UM_FLOAT_BET WM_USER+0x2008
#define UM_FLOAT_DEAD WM_USER+0x2009
#define UM_GLOBAL_BET WM_USER+0x200A
#define UM_GLOBAL_DEAD WM_USER+0x200B
#define UPDATE_ROAD 0
#define UPDATE_STATUS 1
#define UPDATE_TIME 2
#define UPDATE_MANBET 3
#define UPDATE_MANRES 4
#define UPDATE_RESET 5 //重置数据
#define UPDATE_IP 6 //重置独立策略
#define STATE_AMOUNT 0
#define STATE_BET_R 1
#define STATE_PEAK 2
#define STATE_COUNT 3
#define STATE_MISC 4
#define STATE_MAN 5
#define STATE_REAL 6
#define STATE_BALANCE 7
#define STATE_LIMIT 8
#define STATE_ALL 0x10
#define LOGEVT_START 0
#define LOGEVT_BET 1
#define LOGEVT_RES 2
#define LOGEVT_ROUND 3
#define LOGEVT_DEAD 4
#define LOGEVT_STOPWIN 5
#define LOGEVT_STOPLOS 6
#define LOGEVT_END 7
#define LOGEVT_RESET 8
#define LOGEVT_SWITCH 9
#define LOGEVT_QUASH 10
#define ST_INIT 0
#define ST_NOBET 1
#define ST_BETSET 2
#define ST_BETTING 3
#define ST_BETTED 4
#define ST_EXPIRED 5
#define ST_PAID 6
#define ST_CANCELED 7
#define ST_FAILED 8
#define ST_QUASH 9 //注单撤销
#define ST_ROUND 10
#define ST_SHUFFLE 11
#define TAB_WAIT -1
#define TAB_NOWAY -2
//---------------------------------------------------------------------------
using namespace std;
//图表数据
typedef struct tagDot{
int val; //数值
int ts; //时间
tagDot(){ memset( this, 0, sizeof(tagDot)); };
tagDot(int v, int t){ val=v,ts=t; };
}TDot;
//挂机日志
typedef struct tagBetLog{
int ts; //时间
int num; //数值
char tno[14];//台桌名
char ev; //事件
char op; //选项
tagBetLog(){memset( this, 0, sizeof(tagBetLog));};
}TBetLog;
// 挂机数据
typedef struct tagBetData{
double profits[8]; //总赢利/总赢利峰值/总赢利谷值/当期赢利/实打总赢利/手工总赢利/当期模拟赢利/当期实打赢利
int amounts[3], //总流水/实打流水/手工流水
counts[4], //赢计数/输计数/最大连赢/连输计数
maxChip, //最大注额
dead; //爆缆次数
tagBetData(){Reset();};
void Reset(){memset( this, 0, sizeof(tagBetData));};
}TBetData;
//手工下注
typedef struct tagManBet{
int chips[3]; //注码 0=庄 1=闲 2=平
int state; //状态 ST_INIT/ST_BETTING/ST_BETTED
tagManBet(){memset( this, 0, sizeof(tagManBet));};
}TManBet;
//阶梯注码
class TRankChip{
protected:
int iType, //注码类型
iRank, //注码层数
nRnkChip; //当层注码
bool bWait; //等待结算
TChipPolicy* pPolicy; //注码方案
public:
TRankChip();
bool __fastcall IsTypeOf(int type){return type==iType;};
void __fastcall SetPolicy(TChipPolicy* pCP);
virtual int __fastcall GetChip(){return bWait || iRank<0 ? -1 : nRnkChip;};
virtual void __fastcall Reset() = 0;
virtual int __fastcall HandleResult(int res, double wl) = 0;
};
//层级注码
class TTierChip : public TRankChip{
int nWLDiff, //本层赢输差
nAccChip, //累加注码
nLos, //当层输额
nCount; //当层下注计数
public:
TTierChip();
virtual void __fastcall Reset();
// virtual int __fastcall GetChip(){return nCurrChip;};
virtual int __fastcall HandleResult(int res, double wl);
};
//阶梯注码
class TLevelChip : public TRankChip{
protected:
bool bGlobal; //总体计算
double fWLDiff; //本层输赢金额
public:
TLevelChip(bool bG=false);
virtual void __fastcall Reset();
virtual void __fastcall CalcChip();
virtual void __fastcall CalcLevelChip(bool bLevel, int res);
virtual int __fastcall HandleResult(int res, double wl);
};
//组合阶梯注码
class TComboChip : public TLevelChip{
int iRnkSeq; //当层注码步骤
int nRnkMul; //当层倍数
TChipPolicy* pRnkPolicy; //当层注码方案
public:
TComboChip(bool bG=false);
virtual void __fastcall Reset();
virtual void __fastcall CalcChip();
virtual void __fastcall CalcLevelChip(bool bLevel, int res);
int __fastcall GetRankSeq(int res, int iRnk, int iSeq);
int __fastcall GetComboChip(int& iRnk, int& iSeq);
};
//赢输次差注码
class TWLDiffChip : public TRankChip{
protected:
bool bGlobal; //总体计算
int nWLDiff; //输赢次差
public:
TWLDiffChip(bool bG=false);
virtual void __fastcall Reset();
virtual void __fastcall CalcChip();
virtual int __fastcall HandleResult(int res, double wl);
};
//路珠图
class TRoadmap{
public:
vector<char*> aCols;
int iCol, iRow, iRoot;
bool bBend;
TRoadmap();
void __fastcall DrawMap(char curr, char last);
void __fastcall Clear();
void __fastcall CheckColumn();
};
//台桌
class TTableFrame;
class TGame
{
public:
int iGame; //gameId
//台桌相关
String vid; //房间号
String gmcode;
int gmstatus; //0=结算 1=下注 2=开牌 11=洗牌 12=维护
int timeout;
int countdown; //固定倒计时
char winCount[3]; //庄闲计数 [0]庄 [1]闲 [2]平
String bcard; //庄牌 2-3张 0-9 0,5,2
String pcard; //闲牌 3,4,_
bool bRun, //运行
bRev, //反打
bPause, //暂停
bReset, //是否重置打法注码
bBreak; //是否等待新局
int iRoad;
bool bIndPolicy; //是否独立策略
int iBetPolicy, iChipPolicy, nChipMul; //独立策略
//下注相关
int iState; //INIT/BETTING/BETTED
int iBet; //下注项
int nChip; //下注金额
int iBetSeq; //下注手数+打法
int iChipSeq; //注码步骤
// bool bGlobalChip; //是否全局注码
bool bReal; //模拟/实打 0=模拟 1=实打
vector<char> aBets; //剩余连续下注项
vector<TManBet> aManBets; //手工下注
TRankChip * pRankChip; //层级注码
//统计相关
double profit; //当前赢利
int seqCount[2]; //连赢/连输计数
HWND hTable; //台桌句柄,通过消息操作UI
CSema* pSema;
//路单数据
vector<char> aRes; //历史结果
vector<char> aRoad[4]; //大路/大眼路/小路/小强路
char lastRoad[4];
TRoadmap aMap[4]; //路珠图
TGame(int iG);
~TGame();
void __fastcall HandleResult(int op=0); //op =0正常处理 =1数据异常 =2结算超时 =3维护注销
void __fastcall AutoBetOn(bool bReset=false);
void __fastcall AutoBetOff(bool bBreak=false);
void __fastcall ManualBetOn(int chips[]);
void __fastcall ManualBetOff();
void __fastcall BetResp(bool bSuc);
void __fastcall Shuffle();
void __fastcall CalcBet();
void __fastcall CalcChip();
int __fastcall CalcResult(int op);
void __fastcall Reset();
void __fastcall ResetBet();
void __fastcall ClearBets();
int __fastcall ParseCard(int c);
void __fastcall ClearResults();
void __fastcall BuildRoadmap(char wt);
bool __fastcall CanBet();
TBetLog* __fastcall NewBetLog();
void __fastcall GameOn();
void __fastcall GameOff();
void __fastcall BetResp(int state, int chips[]=NULL); //state 下注状态 0=成功 10=低于限红 11=高于限红 25=已停止下注 26=余额不足 其它=未知
void __fastcall Pause(bool bP){bPause = bP;};
int __fastcall Color2Bet(TBetPolicy* pBP, char clr); //下三路下注 clr=红蓝 返回庄闲
void __fastcall ClearRankChip();
TRankChip* __fastcall GetRankChip(int type);
void __fastcall ResetIP();
};
class TGameArray : public vector<TGame*>
{
public:
CSema* pSema;
vector<TGame*> aGames;
TBetData betData; //总输赢状态及计数
//游台相关
bool bFloat, //是否游台
bSwitchable; //可否换台
int iFloatGame; //下注台号
//全局注码
int iChipSeq, //全局注码步骤
seqCount[2]; //连赢/连输计数
TRankChip * pRankChip; //层级注码
int runTime, //挂机时长
nBetted[3]; //待结算的下注 模拟/实打/全局计算
double fCurrProfitPeak; //最大当期赢利
TGameArray();
~TGameArray();
void __fastcall Init(String sRooms);
TGame* __fastcall NewGame(int iG, String vid, int ind);
TGame* __fastcall GetGame(int iG);
int __fastcall FindGame(int iG, TGame*& pGame);
void __fastcall ClearAllGames();
void __fastcall CalcBet();
void __fastcall Reset();
void __fastcall ResetFloat();
void __fastcall SetSwitchable(bool bS, int iG);
bool __fastcall CanFloatBet(int iG);
void __fastcall GameOn();
void __fastcall GameOff();
void __fastcall AllBetOff();
void __fastcall ClearRankChip();
void __fastcall ResetRankChip();
TRankChip* __fastcall GetRankChip(int type);
void __fastcall SetCountDown(String s);
void __fastcall ResetRankSeq();
};
class TIPGame
{
public:
String vid; //gameId
int iBetPolicy, iChipPolicy, nChipMul; //独立策略
TGame* pGame;
TIPGame(String v, int b, int c, int m){pGame=NULL, vid=v,
iBetPolicy=b, iChipPolicy=c, nChipMul=m;};
TIPGame(TGame* pG){pGame = pG, vid=pG->vid, iBetPolicy=pG->iBetPolicy,
iChipPolicy=pG->iChipPolicy, nChipMul=pG->nChipMul;};
};
class TIPGameArray : public vector<TIPGame*>
{
public:
int iPlatform;
int __fastcall FindGame(String vid, TIPGame*& pIG);
void __fastcall ClearAll();
void __fastcall AddGame(TGame* pG);
void __fastcall DelGame(TGame* pG);
void __fastcall AddIPGame(String v, int b, int c, int m);
TIPGameArray(){iPlatform==0;};
~TIPGameArray();
};
//---------------------------------------------------------------------------
int __fastcall Vid2Gid(String vid);
extern TSettings g_settings; //基本设置
extern TGameArray g_aGames;
extern double g_fBalance; //账户余额
extern int g_iRoad; //全局路珠类型 0=六珠路 1=大路 2=大眼路 3=小路 4=小强路
extern bool g_bSimulate, //模拟/实打
g_bGameOn, //开始挂机
g_bShowSetting, //开始挂机时显示设置页面
g_bDeadPause, //全局爆缆暂停
g_bBetPause; //总体止赢止损暂停
extern int g_MinOnBet, //最小注码
g_MaxOnBet; //最大注码
extern int g_nRBReport; //实打流水上报
extern vector<TDot> g_aDots[4]; //资金图表数据 总赢利/模拟本金/账户余额/总输赢差
extern TIPGameArray g_aIPGames; //独立策略台桌
#endif
+1320
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -0,0 +1,11 @@
//---------------------------------------------------------------------------
#ifndef HookJSH
#define HookJSH
#include <vcl.h>
//---------------------------------------------------------------------------
extern String linkJS_PA, loginJS_PA, baseJS_PA, stopJS_PA, enterJS_PA,
userJS_PA, goLinkJS_PA, goLobbyJS_PA, expireJS_PA;
extern String stopJS_AB, msgJS_AB, goLinkJS_AB, expireJS_AB;
extern String loginJS_DB, userJS_DB, expireJS_DB, msgJS_DB;
#endif
+23
View File
@@ -0,0 +1,23 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "InfoFrameUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TInfoFrame *InfoFrame;
//---------------------------------------------------------------------------
__fastcall TInfoFrame::TInfoFrame(TComponent* Owner)
: TFrame(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TInfoFrame::FrameResize(TObject *Sender)
{
m_panInfo1->Width = Width - 4;
m_panInfo2->Width = Width - 4;
}
//---------------------------------------------------------------------------
+816
View File
@@ -0,0 +1,816 @@
object InfoFrame: TInfoFrame
Left = 0
Top = 0
Width = 1234
Height = 53
DoubleBuffered = False
Color = clRed
Ctl3D = False
ParentBackground = False
ParentColor = False
ParentCtl3D = False
ParentDoubleBuffered = False
TabOrder = 0
OnResize = FrameResize
object m_panInfo1: TPanel
Left = 2
Top = 27
Width = 1231
Height = 24
Align = alCustom
BevelOuter = bvNone
Color = clBlack
DoubleBuffered = False
FullRepaint = False
ParentBackground = False
ParentDoubleBuffered = False
TabOrder = 0
object m_lblCurProfit: TLabel
Left = 77
Top = 3
Width = 60
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape1: TShape
Left = 140
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape2: TShape
Left = 282
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape3: TShape
Left = 430
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label7: TLabel
Left = 145
Top = 4
Width = 69
Height = 16
Caption = #26368#22823#36194#21033':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblPeakU: TLabel
Left = 216
Top = 3
Width = 66
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape4: TShape
Left = 542
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label9: TLabel
Left = 287
Top = 4
Width = 69
Height = 16
Caption = #26368#22823#20111#25439':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblPeakL: TLabel
Left = 358
Top = 3
Width = 70
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clFuchsia
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape5: TShape
Left = 666
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label11: TLabel
Left = 546
Top = 4
Width = 69
Height = 16
Caption = #24635#36194#27425#25968':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblWinCount: TLabel
Left = 616
Top = 3
Width = 48
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape6: TShape
Left = 790
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label13: TLabel
Left = 670
Top = 4
Width = 69
Height = 16
Caption = #24635#36755#27425#25968':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblLosCount: TLabel
Left = 740
Top = 3
Width = 48
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape7: TShape
Left = 892
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label15: TLabel
Left = 795
Top = 4
Width = 69
Height = 16
Caption = #26368#22823#36830#36194':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblSWin: TLabel
Left = 867
Top = 3
Width = 21
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape8: TShape
Left = 992
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label17: TLabel
Left = 897
Top = 4
Width = 69
Height = 16
Caption = #26368#22823#36830#36755':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblSLos: TLabel
Left = 969
Top = 3
Width = 21
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label19: TLabel
Left = 998
Top = 4
Width = 53
Height = 16
Caption = #29190#32518#25968':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblDead: TLabel
Left = 1055
Top = 3
Width = 39
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label3: TLabel
Left = 5
Top = 4
Width = 69
Height = 16
Caption = #24403#26399#36194#21033':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label2: TLabel
Left = 434
Top = 4
Width = 69
Height = 16
Caption = #26368#22823#27880#30721':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblMaxChip: TLabel
Left = 505
Top = 3
Width = 35
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape9: TShape
Left = 1096
Top = -1
Width = 2
Height = 24
Pen.Color = clCream
end
object m_lblSRProfit: TLabel
Left = 1172
Top = 3
Width = 55
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblSRTitle: TLabel
Left = 1101
Top = 4
Width = 69
Height = 16
Caption = #24403#21069#27169#25311':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
end
object m_panInfo2: TPanel
Left = 2
Top = 2
Width = 1231
Height = 24
Align = alCustom
BevelOuter = bvNone
Color = clBlack
DoubleBuffered = False
FullRepaint = False
ParentBackground = False
ParentDoubleBuffered = False
TabOrder = 1
object m_lblManAmount: TLabel
Left = 1035
Top = 3
Width = 57
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblRealAmount: TLabel
Left = 760
Top = 3
Width = 61
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label14: TLabel
Left = 689
Top = 4
Width = 69
Height = 16
Caption = #23454#25171#27969#27700':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape13: TShape
Left = 294
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape14: TShape
Left = 170
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label16: TLabel
Left = 827
Top = 4
Width = 69
Height = 16
Caption = #23454#25171#36194#21033':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblRealProfit: TLabel
Left = 899
Top = 3
Width = 57
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape15: TShape
Left = 548
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label20: TLabel
Left = 1101
Top = 4
Width = 69
Height = 16
Caption = #25163#24037#36194#21033':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblManProfit: TLabel
Left = 1172
Top = 3
Width = 55
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape16: TShape
Left = 685
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape24: TShape
Left = 411
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Label39: TLabel
Left = 964
Top = 4
Width = 69
Height = 16
Caption = #25163#24037#27969#27700':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Shape17: TShape
Left = 822
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape19: TShape
Left = 1096
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object Shape20: TShape
Left = 959
Top = 0
Width = 2
Height = 24
Pen.Color = clCream
end
object m_lblAccountTitle: TLabel
Left = 298
Top = 4
Width = 37
Height = 16
Hint = #27169#25311#26102#26174#31034#27169#25311#26412#37329#65292#23454#25171#26102#26174#31034#30495#23454#20313#39069
Caption = #20313#39069':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label4: TLabel
Left = 416
Top = 4
Width = 53
Height = 16
Caption = #24635#27969#27700':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label5: TLabel
Left = 553
Top = 4
Width = 53
Height = 16
Caption = #24635#36194#21033':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblAccount: TLabel
Left = 338
Top = 3
Width = 71
Height = 16
Hint = #27169#25311#26102#26174#31034#27169#25311#26412#37329#65292#23454#25171#26102#26174#31034#30495#23454#20313#39069
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
ParentShowHint = False
ShowHint = True
Transparent = True
Layout = tlCenter
end
object m_lblAmount: TLabel
Left = 471
Top = 3
Width = 76
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblTotProfit: TLabel
Left = 609
Top = 3
Width = 73
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblLimits: TLabel
Left = 214
Top = 3
Width = 77
Height = 16
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object Label10: TLabel
Left = 174
Top = 4
Width = 37
Height = 16
Caption = #38480#32418':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
object m_lblAccName: TLabel
Left = 45
Top = 3
Width = 123
Height = 16
Hint = #36134#21495#21487#28857#20987#21491#38190#22797#21046
Alignment = taCenter
AutoSize = False
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
ParentShowHint = False
ShowHint = True
Transparent = True
Layout = tlCenter
end
object Label22: TLabel
Left = 5
Top = 4
Width = 37
Height = 16
Caption = #36134#21495':'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = True
Layout = tlCenter
end
end
end
+80
View File
@@ -0,0 +1,80 @@
//---------------------------------------------------------------------------
#ifndef InfoFrameUnitH
#define InfoFrameUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TInfoFrame : public TFrame
{
__published: // IDE-managed Components
TPanel *m_panInfo1;
TLabel *m_lblAccountTitle;
TLabel *m_lblAccount;
TLabel *m_lblAmount;
TLabel *Label4;
TShape *Shape1;
TShape *Shape2;
TLabel *Label5;
TLabel *m_lblTotProfit;
TShape *Shape3;
TLabel *Label7;
TLabel *m_lblPeakU;
TShape *Shape4;
TLabel *Label9;
TLabel *m_lblPeakL;
TShape *Shape5;
TLabel *Label11;
TLabel *m_lblWinCount;
TShape *Shape6;
TLabel *Label13;
TLabel *m_lblLosCount;
TShape *Shape7;
TLabel *Label15;
TLabel *m_lblSWin;
TShape *Shape8;
TLabel *Label17;
TLabel *m_lblSLos;
TLabel *Label19;
TLabel *m_lblDead;
TLabel *Label3;
TLabel *m_lblCurProfit;
TPanel *m_panInfo2;
TLabel *m_lblManAmount;
TLabel *m_lblRealAmount;
TLabel *Label14;
TShape *Shape13;
TShape *Shape14;
TLabel *Label16;
TLabel *m_lblRealProfit;
TShape *Shape15;
TLabel *Label20;
TLabel *m_lblManProfit;
TShape *Shape16;
TShape *Shape24;
TLabel *Label39;
TLabel *Label2;
TLabel *m_lblMaxChip;
TShape *Shape17;
TShape *Shape19;
TShape *Shape20;
TLabel *m_lblLimits;
TLabel *Label10;
TLabel *m_lblAccName;
TLabel *Label22;
TShape *Shape9;
TLabel *m_lblSRProfit;
TLabel *m_lblSRTitle;
void __fastcall FrameResize(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TInfoFrame(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TInfoFrame *InfoFrame;
//---------------------------------------------------------------------------
#endif
+283
View File
@@ -0,0 +1,283 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "LoginUnit.h"
#include "UtilityUnit.h"
#include "GlobalUnit.h"
#include <Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
bool g_bAutoLogin = true;
String GetValueByKey(String key, String str)
{
String ret;
int klen = key.Length(),
slen = str.Length();
int p0 = 1; //外部搜索key的游标
while((p0 = Pos(key, str, p0))!=0){
p0 += klen;
int p1 = p0; //p1为内部搜索游标
bool bOk = false;
while(p1<slen){
char nc = str[p1];
++p1;
if(nc==' ' || nc=='\t' || nc=='\n'){
continue;
}
else{
if(nc=='=') //确认赋值语句
bOk = true;
break;
}
}
p0 = p1;
if(!bOk)
continue;
int p2 = 0, len = 0; //p2为第一个引号位置
char quote = 0;
while(p1<slen){ //寻找两个引号
char nc = str[p1];
++p1;
if(!quote){ //第一个引号
if(nc==' ' || nc=='\t' || nc=='\n'){
continue;
}
else if(nc=='\'' || nc=='\"'){
p2 = p1;
quote = nc;
}
else
break;
}
else if(nc==quote){ //第二个引号
len = p1 - p2 - 1;
break;
}
}
if(p2>0 && len>0){
ret = str.SubString(p2, len);
break;
}
}
return ret;
}
//---------------------------------------------------------------------------
__fastcall TLoginForm::TLoginForm(TComponent* Owner, int iPF)
: TForm(Owner)
{
m_iPlatform = iPF;
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::OnLoginClick(TObject *Sender)
{
if(!m_memTxt->Lines->Count){
if(m_iPlatform==PF_PA)
ShowMessage("请按提示复制网页内容到编辑框");
else if(m_iPlatform==PF_AB)
ShowMessage("请按提示复制网页完整地址到编辑框");
else if(m_iPlatform==PF_DB)
ShowMessage("请按操作说明复制网页地址到编辑框");
}
else if(m_iPlatform==PF_PA && GetLoginValues(m_memTxt->Text)
|| m_iPlatform!=PF_PA && GetUrl(m_memTxt->Text)){
ModalResult = mrOk;
}
else
ShowMessage("复制的内容无效,请重新复制");
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::FormCreate(TObject *Sender)
{
if(m_iPlatform==PF_PA)
Caption = Caption + " - PA视讯(AG)";
else if(m_iPlatform==PF_AB)
Caption = Caption + " - 欧博(ABG)";
else if(m_iPlatform==PF_DB)
Caption = Caption + " - 多宝(DB)";
m_cbAuto->Checked = g_bAutoLogin;
m_imgSpec = new TPngImage();
TResourceStream * pResStream = new TResourceStream(int(HInstance),
m_iPlatform==PF_DB ? L"PNG_DBSPEC"
: m_iPlatform==PF_AB ? L"PNG_ABSPEC"
: L"PNG_PASPEC",
RT_RCDATA);
m_imgSpec->LoadFromStream(pResStream);
delete pResStream;
m_imgBack->Picture->Bitmap->Assign(m_imgSpec);
m_memTxt->Lines->Add(m_iPlatform==PF_PA ? "请将网页内容复制到这里"
: m_iPlatform==PF_DB ? "按操作说明打开调试控制台,复制粘贴以下代码并回车"
: "请将网页完整地址复制到这里" );
if(m_iPlatform==PF_DB){
m_memTxt->Lines->Add(" history.replaceState(0,'',location.href+'&deviceId='+localStorage.getItem('fixedDeviceId'))");
m_memTxt->Lines->Add("然后复制网页完整地址到这里");
}
AddClipboardFormatListener(Handle);
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::FormClose(TObject *Sender, TCloseAction &Action)
{
RemoveClipboardFormatListener(Handle);
delete m_imgSpec;
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::WMClipboardUpdate(TMessage &msg)
{
Sleep(100); //处理剪贴板延迟呈现
if(ModalResult!=mrNone)
return;
if( !OpenClipboard( Handle ) ){
OutputDebugString(L"OpenClipboard faild!");
return;
}
String txt;
if( IsClipboardFormatAvailable(CF_UNICODETEXT) ){
HANDLE h = GetClipboardData(CF_UNICODETEXT);//获取剪切板数据
if(h){
txt = static_cast<LPCWSTR>(GlobalLock(h));
GlobalUnlock(h);
}
}
else if( IsClipboardFormatAvailable(CF_TEXT) ){
HANDLE h = GetClipboardData(CF_TEXT);//获取剪切板数据
if(h){
txt = static_cast<char*>(GlobalLock(h));
GlobalUnlock(h);
}
}
if(txt.Length()>0 && ( m_iPlatform==PF_PA && GetLoginValues(txt)
|| m_iPlatform!=PF_PA && GetUrl(txt))){
SetWindowPos(Application->Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
SetWindowPos(Application->Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ModalResult = mrOk; // mrCancel;//
}
CloseClipboard();//关闭剪贴板
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::AutoClick(TObject *Sender)
{
g_bAutoLogin = m_cbAuto->Checked;
}
//---------------------------------------------------------------------------
bool __fastcall TLoginForm::GetLoginValues(String in)
{
static String keys[] = {"pid", "tempLangInt", "myGametype", "username", "myDm", "myDofoward"};
for(int i=0; i<6; i++){
m_values[i] = GetValueByKey(keys[i], in);
if(m_values[i].Length()==0)
return false;
}
return true;
}
//---------------------------------------------------------------------------
bool __fastcall TLoginForm::GetUrl(String in)
{
int p0 = in.Pos("https://");
if(!p0)
return false;
if(m_iPlatform==PF_AB){
int p1 = Pos("\/?", in, p0+8);
if(!p1)
return false;
m_url = in.SubString(p0, p1+2 - p0);
if(!(p0 = Pos("sessionId=", in, p1+2)) && !(p0 = Pos("sessionid=", in, p1+2)))
return false;
if(!(p1 = Pos("&", in, p0+10)) && !(p1 = Pos("#", in, p0+10)))
p1 = in.Length()+1;
if(p1-p0 < 50)
return false;
m_url += in.SubString(p0, p1-p0);
return true;
}
else if(m_iPlatform==PF_DB){
int p1 = Pos("egret\/", in, p0+8);
if(!p1)
return false;
m_url = in.SubString(p0, p1+6 - p0) + "multi"; //"hall"; //
if(!(p0 = Pos("?params=", in, p1+6)))
return false;
if(!(p1 = Pos("&signature=", in, p0+20)) || !(p1 = Pos("&ttl=", in, p0+20)))
return false;
int p2 = Pos("&deviceId=", in, p1+16);
if(!p2)
return false;
if(!(p1 = Pos("&", in, p2+10)))
p1 = in.Length()+1;
m_values[0] = in.SubString(p2+10, p1 - p2 - 10);
if(p2-p0 < 1700)
return false;
m_url += in.SubString(p0, p2-p0);
return true;
}
return false;
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::OnSpecClick(TObject *Sender)
{
PostMessage(Application->MainFormHandle, UM_OPENMAUAL, 0, 0);
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::SpecMouseEnter(TObject *Sender)
{
m_lblSpec->Font->Color = clHighlight;
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::SpecMouseLeave(TObject *Sender)
{
m_lblSpec->Font->Color = clBlue;
}
//---------------------------------------------------------------------------
+104
View File
@@ -0,0 +1,104 @@
object LoginForm: TLoginForm
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = #32593#31449#30331#24405
ClientHeight = 470
ClientWidth = 600
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poMainFormCenter
OnClose = FormClose
OnCreate = FormCreate
TextHeight = 15
object m_lblSpec: TLabel
Left = 488
Top = 439
Width = 97
Height = 19
Cursor = crHandPoint
Hint = #28857#20987#26597#30475#30331#24405#25805#20316#35828#26126
ParentCustomHint = False
Alignment = taRightJustify
AutoSize = False
Caption = #26597#30475#25805#20316#35828#26126
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlue
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = [fsUnderline]
ParentFont = False
ParentShowHint = False
ShowAccelChar = False
ShowHint = True
Layout = tlCenter
OnClick = OnSpecClick
OnMouseEnter = SpecMouseEnter
OnMouseLeave = SpecMouseLeave
end
object m_panSpec: TPanel
Left = 0
Top = 0
Width = 600
Height = 298
AutoSize = True
BevelKind = bkFlat
BevelOuter = bvNone
ShowCaption = False
TabOrder = 0
object m_imgBack: TImage
Left = 0
Top = 0
Width = 596
Height = 294
ParentCustomHint = False
Align = alClient
Center = True
ParentShowHint = False
ShowHint = False
Stretch = True
end
end
object m_memTxt: TMemo
Left = 0
Top = 302
Width = 600
Height = 121
BevelInner = bvNone
BevelKind = bkFlat
BevelOuter = bvNone
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
ScrollBars = ssBoth
TabOrder = 1
WordWrap = False
end
object m_btnLogin: TButton
Left = 269
Top = 435
Width = 75
Height = 25
Caption = #30331#24405
TabOrder = 2
OnClick = OnLoginClick
end
object m_cbAuto: TCheckBox
Left = 16
Top = 439
Width = 97
Height = 17
Caption = #19979#27425#33258#21160#30331#24405
TabOrder = 3
OnClick = AutoClick
end
end
+49
View File
@@ -0,0 +1,49 @@
//---------------------------------------------------------------------------
#ifndef LoginUnitH
#define LoginUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Imaging.pngimage.hpp>
//---------------------------------------------------------------------------
extern bool g_bAutoLogin;
class TLoginForm : public TForm
{
__published: // IDE-managed Components
TPanel *m_panSpec;
TImage *m_imgBack;
TMemo *m_memTxt;
TButton *m_btnLogin;
TCheckBox *m_cbAuto;
TLabel *m_lblSpec;
void __fastcall OnLoginClick(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall AutoClick(TObject *Sender);
void __fastcall OnSpecClick(TObject *Sender);
void __fastcall SpecMouseEnter(TObject *Sender);
void __fastcall SpecMouseLeave(TObject *Sender);
private: // User declarations
TPngImage * m_imgSpec;
bool __fastcall GetLoginValues(String in);
bool __fastcall GetUrl(String in);
MESSAGE void __fastcall WMClipboardUpdate(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_CLIPBOARDUPDATE,TMessage, WMClipboardUpdate)
END_MESSAGE_MAP(TForm)
public: // User declarations
int m_iPlatform;
String m_values[6];
String m_url;
__fastcall TLoginForm(TComponent* Owner, int iPF);
};
//---------------------------------------------------------------------------
#endif
File diff suppressed because it is too large Load Diff
+456
View File
@@ -0,0 +1,456 @@
object PolicyEditForm: TPolicyEditForm
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = #31574#30053#32534#36753
ClientHeight = 457
ClientWidth = 448
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poMainFormCenter
OnClose = FormClose
OnCreate = FormCreate
OnMouseMove = FormMouseMove
TextHeight = 15
object m_lblPolicy: TLabel
Left = 22
Top = 41
Width = 65
Height = 23
AutoSize = False
Caption = #32534#36753#25171#27861#65306
Layout = tlCenter
end
object m_cbPolicy: TComboBox
Left = 87
Top = 41
Width = 165
Height = 23
AutoDropDown = True
AutoCloseUp = True
DropDownCount = 20
DropDownWidth = 200
TabOrder = 0
Text = #35831#36873#25321#25171#27861
OnChange = OnPolicyChange
end
object m_btnAdd: TButton
Left = 271
Top = 41
Width = 75
Height = 23
Caption = #26032#24314
TabOrder = 1
OnClick = OnAddClick
end
object m_panEdit: TPanel
Left = 21
Top = 75
Width = 408
Height = 344
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 2
OnMouseMove = FormMouseMove
object m_bvChip: TBevel
Left = 0
Top = 0
Width = 405
Height = 55
ParentCustomHint = False
ParentShowHint = False
Shape = bsFrame
ShowHint = False
end
object m_btnDelRow: TButton
Left = 4
Top = 313
Width = 80
Height = 25
Caption = #21024#38500#34892
Enabled = False
TabOrder = 1
OnClick = OnDelRowClick
end
object m_btnSave: TButton
Left = 201
Top = 313
Width = 88
Height = 25
Caption = #20445#23384#25171#27861
Enabled = False
TabOrder = 2
OnClick = OnSaveClick
end
object m_btnSelect: TButton
Left = 297
Top = 313
Width = 103
Height = 25
Caption = #36873#25321#35813#25171#27861
TabOrder = 3
OnClick = OnSelectClick
end
object m_sg: TStringGrid
Left = 0
Top = 55
Width = 404
Height = 256
ParentCustomHint = False
BevelInner = bvNone
BevelOuter = bvNone
ColCount = 4
DefaultColWidth = 99
DefaultDrawing = False
DoubleBuffered = True
DrawingStyle = gdsGradient
FixedCols = 0
RowCount = 10
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goEditing, goRowSelect, goThumbTracking]
ParentDoubleBuffered = False
ParentShowHint = False
PopupMenu = m_pmSG
ScrollBars = ssVertical
ShowHint = False
TabOrder = 5
OnDrawCell = SGDrawCell
OnKeyDown = SGKeyDown
OnMouseDown = SGMouseDown
OnMouseMove = FormMouseMove
OnMouseWheelDown = SGMouseWheelDown
OnMouseWheelUp = SGMouseWheelUp
OnSelectCell = SGSelectCell
OnTopLeftChanged = SGTopLeftChanged
DefaultTextDrawing = False
end
object m_pEditor: TEdit
Left = 96
Top = 83
Width = 97
Height = 23
ParentCustomHint = False
AutoSize = False
BevelInner = bvNone
BevelOuter = bvNone
Ctl3D = True
ParentCtl3D = False
ParentShowHint = False
ShowHint = False
TabOrder = 4
Visible = False
OnExit = EditorExit
OnKeyDown = EditorKeyDown
OnKeyPress = EditorKeyPress
end
object m_rgRoad: TRadioGroup
Left = 10
Top = 1
Width = 380
Height = 48
Align = alCustom
Color = clBtnFace
Columns = 5
Ctl3D = True
ItemIndex = 0
Items.Strings = (
#29664' '#30424
#22823' '#36335
#22823#30524#36335
#23567' '#36335
#23567#24378#36335)
ParentBackground = False
ParentColor = False
ParentCtl3D = False
ShowFrame = False
TabOrder = 7
OnClick = OnRoadClick
end
object m_panChip: TPanel
Left = 0
Top = 0
Width = 404
Height = 54
Align = alTop
BevelOuter = bvNone
Ctl3D = True
ParentCtl3D = False
TabOrder = 6
OnClick = OnDeadClick
OnMouseMove = FormMouseMove
object m_lblDead: TLabel
Left = 17
Top = 32
Width = 39
Height = 15
Caption = #29190#32518#65306
end
object Bevel1: TBevel
Left = 16
Top = 26
Width = 375
Height = 2
end
object m_rgDead: TGroupBox
Left = 64
Top = 30
Width = 330
Height = 19
ShowFrame = False
TabOrder = 0
object m_lblDead2Tail: TLabel
Left = 240
Top = 3
Width = 65
Height = 15
Caption = #20998#38047#21518#37325#21551
end
object m_rbDead0: TRadioButton
Left = 8
Top = 2
Width = 50
Height = 17
Hint = #20572#27490#19979#27880
Caption = #20572#27490
Checked = True
TabOrder = 0
TabStop = True
OnClick = OnDeadClick
end
object m_rbDead1: TRadioButton
Tag = 1
Left = 71
Top = 2
Width = 81
Height = 17
Hint = #26412#23616#26242#20572#65292#26032#23616#37325#26032#24320#22987
Caption = #26032#23616#37325#21551
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnClick = OnDeadClick
end
object m_rbDead2: TRadioButton
Tag = 2
Left = 163
Top = 2
Width = 50
Height = 17
Hint = #26242#20572#21518#37325#21551
Caption = #26242#20572
TabOrder = 2
OnClick = OnDeadClick
end
object m_edDeadPause: TEdit
Left = 213
Top = 0
Width = 23
Height = 19
Hint = '0-15'#20998#38047
Alignment = taCenter
AutoSize = False
MaxLength = 2
NumbersOnly = True
ParentShowHint = False
ShowHint = True
TabOrder = 3
Text = '0'
TextHint = '0-30'
OnExit = DeadPauseExit
OnKeyDown = DeadPauseKeyDown
end
end
object m_cbKind: TComboBox
Left = 17
Top = 2
Width = 80
Height = 23
AutoComplete = False
Style = csDropDownList
ItemIndex = 0
ParentShowHint = False
ShowHint = True
TabOrder = 3
Text = #24120#35268#27880#30721
OnChange = OnKindChange
Items.Strings = (
#24120#35268#27880#30721
#23618#32423#27880#30721
#38454#26799#27880#30721
#32452#21512#38454#26799
#36194#36755#27425#24046)
end
object m_cbLevelTotalDiff: TCheckBox
Left = 116
Top = 5
Width = 78
Height = 17
Hint = #21246#36873#26102#25353#24635#20307#35745#31639#36755#36194#65292#21542#21017#21488#26700#21508#33258#35745#31639#36755#36194
Caption = #24635#20307#35745#31639
ParentShowHint = False
ShowHint = True
TabOrder = 4
Visible = False
OnClick = OnChipOptionClick
end
object m_cbLevelInstant: TCheckBox
Left = 210
Top = 5
Width = 78
Height = 17
Caption = #21363#26102#21319#38477
ParentShowHint = False
ShowHint = True
TabOrder = 5
Visible = False
OnClick = OnChipOptionClick
end
object m_cbLevelIndie: TCheckBox
Left = 304
Top = 5
Width = 78
Height = 17
Caption = #21319#38477#28165#38646
ParentShowHint = False
ShowHint = True
TabOrder = 6
Visible = False
OnClick = OnChipOptionClick
end
object m_cbTierAccChip: TCheckBox
Left = 228
Top = 5
Width = 92
Height = 17
Hint = #27599#23618#20928#36755#20540'('#19981#35745#36180#29575')'#32047#21152#33267#20197#21518#21508#23618#27880#30721
Caption = #20928#36755#20540#32047#21152
Checked = True
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 2
Visible = False
OnClick = OnChipOptionClick
end
object m_cbTierWinRet: TCheckBox
Left = 116
Top = 5
Width = 105
Height = 17
Hint = #20108#23618#20197#19978#21482#35201#36194#27425#25968#22823#20110#36755#27425#25968#23601#22238#31532#19968#23618
Caption = #39640#23618#36194#22810#22238#22522
Checked = True
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 1
Visible = False
OnClick = OnChipOptionClick
end
object m_cbTierLos0: TCheckBox
Left = 325
Top = 5
Width = 70
Height = 17
Hint = #27599#23618#36755#30340#27425#25968#22810#20110#36194#26102#27880#30721#20026'0'
Caption = #36755#22810#25171'0'
ParentShowHint = False
ShowHint = True
TabOrder = 7
Visible = False
OnClick = OnChipOptionClick
end
end
object m_btnInsRow: TButton
Left = 92
Top = 313
Width = 80
Height = 25
Caption = #25554#20837#34892
Enabled = False
TabOrder = 8
OnClick = OnInsRowClick
end
object m_pCombo: TComboBox
Left = 72
Top = 146
Width = 141
Height = 23
AutoDropDown = True
AutoCloseUp = True
Style = csDropDownList
DropDownCount = 20
DropDownWidth = 200
TabOrder = 0
TabStop = False
Visible = False
OnKeyDown = ComboKeyDown
end
end
object m_btnDel: TButton
Left = 352
Top = 40
Width = 75
Height = 23
Caption = #21024#38500
Enabled = False
TabOrder = 3
OnClick = OnDelClick
end
object m_btnTip: TButton
Left = 21
Top = 424
Width = 408
Height = 25
Caption = #28857#20987#26597#30475#35268#21017#35828#26126
Font.Charset = DEFAULT_CHARSET
Font.Color = clBtnText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
TabOrder = 4
OnClick = OnTipClick
end
object m_tsTop: TTabSet
Left = 0
Top = 0
Width = 448
Height = 25
ParentCustomHint = False
Align = alTop
AutoScroll = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
ParentShowHint = False
ShowHint = False
SoftTop = True
Style = tsOwnerDraw
Tabs.Strings = (
#25171#27861
#27880#30721)
TabPosition = tpTop
OnChange = TopChange
OnDrawTab = TopDrawTab
OnMeasureTab = TopMeasureTab
end
object m_pmSG: TPopupMenu
AutoHotkeys = maManual
Left = 301
Top = 307
object miExport: TMenuItem
Caption = #23548#20986#34920#26684'...'
OnClick = OnExport
end
object miImport: TMenuItem
Caption = #23548#20837#34920#26684'...'
OnClick = OnImport
end
end
end
+121
View File
@@ -0,0 +1,121 @@
//---------------------------------------------------------------------------
#ifndef PolicyEditFormUnitH
#define PolicyEditFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Grids.hpp>
#include "PolicyUnit.h"
#include <Vcl.Menus.hpp>
#include <Vcl.Tabs.hpp>
//---------------------------------------------------------------------------
class TPolicyEditForm : public TForm
{
__published: // IDE-managed Components
TLabel *m_lblPolicy;
TComboBox *m_cbPolicy;
TButton *m_btnAdd;
TPanel *m_panEdit;
TButton *m_btnDelRow;
TButton *m_btnSave;
TRadioGroup *m_rgRoad;
TButton *m_btnSelect;
TButton *m_btnDel;
TStringGrid *m_sg;
TPanel *m_panChip;
TLabel *m_lblDead;
TBevel *m_bvChip;
TEdit *m_pEditor;
TRadioButton *m_rbDead0;
TRadioButton *m_rbDead1;
TRadioButton *m_rbDead2;
TEdit *m_edDeadPause;
TLabel *m_lblDead2Tail;
TGroupBox *m_rgDead;
TCheckBox *m_cbTierWinRet;
TCheckBox *m_cbTierAccChip;
TBevel *Bevel1;
TButton *m_btnTip;
TComboBox *m_cbKind;
TComboBox *m_pCombo;
TButton *m_btnInsRow;
TCheckBox *m_cbLevelTotalDiff;
TCheckBox *m_cbLevelInstant;
TCheckBox *m_cbLevelIndie;
TPopupMenu *m_pmSG;
TMenuItem *miExport;
TMenuItem *miImport;
TCheckBox *m_cbTierLos0;
TTabSet *m_tsTop;
void __fastcall FormCreate(TObject *Sender);
void __fastcall OnDelRowClick(TObject *Sender);
void __fastcall OnPolicyChange(TObject *Sender);
void __fastcall OnAddClick(TObject *Sender);
void __fastcall OnSaveClick(TObject *Sender);
void __fastcall SGDrawCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, TRect &Rect, TGridDrawState State);
void __fastcall EditorKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall EditorKeyPress(TObject *Sender, System::WideChar &Key);
void __fastcall SGMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall SGMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall SGTopLeftChanged(TObject *Sender);
void __fastcall SGMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall OnSelectClick(TObject *Sender);
void __fastcall OnDelClick(TObject *Sender);
void __fastcall OnRoadClick(TObject *Sender);
void __fastcall OnDeadClick(TObject *Sender);
void __fastcall EditorExit(TObject *Sender);
void __fastcall SGKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall SGSelectCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, bool &CanSelect);
void __fastcall DeadPauseExit(TObject *Sender);
void __fastcall DeadPauseKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall OnKindChange(TObject *Sender);
void __fastcall OnChipOptionClick(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall OnSPEditChange(TObject *Sender);
void __fastcall OnAskRoadClick(TObject *Sender);
void __fastcall OnTipClick(TObject *Sender);
void __fastcall ComboKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall OnInsRowClick(TObject *Sender);
void __fastcall OnExport(TObject *Sender);
void __fastcall OnImport(TObject *Sender);
void __fastcall TopMeasureTab(TObject *Sender, int Index, int &TabWidth);
void __fastcall TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected);
void __fastcall TopChange(TObject *Sender, int NewTab, bool &AllowChange);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
private: // User declarations
int m_iType;
int m_iSelPolicy;
TBasePolicy* m_editPolicy;
int m_colEdit, m_rowEdit;
int m_nRows, m_nNewNum;
String m_sOrig, m_sType;;
bool m_bRowChanged, m_bColChanged, m_bRoadChanged;
TRadioButton *m_aDeadRB[3];
TFrame *m_frmSP; //ÌØÊâ²ßÂÔÃæ°å
vector<int> m_aCPMap; //ComboÓ³Éä
void __fastcall UpdateGrid();
String __fastcall AutoNewName();
void __fastcall GridEndEdit();
void __fastcall SetSelection(int selRow);
void __fastcall SGSelCell(int ACol, int ARow);
void __fastcall Clear();
void __fastcall CalcNewName();
void __fastcall InitChipGrid(int kind); //0=ÆÕͨעÂë 1=²ã¼¶×¢Âë
void __fastcall ClearSPFrame();
void __fastcall SetView(int type);
public: // User declarations
__fastcall TPolicyEditForm(TComponent* Owner, int iType);//, int iSel);
};
//---------------------------------------------------------------------------
#endif
+72
View File
@@ -0,0 +1,72 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PolicySave.h"
#include "PolicyUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TPolicySaveForm::TPolicySaveForm(TComponent* Owner, int type, String name)
: TForm(Owner)
{
m_iType = type;
m_name = name;
m_sType = type==TYPE_P_BET ? "打法" : "注码";
}
//---------------------------------------------------------------------------
void __fastcall TPolicySaveForm::FormCreate(TObject *Sender)
{
m_leName->Text = m_name;
m_leName->EditLabel->Caption = m_sType + "名称:";
}
//---------------------------------------------------------------------------
void __fastcall TPolicySaveForm::OnOkClick(TObject *Sender)
{
vector<TBasePolicy*>& aPolicies = m_iType==TYPE_P_BET ? g_aBetPolicies : g_aChipPolicies;
// bool bRepeat = false;
int type = -1;
m_iPolicy = -1;
for(int i=0; i<aPolicies.size(); i++){
if(aPolicies[i]->name == m_leName->Text){
m_iPolicy = i;
type = aPolicies[i]->type;
break;
}
}
if(m_iPolicy>=0){
if(type<2){
String msg = "该名称的" + m_sType + "为系统内置,不可覆盖,请修改名称";
MessageBox(Handle, msg.c_str(), L"保存", MB_ICONERROR | MB_OK);
return;
}
else if(IsPolicyInUse(m_iType, m_iPolicy)){
String msg = "该名称的" + m_sType + "正在使用中,不可覆盖,请修改名称";
MessageBox(Handle, msg.c_str(), L"保存", MB_ICONERROR | MB_OK);
return;
}
else{
vector<int> coms = PolicyInCombo(aPolicies[m_iPolicy]->id);
if(!coms.empty()){
String msg = "该名称的" + m_sType + "被组合方案使用,不可覆盖,请修改名称";
MessageBox(Handle, msg.c_str(), L"保存", MB_ICONERROR | MB_OK);
return;
}
String msg = "该名称的" + m_sType + "已存在,是否覆盖?";
int mrRet = MessageBox(Handle, msg.c_str(), L"保存", MB_ICONQUESTION | MB_OKCANCEL);
if(mrRet==mrCancel)
return;
}
}
m_name = m_leName->Text;
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
+62
View File
@@ -0,0 +1,62 @@
object PolicySaveForm: TPolicySaveForm
Left = 0
Top = 0
BorderStyle = bsNone
Caption = 'PolicySaveForm'
ClientHeight = 126
ClientWidth = 303
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poOwnerFormCenter
RoundedCorners = rcOn
OnCreate = FormCreate
TextHeight = 15
object m_panBack: TPanel
Left = 0
Top = 0
Width = 303
Height = 126
Align = alClient
BevelOuter = bvNone
BorderStyle = bsSingle
Ctl3D = False
ParentCtl3D = False
TabOrder = 0
object m_btnCancel: TButton
Left = 161
Top = 78
Width = 75
Height = 25
Caption = #21462#28040
ModalResult = 2
TabOrder = 1
end
object m_btnOk: TButton
Left = 73
Top = 78
Width = 75
Height = 25
Caption = #30830#23450
TabOrder = 2
OnClick = OnOkClick
end
object m_leName: TLabeledEdit
Left = 94
Top = 34
Width = 181
Height = 23
AutoSize = False
EditLabel.Width = 65
EditLabel.Height = 23
EditLabel.Caption = #25171#27861#21517#31216#65306
LabelPosition = lpLeft
MaxLength = 63
TabOrder = 0
Text = ''
end
end
end
+34
View File
@@ -0,0 +1,34 @@
//---------------------------------------------------------------------------
#ifndef PolicySaveH
#define PolicySaveH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Mask.hpp>
//---------------------------------------------------------------------------
class TPolicySaveForm : public TForm
{
__published: // IDE-managed Components
TLabeledEdit *m_leName;
TButton *m_btnOk;
TButton *m_btnCancel;
TPanel *m_panBack;
void __fastcall FormCreate(TObject *Sender);
void __fastcall OnOkClick(TObject *Sender);
private: // User declarations
int m_iType;
String m_sType;
public: // User declarations
String m_name;
int m_iPolicy;
__fastcall TPolicySaveForm(TComponent* Owner, int type, String name);
};
//---------------------------------------------------------------------------
extern PACKAGE TPolicySaveForm *PolicySaveForm;
//---------------------------------------------------------------------------
#endif
+1244
View File
File diff suppressed because it is too large Load Diff
+195
View File
@@ -0,0 +1,195 @@
//---------------------------------------------------------------------------
#ifndef PolicyUnitH
#define PolicyUnitH
//---------------------------------------------------------------------------
#include <system.hpp>
#include <vector>
#define TYPE_P_BET 0
#define TYPE_P_CHIP 1
#define KIND_BET_NOR 0
#define KIND_BET_ASK 2
#define KIND_BET_DIF 3
#define KIND_CHIP_NOR 0
#define KIND_CHIP_HAN 1
#define KIND_CHIP_LEV 2
#define KIND_CHIP_COM 3
#define KIND_CHIP_WLD 4
#define KIND_CHIP_RAN 8
//---------------------------------------------------------------------------
using namespace std;
//策略基类
class TBaseRow {
public:
virtual void Clear()=0;
// TBaseRow(){Clear();};
};
class TBasePolicy {
public:
String name;
int type; //存储类型 0=内置免费 1=内置付费 2=用户自定义 3=用户定制
int id; //唯一ID
int kind; //自定义类型 CHIP:0=普通 1=手数层级 2=组合层级 4=随机 ... BET:0=普通 2=庄闲问路 3=庄闲差...
bool actived; //是否激活
vector<TBaseRow*> aRows;
virtual void AddNewRow()=0;
virtual TBaseRow* ParseRow(char* data, int& err)=0;
virtual int ParsePolicy(char* data, int pt);
virtual void Clear();
virtual void Reset();
TBasePolicy(){id=type=kind=0;}
~TBasePolicy();
};
//打法策略
class TBetRow : public TBaseRow {
public:
vector<int> cond; //切入点匹配,字符串解析为整形保存
// item&0x3=颜色 (item&7C)>>2=个数 item&0x80=是否定长
// int bet; //下注方向
vector<char> bets; //下注项
virtual void Clear(){
cond.clear();
bets.clear();
};
// TBetRow(){};//Clear();};
};
class TBetPolicy : public TBasePolicy{
public:
int road; //适用路单
TBetPolicy& operator = (const TBetPolicy& b);
bool operator == (const TBetPolicy& b);
virtual void AddNewRow();
virtual TBaseRow* ParseRow(char* data, int& err);
vector<int> ParseCondition(char* data);
static vector<char> ParseBet(char* data);
virtual void Reset();
TBetPolicy(){road=0;}
};
//注码策略
class TChipRow : public TBaseRow{
public:
int iSeq; //序号
int chip; //注码/倍数
int iWin; //赢走向
int iLos; //输走向
virtual void Clear(){iSeq=chip=iWin=iLos=0;};
TChipRow(){Clear();};
};
//层级
class TTierRow : public TChipRow{
public:
int hands; //层级注码手数
};
//阶梯
class TLevelRow : public TChipRow{
public:
int nCondWin; //赢走向条件
int nCondLos; //输走向条件
};
//组合
class TComboRow : public TLevelRow{
public:
int id; //方案id
int iPolicy; //方案序号
TComboRow(){id=iPolicy=-1;};
};
////赢输次差
//class TWLDiffRow : public TChipRow{
//public:
// int nMore; //大于数值
// int nLess; //少于数值
//};
class TChipPolicy: public TBasePolicy{
public:
int dead, //爆缆后操作 0=停止 1=新局重启 2=暂停后重启
deadPause; //暂停分钟数
TChipPolicy& operator = (const TChipPolicy& b);
bool operator == (const TChipPolicy& b);
virtual void AddNewRow();
virtual TBaseRow* ParseRow(char* data, int& err);
TChipPolicy(){dead=deadPause=0;}
};
class TTierPolicy: public TChipPolicy{
public:
bool bTierWinRet,//二层以上赢利回基
bTierAccChip, //输额加入下层注码
bTierLos0; //输打0
TTierPolicy(){bTierWinRet=bTierAccChip=bTierLos0=0;}
};
class TLevelPolicy: public TChipPolicy{
public:
bool bTotalDiff, //总体计算输赢
bInstant; //即时跳转
TLevelPolicy(){bTotalDiff=bInstant=0;}
};
class TWLDiffPolicy: public TLevelPolicy{
public:
bool bIndie; //各层分别统计
TWLDiffPolicy(){bIndie=0;}
};
typedef struct tagRandomChip{
int minChip, //最小随机
maxChip; //最大随机
tagRandomChip(){minChip=20, maxChip=100;}
}TRandomChip;
typedef struct tagBPAskBet{
char bet[2]; //庄全红/闲全红 0=不打 1=庄 2=闲
tagBPAskBet(){bet[0]=1, bet[1]=2;}
}TBPAskBet;
typedef struct tagBPDiffBet{
BYTE diff[2]; //庄闲差 0=庄大 1=闲大
// char bet[2]; //庄大/闲大下注 1=庄 2=闲
char bets[2][16]; //庄大/闲大下注 1=庄 2=闲
tagBPDiffBet(){diff[0]=diff[1]=5, strcpy(bets[0],"a"), strcpy(bets[1],"s");}
}TBPDiffBet;
void __fastcall LoadPolicies();
int __fastcall SavePolicy(int type, TBasePolicy* pPolicy, int index);
int __fastcall DeletePolicy(int type, int index);
int __fastcall MinChipOfPolicy(int index);
vector<int> __fastcall PolicyInCombo(int iPolicy);
int __fastcall FindPolicy(int type, int id);
void __fastcall CheckComboRow(TComboRow* row);
extern vector<TBasePolicy*> g_aBetPolicies;
extern vector<TBasePolicy*> g_aChipPolicies;
extern int g_iBetPolicy; //全局打法
extern int g_iChipPolicy;//全局注码
extern int g_nChipMul; //全局注码倍数
extern TRandomChip g_RandomChip;
extern TBPAskBet g_BPAskBet;
extern TBPDiffBet g_BPDiffBet;
#endif
+1649
View File
File diff suppressed because it is too large Load Diff
+335
View File
@@ -0,0 +1,335 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <tchar.h>
#include <System.IOUtils.hpp>
#include <Winternl.h>
#pragma hdrstop
#include "CommonV8Handler.h"
#include "GlobalUnit.h"
//---------------------------------------------------------------------------
#include <Vcl.Styles.hpp>
#include <Vcl.Themes.hpp>
#pragma package(smart_init)
/////////////////////////////////////////////////////////////////////////////
// 获取父进程函数
typedef struct _PROCESS_BASIC_INFORMATIONWOW64 {
NTSTATUS ExitStatus;
ULONG64 PebBaseAddress;
ULONG64 AffinityMask;
LONG BasePriority;
ULONG64 UniqueProcessId;
ULONG64 InheritedFromUniqueProcessId;
} PROCESS_BASIC_INFORMATION_WOW64;
typedef LONG (WINAPI *PNTQUERYINFORMATIONPROCESS)(HANDLE,UINT,PVOID,ULONG,PULONG);
DWORD GetParentProcessId(DWORD pid)//获取指定进程的父进程ID
{
DWORD dwParentPID = 0;
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
if( !hProcess ){
//ShowMessage( "OpenProcess err" );
return -1;
}
PNTQUERYINFORMATIONPROCESS NtQueryInformationProcess = NULL;
BOOL bProcWow = FALSE;
IsWow64Process(hProcess, &bProcWow);
if( bProcWow==TRUE ){
//ShowMessage( "32bit" );
NtQueryInformationProcess = (PNTQUERYINFORMATIONPROCESS)GetProcAddress(GetModuleHandleA("ntdll.dll"),
"NtWow64QueryInformationProcess64");
PROCESS_BASIC_INFORMATION_WOW64 pbi;
NTSTATUS status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, (PVOID)&pbi,
sizeof(PROCESS_BASIC_INFORMATION_WOW64), NULL);
//ShowMessage("NtWow64Query return: " + IntToHex((int)status));
if( NT_SUCCESS(status) )
dwParentPID = (DWORD)pbi.InheritedFromUniqueProcessId;
}
else{
//ShowMessage( "64bit" );
NtQueryInformationProcess = (PNTQUERYINFORMATIONPROCESS)GetProcAddress(GetModuleHandleA("ntdll.dll"),
"NtQueryInformationProcess");
PROCESS_BASIC_INFORMATION pbi;
NTSTATUS status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, (PVOID)&pbi,
sizeof(PROCESS_BASIC_INFORMATION), NULL);
//ShowMessage("NtQuery return: " + IntToHex((int)status));
if( NT_SUCCESS(status) )
dwParentPID = (DWORD)pbi.Reserved3;
}
CloseHandle(hProcess);
return dwParentPID;
}
/////////////////////////////////////////////////////////////////
// 定义枚举窗口回调函数
BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lParam)
{
HANDLE h = GetProp(hwnd, _TEXT(APPABBR));
if(h == (HANDLE)SOFTWARE_ID) {
*(HANDLE*)lParam = hwnd;
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////
// CEF初始化函数
bool InitCef()
{
GlobalCEFApp = new TCefApplication;
GlobalCEFApp->Cache = String(g_AppPath) + "cache";
GlobalCEFApp->Locale = "zh-CN";
GlobalCEFApp->AcceptLanguageList = "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6";
if(g_bTesting){
GlobalCEFApp->LogFile = "debug-" + IntToStr(DateTimeToUnix(Now(), false)) + ".log";
GlobalCEFApp->LogSeverity = LOGSEVERITY_INFO; //LOGSEVERITY_VERBOSE; //
}
else{
GlobalCEFApp->LogSeverity = LOGSEVERITY_DISABLE;
}
GlobalCEFApp->CheckCEFFiles = false;
// GlobalCEFApp->PackLoadingDisabled = false;
GlobalCEFApp->PersistSessionCookies = true;
// GlobalCEFApp->PersistUserPreferences = true;
GlobalCEFApp->IgnoreCertificateErrors = true;
GlobalCEFApp->NoSandbox = true;
GlobalCEFApp->MuteAudio = true;
GlobalCEFApp->EnableGPU = true;
GlobalCEFApp->SitePerProcess = true; //78.0以上iframe运行js代码必须设置
GlobalCEFApp->DisableWebSecurity = true; //78.0以上iframe运行js代码必须设置
GlobalCEFApp->DisableSiteIsolationTrials = true; //78.0以上iframe运行js代码必须设置
GlobalCEFApp->DisableChromeLoginPrompt = true;
GlobalCEFApp->EnableMediaStream = false; //true; //
GlobalCEFApp->LogProcessInfo = false; //true; //
GlobalCEFApp->SingleProcess = false; //true; //
GlobalCEFApp->MultiThreadedMessageLoop = true;
GlobalCEFApp->WindowlessRenderingEnabled = true;
GlobalCEFApp->DisableImageLoading = true;
GlobalCEFApp->OnWebKitInitialized = _di_TOnWebKitInitializedEvent(new TWebKitInitializeEvent());
if( !GlobalCEFApp->StartMainProcess() )
return false;
return true;
}
/////////////////////////////////////////////////////////////////
// 子进程判断函数
bool IsRestart()
{
HWND hWnd = NULL;
if(SINGLE_INSTANCE){
EnumWindows(EnumWndProc,(LPARAM)&hWnd); //枚举所有运行的窗口
}
else{
String strFullName = TPath::GetFullPath(Application->ExeName);
HWND hWnd = FindWindow( (LPCTSTR)strFullName.c_str(), NULL );
}
if( hWnd ){
//ShowMessage("restart");
DWORD wndProcess_id = 0;
DWORD parent_id=GetParentProcessId(GetCurrentProcessId());
GetWindowThreadProcessId( hWnd, &wndProcess_id );
if( wndProcess_id==parent_id ){
//ShowMessage("SubProcess");
InitCef();
return true;
}
else{
SendMessage( hWnd, UM_RESTORE, 0, 0 );
return true;
}
}
return false;
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////
// 程序自动升级函数
void StartUpgrade( int mode )
{
HANDLE hToken = NULL,
hTokenDup = NULL;
if(OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS,&hToken)){
if(DuplicateTokenEx(hToken, TOKEN_ALL_ACCESS,NULL, SecurityIdentification,
TokenPrimary, &hTokenDup)){
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si,sizeof(STARTUPINFO));
ZeroMemory(&pi,sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
si.lpDesktop = NULL;
si.lpReserved = NULL;
si.lpTitle = NULL;
si.cbReserved2 = NULL;
si.lpReserved2 = NULL;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = mode==2 ? SW_SHOWNORMAL //显示进程窗口
: SW_HIDE; //隐藏进程窗口
String command = "\"" + (String)g_AppPath + UPDATE_APP_NAME + "\"";
if( mode==3 )
command += " move ";
else if( mode==2 )
command += " show ";
else
command += " hide ";
command += ExtractFileName(Application->ExeName);
command += " " + IntToStr(SOFTWARE_ID);
command += " " + String(GLOBAL_VAR_FILE);
CreateProcessAsUser(hTokenDup,NULL,command.c_str(),NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
}
}
}
//---------------------------------------------------------------------------
extern bool g_bBacData;
void InitUserPath()
{
String sAppPath = g_AppPath;
String sUserPath = sAppPath + "user\\";
if(!DirectoryExists( sUserPath, false)){
ForceDirectories( sUserPath );
}
if(g_bBacData){
String sDataPath = sAppPath + "data\\";
if(!DirectoryExists( sDataPath, false)){
ForceDirectories( sDataPath );
}
}
}
//---------------------------------------------------------------------------
USEFORM("RBmasterMain.cpp", MainForm);
//---------------------------------------------------------------------------
bool Startup()
{
String strAppPath = ExtractFileDir(ParamStr(0)) + "\\";
strcpy( g_AppPath, ((AnsiString)strAppPath).c_str() );
for(int i=1; i<=ParamCount(); i++){
String sParam = LowerCase(ParamStr(i));
if (sParam == "-d")
g_bBacData = true;
else if (sParam == "-testing")
g_bTesting = true;
}
if( IsRestart() ){
return false;
}
try{
Application->Initialize();
int tag = 0;
if( !InitCef() ){
tag = -5;
}
else{
InitUserPath();
Application->Title = APPNAME;
Application->CreateForm(__classid(TMainForm), &MainForm);
Application->MainFormOnTaskBar = true;
tag = Application->MainForm->Tag;
}
bool bRun(0);
if( tag==0 ){
bRun = true;
}
else if( tag==-1 ){
ShowMessage( "加载应用模块失败,退出程序" );
}
else if( tag==-3 ){
ShowMessage( "连接服务器失败,退出程序" );
}
else if( tag==-4 ){
ShowMessage( "软件已停止运行,退出程序" );
}
else if( tag==-5 ){
ShowMessage( "初始化网络模块失败,退出程序" );
return false;
}
else{
int mode = tag;
if( tag==4 ){
int mrRet = MessageBox(NULL, L"检测到有新的版本,是否立即升级?",
APPNAME, MB_ICONQUESTION | MB_YESNO);
if( mrRet==mrYes )
mode = 2;
else
mode = 0;
}
else if( tag==2 ){
ShowMessage( "软件运行需更新相关组件,即将启动更新程序" );
}
bRun = mode<=1;
if( mode>0 )
StartUpgrade( mode );
}
if(bRun){
if(!g_bTesting)
SetProp(Application->MainFormHandle, _TEXT(APPABBR), (HANDLE)SOFTWARE_ID);
Application->HintHidePause = 10000;
Application->MainForm->Show();
Application->Run();
if(!g_bTesting)
RemoveProp(Application->MainFormHandle, _TEXT(APPABBR));
}
DestroyGlobalCEFApp();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return true;
}
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
if( !Startup() )
return -1;
return 0;
}
//---------------------------------------------------------------------------
+4348
View File
File diff suppressed because it is too large Load Diff
+139908
View File
File diff suppressed because it is too large Load Diff
+313
View File
@@ -0,0 +1,313 @@
//---------------------------------------------------------------------------
#ifndef RBmasterMainH
#define RBmasterMainH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.ComCtrls.hpp>
#include <Vcl.Grids.hpp>
#include "CEF4DelphiVCLRTL.hpp"
#include "GlobalUnit.h"
#include <Vcl.Mask.hpp>
#include <Vcl.WinXCtrls.hpp>
#include "InfoFrameUnit.h"
#include <Vcl.TitleBarCtrls.hpp>
#include <Vcl.Imaging.jpeg.hpp>
#include <Vcl.Imaging.pngimage.hpp>
#include <Vcl.Menus.hpp>
#include "TableUnit.h"
#include <vector>
#include <set>
using namespace std;
//---------------------------------------------------------------------------
class TMainForm : public TForm
{
__published: // IDE-managed Components
TBitBtn *m_btnSetting;
TScrollBox *m_panWeb;
TComboBox *m_cbRoad;
TToggleSwitch *m_tsMode;
TComboBox *m_cbBetWays;
TLabel *m_lblBetWayEdit;
TPanel *m_panTopBar;
TLabel *m_lblBetChipEdit;
TComboBox *m_cbBetChips;
TBitBtn *m_btnChart;
TBitBtn *m_btnLogs;
TBitBtn *m_btnStart;
TBitBtn *m_btnTables;
TBitBtn *m_btnLogin;
TLabeledEdit *m_leChipMul;
TLabel *m_lblTips;
TBevel *Bevel1;
TBevel *Bevel2;
TBevel *Bevel3;
TBevel *Bevel4;
TBitBtn *m_btnManual;
TBitBtn *m_btnReset;
TImage *m_imgBack;
TLabel *m_lblAnnonce;
TPopupMenu *m_pmCopyAccount;
TMenuItem *m_miCopyAccount;
TInfoFrame *m_frmInfo;
TPopupMenu *m_pmLogin;
TMenuItem *m_miPA;
TMenuItem *m_miAB;
TMenuItem *m_miDB;
TPopupMenu *m_pmRight;
TMenuItem *m_miRun;
TMenuItem *m_miRunOnly;
TMenuItem *m_miStop;
TMenuItem *N1;
TMenuItem *N2;
TMenuItem *m_miUnselect;
TMenuItem *m_miStopOthers;
TMenuItem *N3;
TMenuItem *m_miSpec;
TMenuItem *N4;
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormResize(TObject *Sender);
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall OnStartClick(TObject *Sender);
void __fastcall WebMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall WebMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall OnRoadChange(TObject *Sender);
void __fastcall OnTablesClick(TObject *Sender);
void __fastcall OnModeClick(TObject *Sender);
void __fastcall OnPolicyEditClick(TObject *Sender);
void __fastcall OnPolicyChange(TObject *Sender);
void __fastcall OnLoginClick(TObject *Sender);
void __fastcall OnChipMulExit(TObject *Sender);
void __fastcall OnLogsClick(TObject *Sender);
void __fastcall OnChartClick(TObject *Sender);
void __fastcall OnSettingClick(TObject *Sender);
void __fastcall OnResetClick(TObject *Sender);
void __fastcall OnManualClick(TObject *Sender);
void __fastcall OnChipMulKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall OnAccountClick(TObject *Sender);
void __fastcall FormActivate(TObject *Sender);
void __fastcall OnLoginMenuClick(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall OnComboCloseUp(TObject *Sender);
void __fastcall WebMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall WebMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall WebMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall OnPMRightClick(TObject *Sender);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
private: // User declarations
HINSTANCE m_hPMDll;
int m_iWSVelo, m_iWS;
String m_loginValues[6];
String m_url;
String m_sActCode; //授权码
int m_tExpire; //授权有效期
UINT m_idDevice; //设备号
WORD m_version[4];
TThread *m_vlThread, //Velo线程
*m_jsThread, //JS处理线程
*m_urThread, //用户鉴权线程
*m_dpThread; //数据解析线程
TTimer *m_pDPTimer, //数据处理定时器
*m_pUtilTimer; //工具定时器,Tag区分用途
int m_tmChart, //图表定时计数
m_tmWebFocus, //网页激活定时计数
// m_tmWebTimeout, //网页无数据超时
m_tmCount, //秒计数器
m_tmLogon, //登录时间
m_tmDailyLogin, //每日登录时间
m_tmDailyReport, //每日上报时间
m_tmDeadPause, //爆缆暂停定时计数
m_tmBetPause; //止赢止损暂停定时计数
bool m_bWebLogon,
m_bClosing,
m_bManual;
int m_nTabCols, m_nTabGap;
int m_iWindowState,
m_nLeft, m_nTop, m_nWidth, m_nHeight;
TChromium *m_chrm;
TStringList* m_v8Values;
HANDLE m_hV8Sema;
HANDLE m_hV8ValueSema;
// bool m_bV8Waiting;
vector<TTableFrame*> m_aTables;
vector<TThread*> m_aABThreads; //自动下注线程组
int m_nTabShow, m_nTabRun;
bool m_bDragReady, //鼠标拖动进行选择操作
m_bDraging;
TTimer *m_pDragTimer; //拖动滚屏定时器
int m_iLastSel; //最后单独选中台桌
set<int> m_aSelTabs; //选中台桌集合
int __fastcall TryUpdate();
int __fastcall InitGlobalVars();
void __fastcall DPTimerProc(TObject* Sender);
void __fastcall UtilTimerProc(TObject* Sender);
bool __fastcall WebsiteVelocity();
void __fastcall InitBrowser();
void __fastcall FileUserWeb( bool bSave=false );
void __fastcall FileGame( bool bSave=false );
void __fastcall FileUserVars( bool bSave=false );
void __fastcall ClearABThread(int hThread=0);
void __fastcall ClearDPThread();
void __fastcall ClearJSThread();
void __fastcall ClearVLThread();
void __fastcall ClearURThread();
void __fastcall ClearUtilTimer();
void __fastcall OnWSConnectError();
void __fastcall ResetGame();
void __fastcall GameOn();
void __fastcall GameOff(int iReason=0); //用户停止或退出
void __fastcall ManualOn();
void __fastcall ManualOff();
void __fastcall StartJSThread(int iOp);
void __fastcall ResetTableGrid();
void __fastcall ClearGames();
Int8 __fastcall ShowSettingForm();
void __fastcall ChangeWebsite();
int __fastcall GetTimeCount();
void __fastcall RBReport();
void __fastcall LoadUrl();
void __fastcall RecalcMultiRate();
void __fastcall SetTableFocus();
int __fastcall GetTableByPos(int x, int y);
void __fastcall SelectTables(int x1, int y1, int x2, int y2);
void __fastcall ClearSelect();
void __fastcall SetScrollTimer(int y);
void __fastcall ScrollTimerProc(TObject* Sender);
void __fastcall ReleaseV8ValueSema();
void __fastcall GetDeviceId();
void __fastcall Logout();
void __fastcall SetExpireJS();
bool __fastcall StopWebLoad();
void __fastcall WebAfterCreated(TObject *Sender, const _di_ICefBrowser browser);
void __fastcall WebBeforeClose(TObject* Sender, const _di_ICefBrowser browse);
void __fastcall WebBeforeContextMenu(TObject* Sender, const _di_ICefBrowser browser,
const _di_ICefFrame frame, const _di_ICefContextMenuParams params,
const _di_ICefMenuModel model);
void __fastcall WebBeforePopup(TObject* Sender, const _di_ICefBrowser browser, const _di_ICefFrame frame,
int popup_id, const ustring targetUrl, const ustring targetFrameName,
TCefWindowOpenDisposition targetDisposition, bool userGesture, const TCefPopupFeatures &popupFeatures,
TCefWindowInfo &windowInfo, _di_ICefClient &client, TCefBrowserSettings &settings,
_di_ICefDictionaryValue &extra_info, bool &noJavascriptAccess, bool &Result);
void __fastcall WebLoadEnd(TObject* Sender, const _di_ICefBrowser browser,
const _di_ICefFrame frame, int httpStatusCode);
void __fastcall WebProcessMessageReceived(TObject* Sender, const _di_ICefBrowser browser,
const _di_ICefFrame frame, TCefProcessId sourceProcess, const _di_ICefProcessMessage message,
/* out */ bool &Result);
void __fastcall WebResourceLoadComplete(TObject* Sender, const _di_ICefBrowser browser,
const _di_ICefFrame frame, const _di_ICefRequest request, const _di_ICefResponse response,
TCefUrlRequestStatus status, __int64 receivedContentLength);
// void __fastcall WebAddressChange(TObject* Sender, const _di_ICefBrowser browser,
// const _di_ICefFrame frame, const ustring url);
void __fastcall WebJsdialog(TObject* Sender, const _di_ICefBrowser browser, const ustring originUrl,
TCefJsDialogType dialogType, const ustring messageText, const ustring defaultPromptText,
_di_ICefJsDialogCallback callback, /* out */ bool &suppressMessage, /* out */ bool &Result);
void __fastcall WebLoadError(TObject* Sender, const _di_ICefBrowser browser, const _di_ICefFrame frame,
TCefErrorCode errorCode, const ustring errorText, const ustring failedUrl);
// void __fastcall WebPaint(TObject* Sender, const _di_ICefBrowser browser, TCefPaintElementType type_,
// NativeUInt dirtyRectsCount, const PCefRectArray dirtyRects, const void * buffer,
// int width, int height);
// void __fastcall WebGetViewRect(TObject* Sender, const _di_ICefBrowser browser, TCefRect &rect);
void __fastcall WebBeforeResourceLoad(TObject* Sender, const _di_ICefBrowser browser, const _di_ICefFrame frame,
const _di_ICefRequest request, const _di_ICefCallback callback, /* out */ TCefReturnValue &Result);
//消息处理
MESSAGE void __fastcall FormMove(TWMMove &msg);
MESSAGE void __fastcall SystemMenuCommand(TWMMenuSelect &Msg);
MESSAGE void __fastcall UMAutoBetEnd(TMessage &msg);
MESSAGE void __fastcall UMRestoreWindow(TMessage &msg);
MESSAGE void __fastcall UMVelocity(TMessage &msg);
MESSAGE void __fastcall UMJsHandled(TMessage &msg);
MESSAGE void __fastcall UMCheckCEF(TMessage &msg);
MESSAGE void __fastcall UMSetBet(TMessage &msg);
MESSAGE void __fastcall UMAddTable(TMessage &msg);
MESSAGE void __fastcall UMStatus(TMessage &msg);
MESSAGE void __fastcall UMWebLogin(TMessage &msg);
MESSAGE void __fastcall UMHttpReturn(TMessage &msg);
MESSAGE void __fastcall UMUserConfirm(TMessage &msg);
MESSAGE void __fastcall UMWebDead(TMessage &msg);
MESSAGE void __fastcall UMPolicyChanged(TMessage &msg);
MESSAGE void __fastcall UMLogUpdate(TMessage &msg);
MESSAGE void __fastcall UMStateUpdate(TMessage &msg);
MESSAGE void __fastcall UMChartUpdate(TMessage &msg);
MESSAGE void __fastcall UMEnterTable(TMessage &msg);
MESSAGE void __fastcall UMFloatBet(TMessage &msg);
MESSAGE void __fastcall UMFloatDead(TMessage &msg);
MESSAGE void __fastcall UMGlobalBet(TMessage &msg);
MESSAGE void __fastcall UMGlobalDead(TMessage &msg);
MESSAGE void __fastcall UMShowActCode(TMessage &msg);
MESSAGE void __fastcall UMOpenManual(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_MOVE, TWMMove, FormMove)
MESSAGE_HANDLER(WM_SYSCOMMAND,TWMMenuSelect,SystemMenuCommand)
MESSAGE_HANDLER(UM_AUTOBETEND, TMessage, UMAutoBetEnd)
MESSAGE_HANDLER(UM_RESTORE, TMessage, UMRestoreWindow)
MESSAGE_HANDLER(UM_VELOCITY, TMessage, UMVelocity)
MESSAGE_HANDLER(UM_JSHANDLED, TMessage, UMJsHandled)
MESSAGE_HANDLER(UM_CHECKCEF, TMessage, UMCheckCEF)
MESSAGE_HANDLER(UM_SETBET, TMessage, UMSetBet)
MESSAGE_HANDLER(UM_ADDTABLE, TMessage, UMAddTable)
MESSAGE_HANDLER(UM_STATUS, TMessage, UMStatus)
MESSAGE_HANDLER(UM_WEBLOGIN, TMessage, UMWebLogin)
MESSAGE_HANDLER(UM_USERCONFIRM, TMessage, UMUserConfirm)
MESSAGE_HANDLER(UM_HTTPRETURN, TMessage, UMHttpReturn)
MESSAGE_HANDLER(UM_WEBDEAD, TMessage, UMWebDead)
MESSAGE_HANDLER(UM_POLICYCHANGED, TMessage, UMPolicyChanged)
MESSAGE_HANDLER(UM_LOG_UPDATE, TMessage, UMLogUpdate)
MESSAGE_HANDLER(UM_STATE_UPDATE, TMessage, UMStateUpdate)
MESSAGE_HANDLER(UM_CHART_UPDATE, TMessage, UMChartUpdate)
MESSAGE_HANDLER(UM_ENTER_TABLE, TMessage, UMEnterTable)
MESSAGE_HANDLER(UM_FLOAT_BET, TMessage, UMFloatBet)
MESSAGE_HANDLER(UM_FLOAT_DEAD, TMessage, UMFloatDead)
MESSAGE_HANDLER(UM_GLOBAL_BET, TMessage, UMGlobalBet)
MESSAGE_HANDLER(UM_GLOBAL_DEAD, TMessage, UMGlobalDead)
MESSAGE_HANDLER(UM_SUBFORMSHOWN, TMessage, UMShowActCode)
MESSAGE_HANDLER(UM_OPENMAUAL, TMessage, UMOpenManual)
END_MESSAGE_MAP(TForm)
protected:
virtual void __fastcall CreateParams(TCreateParams &Params);
public: // User declarations
String m_strStatus;
__fastcall TMainForm(TComponent* Owner);
_di_ICefFrame __fastcall GetCefFrame( int type );
TStringList* __fastcall GetJQValue( String& str, _di_ICefFrame frame );
int __fastcall IsPolicyInUse(int type, int iPolicy);
// bool __fastcall IsGameOn(){return m_bGameOn && !m_tmBetPause;};
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
+234
View File
@@ -0,0 +1,234 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GlobalUnit.h"
#include "ResetFormUnit.h"
#include "GameUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TResetForm *ResetForm = NULL;
//---------------------------------------------------------------------------
__fastcall TResetForm::TResetForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::SelAllClick(TObject *Sender)
{
m_cbAmount->Checked = true;
m_cbTotProfit->Checked = true;
m_cbPeakU->Checked = true;
m_cbPeakL->Checked = true;
m_cbRealAmount->Checked = true;
m_cbRealProfit->Checked = true;
m_cbManAmount->Checked = true;
m_cbManProfit->Checked = true;
m_cbWinCount->Checked = true;
m_cbLosCount->Checked = true;
m_cbSWin->Checked = true;
m_cbSLos->Checked = true;
m_cbCurrProfit->Checked = true;
m_cbMaxChip->Checked = true;
m_cbSRProfit->Checked = true;
m_cbDead->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::SelNoneClick(TObject *Sender)
{
m_cbAmount->Checked = false;
m_cbTotProfit->Checked = false;
m_cbPeakU->Checked = false;
m_cbPeakL->Checked = false;
m_cbRealAmount->Checked = false;
m_cbRealProfit->Checked = false;
m_cbManAmount->Checked = false;
m_cbManProfit->Checked = false;
m_cbWinCount->Checked = false;
m_cbLosCount->Checked = false;
m_cbSWin->Checked = false;
m_cbSLos->Checked = false;
m_cbCurrProfit->Checked = false;
m_cbMaxChip->Checked = false;
m_cbSRProfit->Checked = false;
m_cbDead->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::OkClick(TObject *Sender)
{
for(int i=0; i<g_aGames.size(); i++){
TGame* pG = g_aGames[i];
if(m_cbTotProfit->Checked)
pG->profit = 0;
if(m_cbSWin->Checked)
pG->seqCount[0] = 0;
if(m_cbSLos->Checked)
pG->seqCount[1] = 0;
}
if(m_cbAmount->Checked){
g_aGames.betData.amounts[0] = 0;
// g_aGames.betData.profits[0] = 0;
// PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_AMOUNT, 0);
}
if(m_cbAmount->Checked || m_cbTotProfit->Checked){
g_aGames.betData.profits[0] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_AMOUNT, 0);
PostMessage(Application->MainFormHandle, UM_CHART_UPDATE, 0, 1);
}
if(m_cbPeakU->Checked || m_cbPeakL->Checked){
if(m_cbPeakU->Checked) g_aGames.betData.profits[1] = 0;
if(m_cbPeakL->Checked) g_aGames.betData.profits[2] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_PEAK, 0);
}
if(m_cbRealAmount->Checked){
g_aGames.betData.amounts[1] = 0;
g_aGames.betData.profits[4] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_REAL, 1);
}
else if(m_cbRealProfit->Checked){
g_aGames.betData.profits[4] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_REAL, 0);
}
if(m_cbManAmount->Checked){
g_aGames.betData.amounts[2] = 0;
g_aGames.betData.profits[5] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MAN, 1);
}
else if(m_cbManProfit->Checked){
g_aGames.betData.profits[5] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MAN, 0);
}
if(m_cbCurrProfit->Checked){
g_aGames.betData.profits[3] = g_aGames.fCurrProfitPeak = 0;
g_aGames.betData.profits[6] = g_aGames.betData.profits[7] = 0;
for(int i=0; i<g_aGames.size(); i++){ //台桌数据也要重置
TGame* pG = g_aGames[i];
pG->profit = 0;
if(pG->hTable) PostMessage(pG->hTable, UM_TAB_UPDATE, UPDATE_RESET, 0);
}
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BET_R, 0);
}
else if(m_cbSRProfit->Checked){
g_aGames.betData.profits[6] = g_aGames.betData.profits[7] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BET_R, 0);
}
if(m_cbWinCount->Checked || m_cbLosCount->Checked){
if(m_cbWinCount->Checked){
g_aGames.betData.counts[0] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_COUNT, 0);
}
if(m_cbLosCount->Checked){
g_aGames.betData.counts[1] = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_COUNT, 1);
}
PostMessage(Application->MainFormHandle, UM_CHART_UPDATE, 3, 1);
}
if(m_cbSWin->Checked){
g_aGames.betData.counts[2] = 0;
for(int i=0; i<g_aGames.size(); i++){ //台桌数据也要重置
TGame* pG = g_aGames[i];
pG->seqCount[0] = 0;
if(pG->hTable) PostMessage(pG->hTable, UM_TAB_UPDATE, UPDATE_RESET, 1);
}
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_COUNT, 2);
}
if(m_cbSLos->Checked){
g_aGames.betData.counts[3] = 0;
for(int i=0; i<g_aGames.size(); i++){ //台桌数据也要重置
TGame* pG = g_aGames[i];
pG->seqCount[1] = 0;
if(pG->hTable) PostMessage(pG->hTable, UM_TAB_UPDATE, UPDATE_RESET, 2);
}
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_COUNT, 3);
}
if(m_cbMaxChip->Checked){
g_aGames.betData.maxChip = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MISC, 0);
}
if(m_cbDead->Checked){
g_aGames.betData.dead = 0;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MISC, 0);
}
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(X < 0 || Y < 0 || X > Width || Y > Height)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::FormMouseEnter(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse enter %d - %d", cPos.X, cPos.Y);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
if(MouseCapture){
MouseCapture = false;
// DebugPrint("discaptured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::FormMouseLeave(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse leave %d - %d of %d - %d", cPos.X, cPos.Y);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
m_bMouseOver = false;
if(!MouseCapture){
MouseCapture = true;
// DebugPrint("captured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
ResetIdle();
if(!m_bMouseOver && X>10 && X<Width-10 && Y>10 && Y<Height-10){
m_bMouseOver = true;
MouseCapture = false;
// DebugPrint("discaptured %d - %d", X, Y);
}
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::FormShow(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
MouseCapture = false;
}
else{
m_bMouseOver = false;
MouseCapture = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TResetForm::WMKillFocus(TWMKillFocus &Message)
{
if(!m_bMouseOver)
ModalResult = mrCancel;
}
//--------------------------------------------------------
void __fastcall TResetForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if(Key==VK_ESCAPE)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
+198
View File
@@ -0,0 +1,198 @@
object ResetForm: TResetForm
Left = 0
Top = 0
Hint = #27169#23454#36194#20111#20540#36798#21040#36194#21033#20540#21518#36716#23454#25171
ParentCustomHint = False
BiDiMode = bdLeftToRight
BorderIcons = []
BorderStyle = bsNone
Caption = #37325#32622#25968#25454
ClientHeight = 224
ClientWidth = 423
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
FormStyle = fsStayOnTop
KeyPreview = True
ParentBiDiMode = False
OnKeyDown = FormKeyDown
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnShow = FormShow
TextHeight = 15
object m_panBack: TPanel
Left = 0
Top = 0
Width = 423
Height = 224
Align = alClient
TabOrder = 0
OnMouseEnter = FormMouseEnter
OnMouseLeave = FormMouseLeave
object m_btnOk: TButton
Left = 330
Top = 177
Width = 70
Height = 25
Caption = #30830#23450
TabOrder = 0
OnClick = OkClick
end
object m_gb: TGroupBox
Left = 23
Top = 15
Width = 377
Height = 146
TabOrder = 1
object m_cbAmount: TCheckBox
Left = 21
Top = 21
Width = 80
Height = 17
Caption = #24635#27969#27700
TabOrder = 0
end
object m_cbDead: TCheckBox
Left = 280
Top = 111
Width = 80
Height = 17
Caption = #29190#32518#25968
TabOrder = 1
end
object m_cbLosCount: TCheckBox
Left = 107
Top = 81
Width = 80
Height = 17
Caption = #24635#36755#27425#25968
TabOrder = 2
end
object m_cbManProfit: TCheckBox
Left = 280
Top = 51
Width = 80
Height = 17
Caption = #25163#24037#36194#21033
TabOrder = 4
end
object m_cbPeakL: TCheckBox
Left = 280
Top = 21
Width = 80
Height = 17
Caption = #26368#22823#20111#25439
TabOrder = 5
end
object m_cbPeakU: TCheckBox
Left = 193
Top = 21
Width = 80
Height = 17
Caption = #26368#22823#36194#21033
TabOrder = 6
end
object m_cbTotProfit: TCheckBox
Left = 107
Top = 21
Width = 80
Height = 17
Caption = #24635#36194#21033
TabOrder = 7
end
object m_cbSLos: TCheckBox
Left = 280
Top = 81
Width = 80
Height = 17
Caption = #26368#22823#36830#36755
TabOrder = 8
end
object m_cbSWin: TCheckBox
Left = 193
Top = 81
Width = 80
Height = 17
Caption = #26368#22823#36830#36194
TabOrder = 9
end
object m_cbWinCount: TCheckBox
Left = 21
Top = 81
Width = 80
Height = 17
Caption = #24635#36194#27425#25968
TabOrder = 10
end
object m_cbRealProfit: TCheckBox
Left = 107
Top = 51
Width = 80
Height = 17
Caption = #23454#25171#36194#21033
TabOrder = 11
end
object m_cbRealAmount: TCheckBox
Left = 21
Top = 51
Width = 80
Height = 17
Caption = #23454#25171#27969#27700
TabOrder = 12
end
object m_cbManAmount: TCheckBox
Left = 193
Top = 51
Width = 80
Height = 17
Caption = #25163#24037#27969#27700
TabOrder = 3
end
object m_cbCurrProfit: TCheckBox
Left = 21
Top = 111
Width = 80
Height = 17
Caption = #24403#26399#36194#21033
TabOrder = 13
end
object m_cbMaxChip: TCheckBox
Left = 107
Top = 111
Width = 80
Height = 17
Caption = #26368#22823#27880#30721
TabOrder = 14
end
object m_cbSRProfit: TCheckBox
Left = 193
Top = 111
Width = 80
Height = 17
Caption = #27169#23454#36194#20111
TabOrder = 15
end
end
object m_btnSelAll: TButton
Left = 23
Top = 177
Width = 70
Height = 25
Caption = #20840#36873
TabOrder = 2
OnClick = SelAllClick
end
object m_btnSelNone: TButton
Left = 100
Top = 177
Width = 70
Height = 25
Caption = #20840#19981#36873
TabOrder = 3
OnClick = SelNoneClick
end
end
end
+59
View File
@@ -0,0 +1,59 @@
//---------------------------------------------------------------------------
#ifndef ResetFormUnitH
#define ResetFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TResetForm : public TForm
{
__published: // IDE-managed Components
TPanel *m_panBack;
TButton *m_btnOk;
TGroupBox *m_gb;
TCheckBox *m_cbAmount;
TCheckBox *m_cbDead;
TCheckBox *m_cbLosCount;
TCheckBox *m_cbManProfit;
TCheckBox *m_cbPeakL;
TCheckBox *m_cbPeakU;
TCheckBox *m_cbTotProfit;
TCheckBox *m_cbSLos;
TCheckBox *m_cbSWin;
TCheckBox *m_cbWinCount;
TCheckBox *m_cbRealProfit;
TCheckBox *m_cbRealAmount;
TCheckBox *m_cbManAmount;
TCheckBox *m_cbCurrProfit;
TCheckBox *m_cbMaxChip;
TCheckBox *m_cbSRProfit;
TButton *m_btnSelAll;
TButton *m_btnSelNone;
void __fastcall SelAllClick(TObject *Sender);
void __fastcall SelNoneClick(TObject *Sender);
void __fastcall OkClick(TObject *Sender);
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall FormMouseEnter(TObject *Sender);
void __fastcall FormMouseLeave(TObject *Sender);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
bool m_bMouseOver;
MESSAGE void __fastcall WMKillFocus(TWMKillFocus &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_KILLFOCUS, TWMKillFocus, WMKillFocus)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TResetForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TResetForm *ResetForm;
//---------------------------------------------------------------------------
#endif
+516
View File
@@ -0,0 +1,516 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "SettingFormUnit.h"
#include "GameUnit.h"
#include "GlobalUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSettingForm *SettingForm = NULL;
//---------------------------------------------------------------------------
__fastcall TSettingForm::TSettingForm(TComponent* Owner)
: TForm(Owner)
{
//开始挂机
m_cbWaitNew->Checked = g_settings.bWaitNew;
m_cbInitClearTabLog->Checked = g_settings.bInitClearTabLog;
m_cbInitBetChipByStart->Checked = g_settings.bInitBetChipByStart;
m_cbInitTabProfitByStart->Checked = g_settings.bInitTabProfitByStart;
m_cbInitCurProfitByStart->Checked = g_settings.bInitCurProfitByStart;
//台桌新局
m_cbInitBetByGame->Checked = g_settings.bInitBetByGame;
m_cbInitChipByGame->Checked = g_settings.bInitChipByGame;
m_cbInitProfitByGame->Checked = g_settings.bInitProfitByGame;
m_cbInitLogByGame->Checked = g_settings.bInitLogByGame;
//模拟本金
m_aRelatedCB[0] = m_cbSimAcc;
m_aRelatedCtrl[0].push_back(m_edSimAcc);
m_aRelatedCtrl[0].push_back(m_cbNoBetLow);
m_aRelatedCtrl[0].push_back(m_cbStopLow);
m_aRelatedCtrl[0].push_back(m_cbSyncReal);
m_cbSimAcc->Checked = g_settings.bSimAccOn;
m_edSimAcc->Text = g_settings.fSimAcc;
m_cbNoBetLow->Checked = g_settings.bNoBetLow;
m_cbStopLow->Checked = g_settings.bStopLow;
m_cbSyncReal->Checked = g_settings.bSyncReal;
//总体止赢
m_aRelatedCB[1] = m_cbTotalStopWin;
m_aRelatedCtrl[1].push_back(m_edTotalStopWin);
m_aRelatedCtrl[1].push_back(m_edTotalWinPause);
m_aRelatedCtrl[1].push_back(m_rbTotalWin0);
m_aRelatedCtrl[1].push_back(m_rbTotalWin1);
m_aRelatedCtrl[1].push_back(m_rbTotalWin2);
m_aRelatedCtrl[1].push_back(m_lbTotalWin);
m_cbTotalStopWin->Checked = g_settings.bTotalStopWin;
m_edTotalStopWin->Text = g_settings.nTotalStopWin;
m_edTotalWinPause->Text = g_settings.nTotalWinPause;
m_aTotalWinRB[0] = m_rbTotalWin0;
m_aTotalWinRB[1] = m_rbTotalWin1;
m_aTotalWinRB[2] = m_rbTotalWin2;
m_aTotalWinRB[g_settings.iTotalWinOp]->Checked = true;
//总体止损
m_aRelatedCB[2] = m_cbTotalStopLos;
m_aRelatedCtrl[2].push_back(m_edTotalStopLos);
m_aRelatedCtrl[2].push_back(m_edTotalLosPause);
m_aRelatedCtrl[2].push_back(m_rbTotalLos0);
m_aRelatedCtrl[2].push_back(m_rbTotalLos1);
m_aRelatedCtrl[2].push_back(m_rbTotalLos2);
m_aRelatedCtrl[2].push_back(m_lbTotalLos);
m_cbTotalStopLos->Checked = g_settings.bTotalStopLos;
m_edTotalStopLos->Text = g_settings.nTotalStopLos;
m_edTotalLosPause->Text = g_settings.nTotalLosPause;
m_aTotalLosRB[0] = m_rbTotalLos0;
m_aTotalLosRB[1] = m_rbTotalLos1;
m_aTotalLosRB[2] = m_rbTotalLos2;
m_aTotalLosRB[g_settings.iTotalLosOp]->Checked = true;
//赢利回落
m_aRelatedCB[3] = m_cbU2DStop;
m_aRelatedCtrl[3].push_back(m_cbU2DPause);
m_aRelatedCtrl[3].push_back(m_cbU2DMinPeak);
m_aRelatedCtrl[3].push_back(m_edU2DStop);
m_aRelatedCtrl[3].push_back(m_edU2DPause);
m_aRelatedCtrl[3].push_back(m_edU2DMinPeak);
m_aRelatedCtrl[3].push_back(m_lbU2DStop);
m_aRelatedCtrl[3].push_back(m_lbU2DPause);
m_cbU2DStop->Checked = g_settings.bU2DStop;
m_cbU2DMinPeak->Checked = g_settings.bU2DMinPeak;
m_cbU2DPause->Checked = g_settings.bU2DPause;
m_edU2DStop->Text = g_settings.nU2DStop;
m_edU2DMinPeak->Text = g_settings.nU2DMinPeak;
m_edU2DPause->Text = g_settings.nU2DPause;
//账户止赢
m_aRelatedCB[4] = m_cbAccStopWin;
m_aRelatedCtrl[4].push_back(m_edAccStopWin);
m_aRelatedCtrl[4].push_back(m_lbAccStopWin);
m_cbAccStopWin->Checked = g_settings.bAccStopWin;
m_edAccStopWin->Text = g_settings.nAccStopWin;
//账户止损
m_aRelatedCB[5] = m_cbAccStopLos;
m_aRelatedCtrl[5].push_back(m_edAccStopLos);
m_aRelatedCtrl[5].push_back(m_lbAccStopLos);
m_cbAccStopLos->Checked = g_settings.bAccStopLos;
m_edAccStopLos->Text = g_settings.nAccStopLos;
//单桌止赢
m_aRelatedCB[6] = m_cbTableStopWin;
m_aRelatedCtrl[6].push_back(m_edTableStopWin);
m_aRelatedCtrl[6].push_back(m_edTableWinPause);
m_aRelatedCtrl[6].push_back(m_rbTableWin0);
m_aRelatedCtrl[6].push_back(m_rbTableWin1);
m_aRelatedCtrl[6].push_back(m_rbTableWin2);
m_aRelatedCtrl[6].push_back(m_lbTableWin);
m_cbTableStopWin->Checked = g_settings.bTableStopWin;
m_edTableStopWin->Text = g_settings.nTableStopWin;
m_edTableWinPause->Text = g_settings.nTableWinPause;
m_aTableWinRB[0] = m_rbTableWin0;
m_aTableWinRB[1] = m_rbTableWin1;
m_aTableWinRB[2] = m_rbTableWin2;
m_aTableWinRB[g_settings.iTableWinOp]->Checked = true;
//单桌止损
m_aRelatedCB[7] = m_cbTableStopLos;
m_aRelatedCtrl[7].push_back(m_edTableStopLos);
m_aRelatedCtrl[7].push_back(m_edTableLosPause);
m_aRelatedCtrl[7].push_back(m_rbTableLos0);
m_aRelatedCtrl[7].push_back(m_rbTableLos1);
m_aRelatedCtrl[7].push_back(m_rbTableLos2);
m_aRelatedCtrl[7].push_back(m_lbTableLos);
m_cbTableStopLos->Checked = g_settings.bTableStopLos;
m_edTableStopLos->Text = g_settings.nTableStopLos;
m_edTableLosPause->Text = g_settings.nTableLosPause;
m_aTableLosRB[0] = m_rbTableLos0;
m_aTableLosRB[1] = m_rbTableLos1;
m_aTableLosRB[2] = m_rbTableLos2;
m_aTableLosRB[g_settings.iTableLosOp]->Checked = true;
//模拟赢转实打
m_aRelatedCB[8] = m_cbS2RWin;
m_aRelatedCtrl[8].push_back(m_edS2RWin);
m_aRelatedCtrl[8].push_back(m_lbS2RWin);
m_cbS2RWin->Checked = g_settings.bS2RWin;
m_edS2RWin->Text = g_settings.nS2RWin;
//模拟输转实打
m_aRelatedCB[9] = m_cbS2RLos;
m_aRelatedCtrl[9].push_back(m_edS2RLos);
m_aRelatedCtrl[9].push_back(m_lbS2RLos);
m_cbS2RLos->Checked = g_settings.bS2RLos;
m_edS2RLos->Text = g_settings.nS2RLos;
//实打赢转模拟
m_aRelatedCB[10] = m_cbR2SWin;
m_aRelatedCtrl[10].push_back(m_edR2SWin);
m_aRelatedCtrl[10].push_back(m_lbR2SWin);
m_cbR2SWin->Checked = g_settings.bR2SWin;
m_edR2SWin->Text = g_settings.nR2SWin;
//实打输转模拟
m_aRelatedCB[11] = m_cbR2SLos;
m_aRelatedCtrl[11].push_back(m_edR2SLos);
m_aRelatedCtrl[11].push_back(m_lbR2SLos);
m_cbR2SLos->Checked = g_settings.bR2SLos;
m_edR2SLos->Text = g_settings.nR2SLos;
//游台
m_cbFloat->Hint = "勾选开启游台模式:每次只有一个台桌下注\n"
"开启游台时,至少勾选一种换台方式\n"
"只勾选一种换台方式,表示仅当该条件成立时才换台\n"
"若勾选了多种方式,则任意选中的条件成立时就换台";
m_aRelatedCB[12] = m_cbFloat;
m_aRelatedCtrl[12].push_back(m_cbFloatEach);
m_aRelatedCtrl[12].push_back(m_cbFloatShuffle);
m_aRelatedCtrl[12].push_back(m_cbFloatLos);
m_aRelatedCtrl[12].push_back(m_cbFloatWin);
m_aRelatedCtrl[12].push_back(m_cbFloatTie);
m_aFloatCB[0] = m_cbFloatEach;
m_aFloatCB[1] = m_cbFloatShuffle;
m_aFloatCB[2] = m_cbFloatLos;
m_aFloatCB[3] = m_cbFloatWin;
m_aFloatCB[4] = m_cbFloatTie;
if(g_settings.iFloatMode){
for(int i=0; i<5; i++){
m_aFloatCB[i]->Enabled = true;
m_aFloatCB[i]->OnClick = NULL;
m_aFloatCB[i]->Checked = g_settings.iFloatMode & (1<<i);
m_aFloatCB[i]->OnClick = OnFloatOpClick;
}
m_cbFloat->OnClick = NULL;
m_cbFloat->Checked = true;
m_cbFloat->OnClick = OnRelatedCBClick;
}
//牌局选项
m_aRelatedCB[13] = m_cbHoldBet;
m_aRelatedCtrl[13].push_back(m_edHoldBet);
m_aRelatedCtrl[13].push_back(m_lbHoldBet);
m_cbHoldBet->Checked = g_settings.bHoldBet;
m_edHoldBet->Text = g_settings.nHoldBet;
m_aRelatedCB[14] = m_cbHaltBet;
m_aRelatedCtrl[14].push_back(m_edHaltBet);
m_aRelatedCtrl[14].push_back(m_lbHaltBet);
m_cbHaltBet->Checked = g_settings.bHaltBet;
m_edHaltBet->Text = g_settings.nHaltBet;
m_cbBetsNoTie->Checked = g_settings.bBetsNoTie;
//页脚
m_cbStartShow->Checked = g_bShowSetting;
if(g_bGameOn){
m_btnOk->Enabled = false;
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::OkClick(TObject *Sender)
{
g_settings.bWaitNew = m_cbWaitNew->Checked;
g_settings.bInitClearTabLog = m_cbInitClearTabLog->Checked;
g_settings.bInitBetChipByStart = m_cbInitBetChipByStart->Checked;
g_settings.bInitTabProfitByStart = m_cbInitTabProfitByStart->Checked;
g_settings.bInitCurProfitByStart = m_cbInitCurProfitByStart->Checked;
g_settings.bInitBetByGame = m_cbInitBetByGame->Checked;
g_settings.bInitChipByGame = m_cbInitChipByGame->Checked;
g_settings.bInitProfitByGame = m_cbInitProfitByGame->Checked;
g_settings.bInitLogByGame = m_cbInitLogByGame->Checked;
double fSimAcc = m_edSimAcc->Text.ToDouble();
if(m_cbSimAcc->Checked!=g_settings.bSimAccOn || fSimAcc!=g_settings.fSimAcc){
if(m_cbSimAcc->Checked && fSimAcc!=g_settings.fSimAcc){
g_settings.fSimAcc = fSimAcc;
PostMessage(Application->MainFormHandle, UM_CHART_UPDATE, 1, 1); //初始化图表
}
g_settings.bSimAccOn = m_cbSimAcc->Checked;
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BALANCE, 1);
if(g_bTesting && m_cbSimAcc->Checked){
g_fBalance = fSimAcc;
PostMessage(Application->MainFormHandle, UM_CHART_UPDATE, 2, 1); //初始化图表
}
}
g_settings.bNoBetLow = m_cbNoBetLow->Checked;
g_settings.bStopLow = m_cbStopLow->Checked;
g_settings.bSyncReal = m_cbSyncReal->Checked;
g_settings.bTotalStopWin = m_cbTotalStopWin->Checked;
g_settings.bTotalStopLos = m_cbTotalStopLos->Checked;
g_settings.nTotalStopWin = m_edTotalStopWin->Text.ToInt();
g_settings.nTotalStopLos = m_edTotalStopLos->Text.ToInt();
g_settings.nTotalWinPause = m_edTotalWinPause->Text.ToInt();
g_settings.nTotalLosPause = m_edTotalLosPause->Text.ToInt();
for(int i=0; i<3; i++){
if(m_aTotalWinRB[i]->Checked){
g_settings.iTotalWinOp = i;
break;
}
}
for(int i=0; i<3; i++){
if(m_aTotalLosRB[i]->Checked){
g_settings.iTotalLosOp = i;
break;
}
}
g_settings.bTableStopWin = m_cbTableStopWin->Checked;
g_settings.bTableStopLos = m_cbTableStopLos->Checked;
g_settings.nTableStopWin = m_edTableStopWin->Text.ToInt();
g_settings.nTableStopLos = m_edTableStopLos->Text.ToInt();
g_settings.nTableWinPause = m_edTableWinPause->Text.ToInt();
g_settings.nTableLosPause = m_edTableLosPause->Text.ToInt();
for(int i=0; i<3; i++){
if(m_aTableWinRB[i]->Checked){
g_settings.iTableWinOp = i;
break;
}
}
for(int i=0; i<3; i++){
if(m_aTableLosRB[i]->Checked){
g_settings.iTableLosOp = i;
break;
}
}
g_settings.bU2DStop = m_cbU2DStop->Checked;
g_settings.bU2DPause = m_cbU2DPause->Checked;
g_settings.bU2DMinPeak = m_cbU2DMinPeak->Checked;
g_settings.nU2DStop = m_edU2DStop->Text.ToInt();
g_settings.nU2DPause = m_edU2DPause->Text.ToInt();
g_settings.nU2DMinPeak = m_edU2DMinPeak->Text.ToInt();
g_settings.bAccStopWin = m_cbAccStopWin->Checked;
g_settings.bAccStopLos = m_cbAccStopLos->Checked;
g_settings.nAccStopWin = m_edAccStopWin->Text.ToInt();
g_settings.nAccStopLos = m_edAccStopLos->Text.ToInt();
g_settings.bS2RWin = m_cbS2RWin->Checked;
g_settings.bS2RLos = m_cbS2RLos->Checked;
g_settings.bR2SWin = m_cbR2SWin->Checked;
g_settings.bR2SLos = m_cbR2SLos->Checked;
g_settings.nS2RWin = m_edS2RWin->Text.ToInt();
g_settings.nS2RLos = m_edS2RLos->Text.ToInt();
g_settings.nR2SWin = m_edR2SWin->Text.ToInt();
g_settings.nR2SLos = m_edR2SLos->Text.ToInt();
g_settings.bHoldBet = m_cbHoldBet->Checked;
g_settings.bHaltBet = m_cbHaltBet->Checked;
g_settings.nHoldBet = m_edHoldBet->Text.ToInt();
g_settings.nHaltBet = m_edHaltBet->Text.ToInt();
g_settings.iFloatMode = 0;
if(m_cbFloat->Checked){
for(int i=0; i<5; i++){
if(m_aFloatCB[i]->Checked)
g_settings.iFloatMode |= (1<<i);
}
}
g_settings.bBetsNoTie = m_cbBetsNoTie->Checked;
g_bShowSetting = m_cbStartShow->Checked;
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::TotalPauseExit(TObject *Sender)
{
TEdit* pE = (TEdit*)Sender;
int num = pE->Text.ToInt();
if(num<1 || num>30){
ShowMessage("请输入1-30的分钟数");
pE->SetFocus();
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::PauseKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if( Key==13 )
m_btnOk->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::TablePauseExit(TObject *Sender)
{
TEdit* pE = (TEdit*)Sender;
int num = pE->Text.ToInt();
if(num<0 || num>15){
ShowMessage("请输入0-15的分钟数");
pE->SetFocus();
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::SimAccKeyPress(TObject *Sender, System::WideChar &Key)
{
if( Key>'9' || Key<'0' && Key!=0x8 && ( Key!='.' || ((TEdit*)Sender)->Text.Pos(".")))
Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::SimAccExit(TObject *Sender)
{
double fSimAcc;
if(!TryStrToFloat(m_edSimAcc->Text, fSimAcc) || fSimAcc<20 || fSimAcc>1000000){
ShowMessage("请输入 20-1000000 的模拟本金");
m_edSimAcc->Text = "10000";
m_edSimAcc->SetFocus();
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::OnRelatedCBClick(TObject *Sender)
{
TCheckBox* pCB = (TCheckBox*)Sender;
int ind = pCB->Tag;
vector<TControl*>& vc = m_aRelatedCtrl[ind];
for(int i=0; i<vc.size(); i++)
vc[i]->Enabled = pCB->Checked;
if(pCB==m_cbFloat){ //单独处理游台
if(pCB->Checked){
m_aFloatCB[0]->OnClick = NULL;
m_aFloatCB[0]->Checked = true;
m_aFloatCB[0]->OnClick = OnFloatOpClick;
}
else{
for(int i=0; i<5; i++){
m_aFloatCB[i]->OnClick = NULL;
m_aFloatCB[i]->Checked = false;
m_aFloatCB[i]->OnClick = OnFloatOpClick;
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::OnFloatOpClick(TObject *Sender)
{
TCheckBox* pCB = (TCheckBox*)Sender;
if(!pCB->Checked){
bool bChk = false;
for(int i=0; i<5; i++){
if(m_aFloatCB[i]->Checked){
bChk = true;
break;
}
}
if(!bChk){
pCB->OnClick = NULL;
pCB->Checked = true;
pCB->OnClick = OnFloatOpClick;
ShowMessage("至少选择一种换台方式");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::U2DPauseClick(TObject *Sender)
{
TCheckBox* pCB = (TCheckBox*)Sender;
m_lbU2DStop->Visible = !pCB->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormShow(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
MouseCapture = false;
}
else{
m_bMouseOver = false;
MouseCapture = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if(Key==VK_ESCAPE)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(X < 0 || Y < 0 || X > Width || Y > Height)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
ResetIdle();
if(!m_bMouseOver && X>10 && X<Width-10 && Y>10 && Y<Height-10){
m_bMouseOver = true;
MouseCapture = false;
// DebugPrint("discaptured %d - %d", X, Y);
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormMouseEnter(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse enter %d - %d", cPos.X, cPos.Y);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
if(MouseCapture){
MouseCapture = false;
// DebugPrint("discaptured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::FormMouseLeave(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse leave %d - %d of %d - %d", cPos.X, cPos.Y);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
m_bMouseOver = false;
if(!MouseCapture){
MouseCapture = true;
// DebugPrint("captured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TSettingForm::WMKillFocus(TWMKillFocus &Message)
{
if(!m_bMouseOver)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
+1242
View File
File diff suppressed because it is too large Load Diff
+156
View File
@@ -0,0 +1,156 @@
//---------------------------------------------------------------------------
#ifndef SettingFormUnitH
#define SettingFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <vector>
using namespace std;
//---------------------------------------------------------------------------
class TSettingForm : public TForm
{
__published: // IDE-managed Components
TPanel *m_panBack;
TButton *m_btnOk;
TGroupBox *m_gbTable;
TCheckBox *m_cbInitBetByGame;
TCheckBox *m_cbInitChipByGame;
TGroupBox *m_gbMode;
TLabel *m_lbS2RWin;
TLabel *m_lbS2RLos;
TLabel *m_lbR2SLos;
TLabel *m_lbR2SWin;
TCheckBox *m_cbS2RWin;
TEdit *m_edS2RWin;
TCheckBox *m_cbS2RLos;
TEdit *m_edS2RLos;
TEdit *m_edR2SLos;
TCheckBox *m_cbR2SLos;
TCheckBox *m_cbR2SWin;
TEdit *m_edR2SWin;
TGroupBox *m_gbPause;
TBevel *Bevel1;
TCheckBox *m_cbTableStopWin;
TEdit *m_edTableStopWin;
TEdit *m_edTableStopLos;
TCheckBox *m_cbTableStopLos;
TCheckBox *m_cbTotalStopWin;
TEdit *m_edTotalStopWin;
TCheckBox *m_cbTotalStopLos;
TEdit *m_edTotalStopLos;
TGroupBox *m_gbStart;
TCheckBox *m_cbWaitNew;
TCheckBox *m_cbInitBetChipByStart;
TGroupBox *m_gbFloat;
TCheckBox *m_cbFloat;
TCheckBox *m_cbStartShow;
TGroupBox *m_gbTotalWin;
TRadioButton *m_rbTotalWin0;
TRadioButton *m_rbTotalWin1;
TRadioButton *m_rbTotalWin2;
TEdit *m_edTotalWinPause;
TLabel *m_lbTotalWin;
TGroupBox *m_gbTableWin;
TLabel *m_lbTableWin;
TRadioButton *m_rbTableWin0;
TRadioButton *m_rbTableWin1;
TRadioButton *m_rbTableWin2;
TEdit *m_edTableWinPause;
TCheckBox *m_cbInitTabProfitByStart;
TCheckBox *m_cbInitProfitByGame;
TCheckBox *m_cbInitCurProfitByStart;
TGroupBox *m_gbSimAcc;
TCheckBox *m_cbSyncReal;
TCheckBox *m_cbNoBetLow;
TCheckBox *m_cbStopLow;
TEdit *m_edSimAcc;
TCheckBox *m_cbSimAcc;
TCheckBox *m_cbInitLogByGame;
TCheckBox *m_cbU2DStop;
TEdit *m_edU2DStop;
TBevel *Bevel2;
TEdit *m_edU2DPause;
TLabel *m_lbU2DPause;
TGroupBox *m_gbU2D;
TLabel *Label7;
TLabel *Label9;
TGroupBox *m_gbTotalLos;
TLabel *m_lbTotalLos;
TRadioButton *m_rbTotalLos0;
TRadioButton *m_rbTotalLos1;
TRadioButton *m_rbTotalLos2;
TEdit *m_edTotalLosPause;
TGroupBox *m_gbTableLos;
TLabel *m_lbTableLos;
TRadioButton *m_rbTableLos0;
TRadioButton *m_rbTableLos1;
TRadioButton *m_rbTableLos2;
TEdit *m_edTableLosPause;
TCheckBox *m_cbAccStopWin;
TEdit *m_edAccStopWin;
TLabel *m_lbAccStopWin;
TCheckBox *m_cbAccStopLos;
TEdit *m_edAccStopLos;
TLabel *m_lbAccStopLos;
TBevel *Bevel3;
TGroupBox *m_gbFloatOp;
TCheckBox *m_cbU2DMinPeak;
TEdit *m_edU2DMinPeak;
TCheckBox *m_cbU2DPause;
TLabel *m_lbU2DStop;
TCheckBox *m_cbInitClearTabLog;
TCheckBox *m_cbHoldBet;
TEdit *m_edHoldBet;
TLabel *m_lbHoldBet;
TCheckBox *m_cbHaltBet;
TEdit *m_edHaltBet;
TLabel *m_lbHaltBet;
TCheckBox *m_cbFloatShuffle;
TCheckBox *m_cbFloatLos;
TCheckBox *m_cbFloatWin;
TCheckBox *m_cbFloatTie;
TCheckBox *m_cbBetsNoTie;
TCheckBox *m_cbFloatEach;
void __fastcall OkClick(TObject *Sender);
void __fastcall TotalPauseExit(TObject *Sender);
void __fastcall PauseKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall TablePauseExit(TObject *Sender);
void __fastcall SimAccKeyPress(TObject *Sender, System::WideChar &Key);
void __fastcall SimAccExit(TObject *Sender);
void __fastcall OnRelatedCBClick(TObject *Sender);
void __fastcall OnFloatOpClick(TObject *Sender);
void __fastcall U2DPauseClick(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall FormMouseEnter(TObject *Sender);
void __fastcall FormMouseLeave(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
TRadioButton *m_aU2DStopRB[2],
*m_aTotalWinRB[3],
*m_aTotalLosRB[3],
*m_aTableWinRB[3],
*m_aTableLosRB[3];
TCheckBox* m_aRelatedCB[15],
*m_aFloatCB[5];
vector<TControl*> m_aRelatedCtrl[15];
bool m_bMouseOver;
MESSAGE void __fastcall WMKillFocus(TWMKillFocus &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_KILLFOCUS, TWMKillFocus, WMKillFocus)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TSettingForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TSettingForm *SettingForm;
//---------------------------------------------------------------------------
#endif
+249
View File
@@ -0,0 +1,249 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GlobalUnit.h"
#include "GameUnit.h"
#include "TableIPFormUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TTableIPForm::TTableIPForm(TComponent* Owner, TGame* pG)
: TForm(Owner)
{
m_pGame = pG;
m_cbIndPolicy->Hint = "启用独立策略后,台桌将按自己的打法和注码进行投注\n"
"同时,将不参与注码的总体计算,也不参与游台下注";
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormCreate(TObject *Sender)
{
for(int i=0; i<g_aBetPolicies.size(); i++){
TBasePolicy* pPolicy = g_aBetPolicies[i];
m_cbBets->AddItem(pPolicy->name,NULL);
}
m_cbBets->ItemIndex = m_iBet = m_pGame->bIndPolicy ? m_pGame->iBetPolicy : g_iBetPolicy;
m_cbRoad->ItemIndex = m_pGame->iRoad<0 ? g_iRoad : m_pGame->iRoad;
for(int i=0; i<g_aChipPolicies.size(); i++){
TBasePolicy* pPolicy = g_aChipPolicies[i];
m_cbChips->AddItem(pPolicy->name,NULL);
}
m_cbChips->ItemIndex = m_iChip = m_pGame->bIndPolicy ? m_pGame->iChipPolicy : g_iChipPolicy;
m_nMul = m_pGame->bIndPolicy ? m_pGame->nChipMul : g_nChipMul;
if(m_nMul>0){
m_leChipMul->Text = m_nMul;
m_leChipMul->Enabled = true;
}
m_cbIndPolicy->Checked = m_pGame->bIndPolicy;
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::OkClick(TObject *Sender)
{
if(m_cbIndPolicy->Checked){
if(m_iBet<0){
ShowMessage("请选择打法策略");
m_cbBets->SetFocus();
return;
}
if(m_iChip<0){
ShowMessage("请选择注码策略");
m_cbChips->SetFocus();
return;
}
m_pGame->bIndPolicy = true;
m_pGame->iBetPolicy = m_iBet;
m_pGame->iChipPolicy = m_iChip;
m_pGame->nChipMul = m_nMul;
}
else{
m_pGame->bIndPolicy = false;
m_pGame->iBetPolicy = m_pGame->iChipPolicy = m_pGame->nChipMul = -1;
}
m_pGame->iRoad = m_cbRoad->ItemIndex==g_iRoad ? -1 : m_cbRoad->ItemIndex;
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::PolicyChange(TObject *Sender)
{
TComboBox* pCB = (TComboBox*)Sender;
int ind = pCB->ItemIndex;
int& iPolicy = Sender==m_cbBets ? m_iBet : m_iChip;
if( ind != iPolicy ){
iPolicy = ind;
if(ind<0){
pCB->Text = pCB->Hint;
if(pCB==m_cbChips){
m_nMul = 0;
m_leChipMul->Text = "";
m_leChipMul->Enabled = false;
}
else{
m_cbRoad->ItemIndex = g_iRoad;
}
return;
}
if(pCB==m_cbChips){
if(g_aChipPolicies[ind]->kind==KIND_CHIP_COM){
m_leChipMul->Text = "";
m_leChipMul->Enabled = false;
m_nMul = -1;
}
else{
int minChip = MinChipOfPolicy(ind);
if(minChip>0){
int mul = g_MinOnBet / minChip;
if(g_MinOnBet % minChip) mul++;
if(m_nMul<mul){
m_nMul = mul;
m_leChipMul->Text = IntToStr(mul);
m_leChipMul->Enabled = true;
}
}
}
}
else{
m_cbRoad->ItemIndex = ((TBetPolicy*)g_aBetPolicies[ind])->road;
}
}
SetChanged();
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::ChipMulExit(TObject *Sender)
{
int mul = m_leChipMul->Text.ToInt();
if(mul<=0){
ShowMessage("请输入投注倍数");
m_leChipMul->SetFocus();
return;
}
else{
int minChip = MinChipOfPolicy(m_iChip);
if(minChip * mul < g_MinOnBet){
int multi = g_MinOnBet / minChip;
if(g_MinOnBet % minChip) multi++;
m_nMul = multi;
m_leChipMul->Text = IntToStr(multi);
}
else
m_nMul = mul;
}
SetChanged();
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::ChipMulKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if( Key==13 )
m_btnOk->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::SetChanged()
{
if(m_iBet>=0 && m_iChip>=0 && (m_iBet!=g_iBetPolicy || m_iChip!=g_iChipPolicy
|| m_nMul!=g_nChipMul)){
m_cbIndPolicy->Checked = true;
m_btnOk->SetFocus();
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(X < 0 || Y < 0 || X > Width || Y > Height)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
// DebugPrint("mouse move");
if(!m_bMouseOver && X>10 && X<Width-10 && Y>10 && Y<Height-10){
m_bMouseOver = true;
if(MouseCapture){
MouseCapture = false;
// DebugPrint("discaptured %d - %d", X, Y);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormShow(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
MouseCapture = false;
}
else{
m_bMouseOver = false;
MouseCapture = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormMouseEnter(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse enter %d - %d", cPos.X, cPos.Y);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
if(MouseCapture){
MouseCapture = false;
// DebugPrint("discaptured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormMouseLeave(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse leave %d - %d of %d - %d", cPos.X, cPos.Y);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
m_bMouseOver = false;
if(!MouseCapture){
MouseCapture = true;
// DebugPrint("captured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::WMKillFocus(TWMKillFocus &Message)
{
if(!m_bMouseOver)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::ComboCloseUp(TObject *Sender)
{
TComboBox* pCB = (TComboBox*)Sender;
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
cPos = pCB->ClientToScreen(TPoint(pCB->Width-10, pCB->Height/2));
SetCursorPos(cPos.X, cPos.Y);
m_bMouseOver = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TTableIPForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if(Key==VK_ESCAPE)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
+153
View File
@@ -0,0 +1,153 @@
object TableIPForm: TTableIPForm
Left = 0
Top = 0
BorderIcons = []
BorderStyle = bsNone
ClientHeight = 86
ClientWidth = 399
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
KeyPreview = True
OnCreate = FormCreate
OnKeyDown = FormKeyDown
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnShow = FormShow
TextHeight = 15
object m_panBack: TPanel
Left = 0
Top = 0
Width = 399
Height = 86
Align = alClient
BevelKind = bkFlat
BevelOuter = bvNone
Ctl3D = True
FullRepaint = False
ParentCtl3D = False
ShowCaption = False
TabOrder = 0
OnMouseEnter = FormMouseEnter
OnMouseLeave = FormMouseLeave
object m_btnOk: TButton
Left = 316
Top = 46
Width = 65
Height = 25
Caption = #30830#23450
TabOrder = 0
OnClick = OkClick
end
object m_cbChips: TComboBox
Left = 166
Top = 14
Width = 135
Height = 22
Hint = #35831#36873#25321#27880#30721
ParentCustomHint = False
AutoDropDown = True
AutoCloseUp = True
Color = clWhite
DoubleBuffered = False
DropDownCount = 20
DropDownWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
ParentDoubleBuffered = False
ParentFont = False
ParentShowHint = False
ShowHint = False
TabOrder = 1
Text = #35831#36873#25321#27880#30721
OnChange = PolicyChange
OnCloseUp = ComboCloseUp
end
object m_cbBets: TComboBox
Left = 14
Top = 14
Width = 135
Height = 22
Hint = #35831#36873#25321#25171#27861
ParentCustomHint = False
AutoDropDown = True
AutoCloseUp = True
Color = clWhite
DoubleBuffered = False
DropDownCount = 20
DropDownWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
ParentDoubleBuffered = False
ParentFont = False
ParentShowHint = False
ShowHint = False
TabOrder = 2
Text = #35831#36873#25321#25171#27861
OnChange = PolicyChange
OnCloseUp = ComboCloseUp
end
object m_cbIndPolicy: TCheckBox
Left = 166
Top = 50
Width = 97
Height = 17
Caption = #21551#29992#29420#31435#31574#30053
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object m_leChipMul: TLabeledEdit
Left = 342
Top = 14
Width = 39
Height = 21
Alignment = taCenter
AutoSize = False
EditLabel.Width = 26
EditLabel.Height = 21
EditLabel.Caption = #20493#25968
Enabled = False
LabelPosition = lpLeft
NumbersOnly = True
TabOrder = 4
Text = ''
OnExit = ChipMulExit
OnKeyDown = ChipMulKeyDown
end
object m_cbRoad: TComboBox
Left = 14
Top = 47
Width = 66
Height = 22
AutoComplete = False
Style = csDropDownList
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
ItemIndex = 0
ParentFont = False
TabOrder = 5
Text = #20845#29664#36335
OnCloseUp = ComboCloseUp
Items.Strings = (
#20845#29664#36335
#22823#36335
#22823#30524#36335
#23567#36335
#23567#24378#36335)
end
end
end
+52
View File
@@ -0,0 +1,52 @@
//---------------------------------------------------------------------------
#ifndef TableIPFormUnitH
#define TableIPFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Mask.hpp>
//---------------------------------------------------------------------------
class TTableIPForm : public TForm
{
__published: // IDE-managed Components
TComboBox *m_cbBets;
TComboBox *m_cbChips;
TLabeledEdit *m_leChipMul;
TCheckBox *m_cbIndPolicy;
TButton *m_btnOk;
TPanel *m_panBack;
TComboBox *m_cbRoad;
void __fastcall FormCreate(TObject *Sender);
void __fastcall OkClick(TObject *Sender);
void __fastcall PolicyChange(TObject *Sender);
void __fastcall ChipMulExit(TObject *Sender);
void __fastcall ChipMulKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormMouseEnter(TObject *Sender);
void __fastcall FormMouseLeave(TObject *Sender);
void __fastcall ComboCloseUp(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
TGame* m_pGame;
int m_iBet, m_iChip, m_nMul;
bool m_bMouseOver;
void __fastcall SetChanged();
MESSAGE void __fastcall WMKillFocus(TWMKillFocus &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_KILLFOCUS, TWMKillFocus, WMKillFocus)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TTableIPForm(TComponent* Owner, TGame* pG);
};
//---------------------------------------------------------------------------
#endif
+190
View File
@@ -0,0 +1,190 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GlobalUnit.h"
#include "TableSet.h"
#include "GameUnit.h"
#include "UtilityUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TTabSetForm::TTabSetForm(TComponent* Owner, int nGame, int nShow, int nRun)
: TForm(Owner)
{
m_nGame = nGame;
m_nShow = nShow < 0 || nShow>nGame ? nGame : nShow;
m_nRun = nRun < 0 || nRun>m_nShow ? m_nShow : nRun;
m_iRun = 0;
m_bMouseOver = false;
//根据game数量添加台桌显示选项
int n = (nGame - 30) / 15;
if(0 == (nGame % 15)) n--;
for(int i=0; i<n; i++){
String str = IntToStr(45 + i*15) + "";
m_cbShow->AddItem(str, NULL);
}
m_cbShow->AddItem("全选", NULL);
if(nShow<0 || nShow>=nGame)
m_iShow = m_cbShow->Items->Count - 1;
else
m_iShow = (m_nShow / 15) - 1;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormCreate(TObject *Sender)
{
m_cbShow->ItemIndex = m_iShow;
OnShowChange(NULL);
m_cbShow->Enabled = !g_bGameOn;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::OnShowChange(TObject *Sender)
{
TComboBox* pShow = (TComboBox*)Sender;
if(pShow){
m_iShow = pShow->ItemIndex;
if(m_iShow == m_cbShow->Items->Count-1)
m_nShow = m_nGame;
else
m_nShow = (m_iShow+1) * 15;
}
for(int i=m_cbRun->Items->Count-1; i>2; i--)
m_cbRun->Items->Delete(i);
//根据显示数量添加台桌运行选项
int n = m_nShow / 15;
if(0 == (m_nShow % 15)) n--;
for(int i=0; i<n; i++){
String str = IntToStr(15 + i*15) + "";
m_cbRun->AddItem(str, NULL);
}
m_cbRun->AddItem("全选", NULL);
if(m_nRun >= m_nShow){
m_nRun = m_nShow;
m_cbRun->ItemIndex = m_iRun = m_cbRun->Items->Count - 1;
}
else if(m_nRun>=15){
m_cbRun->ItemIndex = m_iRun = m_nRun / 15 + 2;
}
else
m_cbRun->ItemIndex = m_iRun = m_nRun / 5;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::OnRunChange(TObject *Sender)
{
m_iRun = m_cbRun->ItemIndex;
if(m_iRun==m_cbRun->Items->Count - 1)
m_nRun = m_nShow;
else if(m_iRun>=3)
m_nRun = (m_iRun-2) * 15;
else
m_nRun = m_iRun * 5;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::OnOkClick(TObject *Sender)
{
if(m_iShow==m_cbShow->Items->Count-1)
m_nShow = -1;
if(m_iRun==m_cbRun->Items->Count-1)
m_nRun = -1;
if(m_cbResetIPs->Checked){
for(int i=0; i<g_aGames.size(); i++)
g_aGames[i]->ResetIP();
g_aIPGames.ClearAll();
}
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormShow(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
MouseCapture = false;
// DebugPrint("discaptured");
}
else{
m_bMouseOver = false;
MouseCapture = true;
// DebugPrint("captured");
}
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(X < 0 || Y < 0 || X > Width || Y > Height)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
ResetIdle();
if(!m_bMouseOver && X>10 && X<Width-10 && Y>10 && Y<Height-10){
m_bMouseOver = true;
MouseCapture = false;
// DebugPrint("discaptured %d - %d", X, Y);
}
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::WMKillFocus(TWMKillFocus &Message)
{
if(!m_bMouseOver)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::ComboCloseUp(TObject *Sender)
{
TComboBox* pCB = (TComboBox*)Sender;
TPoint cPos = ScreenToClient(Mouse->CursorPos);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
cPos = pCB->ClientToScreen(TPoint(pCB->Width-10, pCB->Height/2));
SetCursorPos(cPos.X, cPos.Y);
m_bMouseOver = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormMouseEnter(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse enter %d - %d", cPos.X, cPos.Y);
if(cPos.X>=0 && cPos.Y>=0 && cPos.X<=Width && cPos.Y<=Height){
m_bMouseOver = true;
if(MouseCapture){
MouseCapture = false;
// DebugPrint("discaptured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormMouseLeave(TObject *Sender)
{
TPoint cPos = ScreenToClient(Mouse->CursorPos);
// DebugPrint("mouse leave %d - %d of %d - %d", cPos.X, cPos.Y);
if((cPos.X<=10 || cPos.Y<=10 || cPos.X>=Width-10 || cPos.Y>=Height-10)){
m_bMouseOver = false;
if(!MouseCapture){
MouseCapture = true;
// DebugPrint("captured");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TTabSetForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if(Key==VK_ESCAPE)
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
+97
View File
@@ -0,0 +1,97 @@
object TabSetForm: TTabSetForm
Left = 0
Top = 0
BorderIcons = []
BorderStyle = bsNone
ClientHeight = 93
ClientWidth = 273
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
KeyPreview = True
OnCreate = FormCreate
OnKeyDown = FormKeyDown
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnShow = FormShow
TextHeight = 15
object m_panBack: TPanel
Left = 0
Top = 0
Width = 273
Height = 93
Align = alClient
Ctl3D = True
FullRepaint = False
ParentCtl3D = False
ShowCaption = False
TabOrder = 0
OnMouseEnter = FormMouseEnter
OnMouseLeave = FormMouseLeave
object m_lblShow: TLabel
Left = 23
Top = 17
Width = 26
Height = 15
Caption = #26174#31034
end
object m_lblTabRun: TLabel
Left = 145
Top = 17
Width = 26
Height = 15
Caption = #36816#34892
end
object m_btnOk: TButton
Left = 186
Top = 52
Width = 60
Height = 25
Caption = #30830#23450
TabOrder = 0
OnClick = OnOkClick
end
object m_cbResetIPs: TCheckBox
Left = 23
Top = 56
Width = 106
Height = 17
Hint = #28165#38500#20840#37096#21488#26700#30340#29420#31435#31574#30053
Caption = #37325#32622#21488#26700#31574#30053
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object m_cbRun: TComboBox
Left = 179
Top = 14
Width = 67
Height = 23
Style = csDropDownList
TabOrder = 2
OnChange = OnRunChange
OnCloseUp = ComboCloseUp
Items.Strings = (
#20840#19981#36873
'5'#21488
'10'#21488
#20840#36873)
end
object m_cbShow: TComboBox
Left = 58
Top = 14
Width = 57
Height = 23
Style = csDropDownList
TabOrder = 3
OnChange = OnShowChange
OnCloseUp = ComboCloseUp
Items.Strings = (
'15'#21488
'30'#21488)
end
end
end
+50
View File
@@ -0,0 +1,50 @@
//---------------------------------------------------------------------------
#ifndef TableSetH
#define TableSetH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TTabSetForm : public TForm
{
__published: // IDE-managed Components
TLabel *m_lblShow;
TLabel *m_lblTabRun;
TComboBox *m_cbShow;
TComboBox *m_cbRun;
TButton *m_btnOk;
TCheckBox *m_cbResetIPs;
TPanel *m_panBack;
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall OnShowChange(TObject *Sender);
void __fastcall OnRunChange(TObject *Sender);
void __fastcall OnOkClick(TObject *Sender);
void __fastcall ComboCloseUp(TObject *Sender);
void __fastcall FormMouseEnter(TObject *Sender);
void __fastcall FormMouseLeave(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
int m_iShow, m_iRun, m_nGame;
bool m_bMouseOver;
MESSAGE void __fastcall WMKillFocus(TWMKillFocus &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_KILLFOCUS, TWMKillFocus, WMKillFocus)
END_MESSAGE_MAP(TForm)
public: // User declarations
int m_nShow, m_nRun;
__fastcall TTabSetForm(TComponent* Owner, int nGame, int nShow, int nRun);
};
//---------------------------------------------------------------------------
#endif
+1019
View File
File diff suppressed because it is too large Load Diff
+1280
View File
File diff suppressed because it is too large Load Diff
+136
View File
@@ -0,0 +1,136 @@
//---------------------------------------------------------------------------
#ifndef TableUnitH
#define TableUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Grids.hpp>
#include "GameUnit.h"
#include <Vcl.Imaging.jpeg.hpp>
#include <Vcl.Menus.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.Imaging.pngimage.hpp>
//using namespace TransparentPanelUnit;
//---------------------------------------------------------------------------
#define TFWIDTH DPIX(403)
#define TFHEIGHT DPIY(135)
class TTableFrame : public TFrame
{
__published: // IDE-managed Components
TDrawGrid *m_dgRoad;
TStringGrid *m_sgBets;
TShape *m_shpR;
TShape *m_shpB;
TShape *m_shpG;
TLabel *m_lbProfit;
TLabel *m_lbSeq;
TCheckBox *m_cbRun;
TStaticText *m_stVid;
TLabel *m_lbTimeout;
TShape *m_shpS;
TLabel *m_lbRCount;
TLabel *m_lbBCount;
TLabel *m_lbGCount;
TLabel *m_lbCards;
TPanel *m_panTable;
TPanel *m_panBet;
TButton *m_btnBetOk;
TButton *m_btnBetCancel;
TImage *m_imgBack;
TLabel *m_lblManChip1;
TLabel *m_lblManChip2;
TLabel *m_lblManChip0;
TLabel *m_lblBetTip;
TLabel *m_lblBetChip0;
TLabel *m_lblBetChip1;
TLabel *m_lblBetChip2;
TPopupMenu *m_pmBets;
TMenuItem *clear;
TImage *m_imgIP;
void __fastcall RoadDrawCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, TRect &Rect, TGridDrawState State);
void __fastcall BetsMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall BetsMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall RoadMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall RoadMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos, bool &Handled);
void __fastcall RoadSelectCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, bool &CanSelect);
void __fastcall BetsSelectCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, bool &CanSelect);
void __fastcall BetsDrawCell(TObject *Sender, System::LongInt ACol, System::LongInt ARow, TRect &Rect, TGridDrawState State);
void __fastcall RoadMouseEnter(TObject *Sender);
void __fastcall RoadMouseLeave(TObject *Sender);
void __fastcall RunClick(TObject *Sender);
void __fastcall RevClick(TObject *Sender);
void __fastcall BetsMouseEnter(TObject *Sender);
void __fastcall BetsMouseLeave(TObject *Sender);
void __fastcall BetMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall ManChipClick(TObject *Sender);
void __fastcall BetCancelClick(TObject *Sender);
void __fastcall BetOkClick(TObject *Sender);
void __fastcall ClearLogsClick(TObject *Sender);
void __fastcall IPMouseEnter(TObject *Sender);
void __fastcall IPMouseLeave(TObject *Sender);
void __fastcall IPClick(TObject *Sender);
void __fastcall TableMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall TableMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
private: // User declarations
int m_logRows;
bool m_bCursorOnRoad,
m_bCursorOnLog;
TTimer *m_pTipTimer, //显示提示定时器
*m_pPauseTimer; //止赢暂停定时器
int m_aManChips[3], //待下注
m_aBetChips[3]; //已下注
TLabel *m_pManChipLabels[3], //待下注
*m_pBetChipLabels[3]; //已下注
TPngImage * m_imgOps[3];
//选中相关
bool m_bSel;
TForm *m_fmMask;
void __fastcall ShowTip(String tip, int type);
void __fastcall TipTimerProc(TObject* Sender);
void __fastcall PauseTimerProc(TObject* Sender);
void __fastcall ClearTipTimer();
void __fastcall ClearPauseTimer();
void __fastcall AddChip(int ind);
void __fastcall UpdateStatus();
void __fastcall UpdateRoad();
void __fastcall UpdateLogs();
void __fastcall UpdateIP();
//消息处理
MESSAGE void __fastcall UMUpdate(TMessage &msg);
MESSAGE void __fastcall UMChangeRoad(TMessage &msg);
MESSAGE void __fastcall UMSetManual(TMessage &msg);
MESSAGE void __fastcall UMLogUpdate(TMessage &msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(UM_TAB_UPDATE, TMessage, UMUpdate)
MESSAGE_HANDLER(UM_CHANGE_ROAD, TMessage, UMChangeRoad)
MESSAGE_HANDLER(UM_MANUAL_SET, TMessage, UMSetManual)
MESSAGE_HANDLER(UM_LOG_UPDATE, TMessage, UMLogUpdate)
END_MESSAGE_MAP(TFrame)
public: // User declarations
TGame* m_pGame;
__fastcall TTableFrame(TComponent* Owner);
__fastcall ~TTableFrame();
void __fastcall SetGame(TGame* pGame);
void __fastcall SetRun(bool bRun);
void __fastcall SetSel(bool bSel);
};
//---------------------------------------------------------------------------
#endif
+89
View File
@@ -0,0 +1,89 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UtilityUnit.h"
#include "GlobalUnit.h"
#include "RBmasterMain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
int g_iPlatform = 0; //游戏平台
unsigned g_tmCurrent = 0,
g_tmIdle = 0; //软件无操作时间
bool g_bBacData = false;
void __fastcall ResetIdle()
{
if(g_tmIdle==600)
MainForm->GetCefFrame( MAIN_FRAME )->ExecuteJavaScript("tmRetry=90;console.log('tmRetry:',tmRetry);", "", 0);
g_tmIdle = 0;
}
//---------------------------------------------------------------------------
_di_ICefFrame __fastcall GetCefFrame( int type )
{
return MainForm->GetCefFrame( type );
}
//---------------------------------------------------------------------------
TStringList* __fastcall GetJQValue( String& str, _di_ICefFrame frame )
{
return MainForm->GetJQValue( str, frame );
}
//---------------------------------------------------------------------------
void __fastcall SetStatus( int iStatus, String str )
{
MainForm->m_strStatus = str;
MainForm->Perform(UM_STATUS, iStatus, (NativeInt)0 );
}
//---------------------------------------------------------------------------
void __fastcall UpdateStatistics()
{
MainForm->Perform(UM_STATISTICS, 0, (NativeInt)0 );
}
//---------------------------------------------------------------------------
void __fastcall AutoBetEnd(int code)
{
PostMessage( MainForm->Handle, UM_AUTOBETEND, code, 0 );
}
//---------------------------------------------------------------------------
//bool __fastcall IsGameOn()
//{
// return MainForm->IsGameOn();
//}
////---------------------------------------------------------------------------
int __fastcall IsPolicyInUse(int type, int iPolicy)
{
return MainForm->IsPolicyInUse(type, iPolicy);
}
//---------------------------------------------------------------------------
char sufCard[3][8] = {"_,_,_", ",_,_", ",_"};
String __fastcall UnifyCard(String card)
{
String uc;
int len = card.Length();
if(len==0)
uc = sufCard[0];
else if(len==1)
uc = card + sufCard[1];
else if(len==3)
uc = card + sufCard[2];
else if(len==5)
uc = card;
else
DebugPrint("!!!====abnormal card : %s", ((AnsiString)uc).c_str());
return uc;
}
//---------------------------------------------------------------------------
+27
View File
@@ -0,0 +1,27 @@
//---------------------------------------------------------------------------
#ifndef UtilityUnitH
#define UtilityUnitH
//---------------------------------------------------------------------------
#include "CEF4DelphiVCLRTL.hpp"
#define MAIN_FRAME 0
#define PF_PA 1
#define PF_AB 2
#define PF_DB 3
void __fastcall ResetIdle();
_di_ICefFrame __fastcall GetCefFrame( int type );
TStringList* __fastcall GetJQValue( String& str, _di_ICefFrame frame );
void __fastcall SetStatus( int iStatus, String str );
void __fastcall UpdateStatistics();
void __fastcall AutoBetEnd(int code);
String __fastcall UnifyCard(String card);
//bool __fastcall IsGameOn();
int __fastcall IsPolicyInUse(int type, int iPolicy);
extern int g_iPlatform; //ÓÎϷƽ̨
extern unsigned g_tmCurrent, g_tmIdle;
extern bool g_bBacData;
#endif
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 788 KiB