📄 gmain.~pas
字号:
procedure ServerSocketClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
procedure ServerSocketClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure TimerTimer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure EditNoticeUrlChange(Sender: TObject);
procedure EditClientFormChange(Sender: TObject);
procedure MemoGameListChange(Sender: TObject);
procedure ButtonRunGateDefaultClick(Sender: TObject);
procedure ButtonGeneralDefalultClick(Sender: TObject);
procedure ButtonLoginGateDefaultClick(Sender: TObject);
procedure ButtonSelGateDefaultClick(Sender: TObject);
procedure ButtonLoginSrvDefaultClick(Sender: TObject);
procedure ButtonDBServerDefaultClick(Sender: TObject);
procedure ButtonLogServerDefaultClick(Sender: TObject);
procedure ButtonM2ServerDefaultClick(Sender: TObject);
procedure ButtonSearchLoginAccountClick(Sender: TObject);
procedure CkFullEditModeClick(Sender: TObject);
procedure ButtonLoginAccountOKClick(Sender: TObject);
procedure EditLoginAccountChange(Sender: TObject);
procedure CheckBoxboLoginGate_GetStartClick(Sender: TObject);
procedure CheckBoxboSelGate_GetStartClick(Sender: TObject);
procedure TimerCheckDebugTimer(Sender: TObject);
procedure ButtonM2SuspendClick(Sender: TObject);
procedure EditM2Server_TestLevelChange(Sender: TObject);
procedure EditM2Server_TestGoldChange(Sender: TObject);
procedure CheckBoxboLoginServer_GetStartClick(Sender: TObject);
procedure CheckBoxDBServerGetStartClick(Sender: TObject);
procedure CheckBoxLogServerGetStartClick(Sender: TObject);
procedure CheckBoxM2ServerGetStartClick(Sender: TObject);
private
m_boOpen: Boolean;
m_nStartStatus: Integer;
m_dwShowTick: LongWord;
procedure RefGameConsole();
procedure GenGameConfig();
procedure GenDBServerConfig();
procedure GenLoginServerConfig();
procedure GenLogServerConfig();
procedure GenM2ServerConfig();
procedure GenLoginGateConfig();
procedure GenSelGateConfig();
procedure GenRunGateConfig;
procedure StartGame();
procedure StopGame();
procedure MainOutMessage(sMsg: string);
procedure ProcessDBServerMsg(wIdent: Word; sData: String);
procedure ProcessLoginSrvMsg(wIdent: Word; sData: String);
procedure ProcessLoginSrvGetUserAccount(sData: String);
procedure ProcessLoginSrvChangeUserAccountStatus(sData: String);
procedure UserAccountEditMode(boChecked: Boolean);
procedure ProcessLogServerMsg(wIdent: Word; sData: String);
procedure ProcessLoginGateMsg(wIdent: Word; sData: String);
procedure ProcessLoginGate1Msg(wIdent: Word; sData: String);
procedure ProcessSelGateMsg(wIdent: Word; sData: String);
procedure ProcessSelGate1Msg(wIdent: Word; sData: String);
procedure ProcessRunGateMsg(wIdent: Word; sData: String);
procedure ProcessRunGate1Msg(wIdent: Word; sData: String);
procedure ProcessRunGate2Msg(wIdent: Word; sData: String);
procedure ProcessRunGate3Msg(wIdent: Word; sData: String);
procedure ProcessRunGate4Msg(wIdent: Word; sData: String);
procedure ProcessRunGate5Msg(wIdent: Word; sData: String);
procedure ProcessRunGate6Msg(wIdent: Word; sData: String);
procedure ProcessRunGate7Msg(wIdent: Word; sData: String);
procedure ProcessM2ServerMsg(wIdent: Word; sData: String);
procedure GetMutRunGateConfing(nIndex: Integer);
procedure ProcessClientPacket();
procedure SendGameList(Socket: TCustomWinSocket);
procedure SendSocket(Socket: TCustomWinSocket; SendMsg: String);
function StartService(): Boolean;
procedure StopService();
procedure RefGameDebug();
procedure GenMutSelGateConfig(nIndex: Integer);
{ Private declarations }
public
procedure ProcessMessage(var Msg: TMsg; var Handled: Boolean);
procedure MyMessage(var MsgData: TWmCopyData); message WM_COPYDATA;
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
uses GShare, HUtil32, Grobal2, GLoginServer, EDcode;
{$R *.dfm}
procedure TfrmMain.MainOutMessage(sMsg: string);
begin
sMsg := '[' + DateTimeToStr(Now) + '] ' + sMsg;
MemoLog.Lines.Add(sMsg);
end;
procedure TfrmMain.ButtonNext1Click(Sender: TObject);
var
sGameDirectory: String;
sHeroDBName: String;
sGameName: String;
sExtIPAddr: String;
begin
sGameDirectory := Trim(EditGameDir.Text);
sHeroDBName := Trim(EditHeroDB.Text);
sGameName := Trim(EditGameName.Text);
sExtIPAddr := Trim(EditGameExtIPaddr.Text);
if sGameName = '' then begin
Application.MessageBox('游戏服务器名称输入不正确!!!', '提示信息', MB_OK + MB_ICONEXCLAMATION);
EditGameName.SetFocus;
exit;
end;
if (sExtIPAddr = '') or not IsIPaddr(sExtIPAddr) then begin
Application.MessageBox('游戏服务器外部IP地址输入不正确!!!', '提示信息', MB_OK + MB_ICONEXCLAMATION);
EditGameExtIPaddr.SetFocus;
exit;
end;
if (sGameDirectory = '') or not DirectoryExists(sGameDirectory) then begin
Application.MessageBox('游戏目录输入不正确!!!', '提示信息', MB_OK + MB_ICONEXCLAMATION);
EditGameDir.SetFocus;
exit;
end;
if not (sGameDirectory[length(sGameDirectory)] = '\') then begin
Application.MessageBox('游戏目录名称最后一个字符必须为"\"!!!', '提示信息', MB_OK + MB_ICONEXCLAMATION);
EditGameDir.SetFocus;
exit;
end;
if sHeroDBName = '' then begin
Application.MessageBox('游戏数据库名称输入不正确!!!', '提示信息', MB_OK + MB_ICONEXCLAMATION);
EditHeroDB.SetFocus;
exit;
end;
g_sGameDirectory := sGameDirectory;
g_sHeroDBName := sHeroDBName;
g_sGameName := sGameName;
g_sExtIPaddr := sExtIPAddr;
g_boDynamicIPMode := CheckBoxDynamicIPMode.Checked;
PageControl3.ActivePageIndex := 1;
end;
procedure TfrmMain.ButtonPrv2Click(Sender: TObject);
begin
PageControl3.ActivePageIndex := 0;
end;
procedure TfrmMain.ButtonNext2Click(Sender: TObject);
var
nPort: Integer;
begin
nPort := Str_ToInt(Trim(EditLoginGate_GatePort.Text), -1);
if (nPort < 0) or (nPort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditLoginGate_GatePort.SetFocus;
exit;
end;
g_nLoginGate_GatePort := nPort;
PageControl3.ActivePageIndex := 2;
end;
procedure TfrmMain.ButtonPrv3Click(Sender: TObject);
begin
PageControl3.ActivePageIndex := 1;
end;
procedure TfrmMain.ButtonNext3Click(Sender: TObject);
var
nPort: Integer;
begin
nPort := Str_ToInt(Trim(EditSelGate_GatePort.Text), -1);
if (nPort < 0) or (nPort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditSelGate_GatePort.SetFocus;
exit;
end;
g_nSeLGate_GatePort := nPort;
nPort := Str_ToInt(Trim(EditSelGate_GatePort1.Text), -1);
if (nPort < 0) or (nPort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditSelGate_GatePort1.SetFocus;
exit;
end;
g_nSeLGate_GatePort1 := nPort;
PageControl3.ActivePageIndex := 3;
end;
procedure TfrmMain.ButtonNext4Click(Sender: TObject);
var
nPort1, nPort2, nPort3, nPort4, nPort5, nPort6, nPort7, nPort8: Integer;
begin
nPort1 := Str_ToInt(Trim(EditRunGate_GatePort1.Text), -1);
nPort2 := Str_ToInt(Trim(EditRunGate_GatePort2.Text), -1);
nPort3 := Str_ToInt(Trim(EditRunGate_GatePort3.Text), -1);
nPort4 := Str_ToInt(Trim(EditRunGate_GatePort4.Text), -1);
nPort5 := Str_ToInt(Trim(EditRunGate_GatePort5.Text), -1);
nPort6 := Str_ToInt(Trim(EditRunGate_GatePort6.Text), -1);
nPort7 := Str_ToInt(Trim(EditRunGate_GatePort7.Text), -1);
nPort8 := Str_ToInt(Trim(EditRunGate_GatePort8.Text), -1);
if (nPort1 < 0) or (nPort1 > 65535) then begin
Application.MessageBox('网关一端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort1.SetFocus;
exit;
end;
if (nPort2 < 0) or (nPort2 > 65535) then begin
Application.MessageBox('网关二端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort2.SetFocus;
exit;
end;
if (nPort3 < 0) or (nPort3 > 65535) then begin
Application.MessageBox('网关三端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort3.SetFocus;
exit;
end;
if (nPort4 < 0) or (nPort4 > 65535) then begin
Application.MessageBox('网关四端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort4.SetFocus;
exit;
end;
if (nPort5 < 0) or (nPort5 > 65535) then begin
Application.MessageBox('网关五端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort5.SetFocus;
exit;
end;
if (nPort6 < 0) or (nPort6 > 65535) then begin
Application.MessageBox('网关六端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort6.SetFocus;
exit;
end;
if (nPort7 < 0) or (nPort7 > 65535) then begin
Application.MessageBox('网关七端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort7.SetFocus;
exit;
end;
if (nPort8 < 0) or (nPort8 > 65535) then begin
Application.MessageBox('网关八端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditRunGate_GatePort8.SetFocus;
exit;
end;
g_nRunGate_GatePort := nPort1;
g_nRunGate1_GatePort := nPort2;
g_nRunGate2_GatePort := nPort3;
g_nRunGate3_GatePort := nPort4;
g_nRunGate4_GatePort := nPort5;
g_nRunGate5_GatePort := nPort6;
g_nRunGate6_GatePort := nPort7;
g_nRunGate7_GatePort := nPort8;
PageControl3.ActivePageIndex := 4;
end;
procedure TfrmMain.ButtonNext5Click(Sender: TObject);
var
nGatePort, nServerPort: Integer;
begin
nGatePort := Str_ToInt(Trim(EditLoginServerGatePort.Text), -1);
nServerPort := Str_ToInt(Trim(EditLoginServerServerPort.Text), -1);
if (nGatePort < 0) or (nGatePort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditLoginServerGatePort.SetFocus;
exit;
end;
if (nServerPort < 0) or (nServerPort > 65535) then begin
Application.MessageBox('通讯端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditLoginServerServerPort.SetFocus;
exit;
end;
g_nLoginServer_GatePort := nGatePort;
g_nLoginServer_ServerPort := nServerPort;
PageControl3.ActivePageIndex := 5;
end;
procedure TfrmMain.ButtonNext6Click(Sender: TObject);
var
nGatePort, nServerPort: Integer;
begin
nGatePort := Str_ToInt(Trim(EditDBServerGatePort.Text), -1);
nServerPort := Str_ToInt(Trim(EditDBServerServerPort.Text), -1);
if (nGatePort < 0) or (nGatePort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditDBServerGatePort.SetFocus;
exit;
end;
if (nServerPort < 0) or (nServerPort > 65535) then begin
Application.MessageBox('通讯端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditDBServerServerPort.SetFocus;
exit;
end;
g_nDBServer_Config_GatePort := nGatePort;
g_nDBServer_Config_ServerPort := nServerPort;
PageControl3.ActivePageIndex := 6;
end;
procedure TfrmMain.ButtonNext7Click(Sender: TObject);
var
nPort: Integer;
begin
nPort := Str_ToInt(Trim(EditLogServerPort.Text), -1);
if (nPort < 0) or (nPort > 65535) then begin
Application.MessageBox('端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditLogServerPort.SetFocus;
exit;
end;
g_nLogServer_Port := nPort;
PageControl3.ActivePageIndex := 7;
end;
procedure TfrmMain.ButtonNext8Click(Sender: TObject);
var
nGatePort, nMsgSrvPort: Integer;
begin
nGatePort := Str_ToInt(Trim(EditM2ServerGatePort.Text), -1);
nMsgSrvPort := Str_ToInt(Trim(EditM2ServerMsgSrvPort.Text), -1);
if (nGatePort < 0) or (nGatePort > 65535) then begin
Application.MessageBox('网关端口设置错误!!!', '错误信息', MB_OK + MB_ICONERROR);
EditM2ServerGatePort.SetFocus;
exit;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -