⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generalconfig.~pas

📁 翎风世界..传奇服务端..DELPHI源代码 包括DBServer,LogDataServer,LoginGate,LoginSrv,M2Server等..内容齐全.
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
  EditIDSAddr.Text:=g_Config.sIDSAddr;
  EditIDSPort.Text:=IntToStr(g_Config.nIDSPort);
  EditDBAddr.Text:=g_Config.sDBAddr;
  EditDBPort.Text:=IntToStr(g_Config.nDBPort);
  EditLogServerAddr.Text:=g_Config.sLogServerAddr;
  EditLogServerPort.Text:=IntToStr(g_Config.nLogServerPort);

  EditGameName.Text:=g_Config.sServerName;
  EditServerIndex.Text:=IntToStr(nServerIndex);
  EditServerNumber.Text:=IntToStr(g_Config.nServerNumber);
  CheckBoxServiceMode.Checked:=g_Config.boServiceMode;
  CheckBoxTestServer.Checked:=g_Config.boTestServer;
  EditTestLevel.Text:=IntToStr(g_Config.nTestLevel);
  EditTestGold.Text:=IntToStr(g_Config.nTestGold);
  EditTestUserLimit.Text:=IntToStr(g_Config.nTestUserLimit);
  EditUserFull.Text:=IntToStr(g_Config.nUserFull);
  CheckBoxTestServerClick(Self);

  EditGuildDir.Text:=g_Config.sGuildDir;
  EditGuildFile.Text:=g_Config.sGuildFile;
  EditConLogDir.Text:=g_Config.sConLogDir;
  EditCastleDir.Text:=g_Config.sCastleDir;
  EditEnvirDir.Text:=g_Config.sEnvirDir;
  EditMapDir.Text:=g_Config.sMapDir;
  EditNoticeDir.Text:=g_Config.sNoticeDir;
  EditPlugDir.Text:=g_Config.sPlugDir;
  EditVentureDir.Text:=g_Config.sVentureDir;

  RefDlgConf();

  boOpened:=True;
  PageControl.ActivePageIndex:=0;
  ShowModal;
end;

procedure TfrmGeneralConfig.EditValueChange(Sender: TObject);
begin
  if not boOpened then exit;
  ModValue();
end;



procedure TfrmGeneralConfig.PageControlChanging(Sender: TObject;
  var AllowChange: Boolean);
begin
  if boModValued then begin
    if Application.MessageBox('参数设置已经被修改,是否确认不保存修改的设置?','确认信息',MB_YESNO + MB_ICONQUESTION) = IDYES then begin
      uModValue
    end else AllowChange:=False;
  end;
end;

procedure TfrmGeneralConfig.CheckBoxTestServerClick(Sender: TObject);
var
  boStatue:Boolean;
begin
  boStatue:=CheckBoxTestServer.Checked;
  EditTestLevel.Enabled:=boStatue;
  EditTestGold.Enabled:=boStatue;
  EditTestUserLimit.Enabled:=boStatue;
  EditValueChange(Sender);
end;

procedure TfrmGeneralConfig.ButtonServerInfoSaveClick(Sender: TObject);
var
  GameName:String;
  ServerIndex,ServerNumber,TestLevel,TestGold,TestUserLimit,UserFull:Integer;
  TestServer,ServiceMode:Boolean;
begin
  GameName:=Trim(EditGameName.Text);
  ServerIndex:=Str_ToInt(Trim(EditServerIndex.Text),-1);
  ServerNumber:=Str_ToInt(Trim(EditServerNumber.Text),-1);
  ServiceMode:=CheckBoxServiceMode.Checked;
  TestServer:=CheckBoxTestServer.Checked;
  TestLevel:=Str_ToInt(Trim(EditTestLevel.Text),-1);
  TestGold:=Str_ToInt(Trim(EditTestGold.Text),-1);
  TestUserLimit:=Str_ToInt(Trim(EditTestUserLimit.Text),-1);
  UserFull:=Str_ToInt(Trim(EditUserFull.Text),-1);
  if GameName = '' then begin
    Application.MessageBox('游戏名称设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditGameName.SetFocus;
    exit;
  end;

  if (ServerIndex < 0) or (ServerIndex > 255) then begin
    Application.MessageBox('服务器号设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditServerIndex.SetFocus;
    exit;
  end;

  if (ServerNumber < 0) or (ServerNumber > 255) then begin
    Application.MessageBox('服务器数设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditServerNumber.SetFocus;
    exit;
  end;
  if (TestLevel < 0) or (TestLevel > 65535) then begin
    Application.MessageBox('开始等级设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditTestLevel.SetFocus;
    exit;
  end;
  if (TestGold < 0) or (TestGold > High(Integer) div 2) then begin
    Application.MessageBox('开始金币设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditTestGold.SetFocus;
    exit;
  end;

  if (TestUserLimit < 0) or (TestUserLimit > 10000) then begin
    Application.MessageBox('测试人数设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditTestUserLimit.SetFocus;
    exit;
  end;

  if (UserFull < 0) or (UserFull > 10000) then begin
    Application.MessageBox('上限人数设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditUserFull.SetFocus;
    exit;
  end;

  g_Config.sServerName:=GameName;
  //nServerIndex:=ServerIndex;
  g_Config.nServerNumber:=ServerNumber;
  g_Config.boServiceMode:=ServiceMode;
  g_Config.boTestServer:=TestServer;
  g_Config.nTestLevel:=TestLevel;
  g_Config.nTestGold:=TestGold;
  g_Config.nTestUserLimit:=TestUserLimit;
  g_Config.nUserFull:=UserFull;

  Config.WriteString('Server','ServerName',g_Config.sServerName);
  Config.WriteInteger('Server','ServerIndex',nServerIndex);
  Config.WriteInteger('Server','ServerNumber',g_Config.nServerNumber);
  Config.WriteString('Server','TestServer',BoolToStr(g_Config.boTestServer));
  Config.WriteInteger('Server','TestLevel',g_Config.nTestLevel);
  Config.WriteInteger('Server','TestGold',g_Config.nTestGold);
  Config.WriteInteger('Server','TestServerUserLimit',g_Config.nTestUserLimit);
  Config.WriteInteger('Server','UserFull',g_Config.nUserFull);
  uModValue();
end;

procedure TfrmGeneralConfig.ButtonShareDirSaveClick(Sender: TObject);
var
  GuildDir,GuildFile,VentureDir,ConLogDir,CastleDir,EnvirDir,MapDir,NoticeDir,PlugDir:String;
begin
  GuildDir:=Trim(EditGuildDir.Text);
  GuildFile:=Trim(EditGuildFile.Text);
  VentureDir:=Trim(EditVentureDir.Text);
  ConLogDir:=Trim(EditConLogDir.Text);
  CastleDir:=Trim(EditCastleDir.Text);
  EnvirDir:=Trim(EditEnvirDir.Text);
  MapDir:=Trim(EditMapDir.Text);
  NoticeDir:=Trim(EditNoticeDir.Text);
  PlugDir:=Trim(EditPlugDir.Text);

  if not DirectoryExists(GuildDir) or (GuildDir[length(GuildDir)] <> '\') then begin
    Application.MessageBox('行会目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditGuildDir.SetFocus;
    exit;
  end;
  if not FileExists(GuildFile) then begin
    Application.MessageBox('行会文件设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditGuildFile.SetFocus;
    exit;
  end;
  if not DirectoryExists(VentureDir) or (VentureDir[length(VentureDir)] <> '\') then begin
    Application.MessageBox('Venture目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditVentureDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(ConLogDir) or (ConLogDir[length(ConLogDir)] <> '\') then begin
    Application.MessageBox('登录日志目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditConLogDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(CastleDir) or (CastleDir[length(CastleDir)] <> '\') then begin
    Application.MessageBox('城堡目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditCastleDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(EnvirDir) or (EnvirDir[length(EnvirDir)] <> '\') then begin
    Application.MessageBox('配置目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditEnvirDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(MapDir) or (MapDir[length(MapDir)] <> '\') then begin
    Application.MessageBox('地图目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditMapDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(NoticeDir) or (NoticeDir[length(NoticeDir)] <> '\') then begin
    Application.MessageBox('公告目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditNoticeDir.SetFocus;
    exit;
  end;
  if not DirectoryExists(PlugDir) or (PlugDir[length(PlugDir)] <> '\') then begin
    Application.MessageBox('插件目录设置错误!!!','错误信息',MB_OK + MB_ICONERROR);
    EditPlugDir.SetFocus;
    exit;
  end;

  g_Config.sGuildDir:=GuildDir;
  g_Config.sGuildFile:=GuildFile;
  g_Config.sVentureDir:=VentureDir;
  g_Config.sConLogDir:=ConLogDir;
  g_Config.sCastleDir:=CastleDir;
  g_Config.sEnvirDir:=EnvirDir;
  g_Config.sMapDir:=MapDir;
  g_Config.sNoticeDir:=NoticeDir;
  g_Config.sPlugDir:=PlugDir;

  Config.WriteString('Share','GuildDir',g_Config.sGuildDir);
  Config.WriteString('Share','GuildFile',g_Config.sGuildFile);
  Config.WriteString('Share','VentureDir',g_Config.sVentureDir);
  Config.WriteString('Share','ConLogDir',g_Config.sConLogDir);
  Config.WriteString('Share','CastleDir',g_Config.sCastleDir);
  Config.WriteString('Share','EnvirDir',g_Config.sEnvirDir);
  Config.WriteString('Share','MapDir',g_Config.sMapDir);
  Config.WriteString('Share','NoticeDir',g_Config.sNoticeDir);
  Config.WriteString('Share','PlugDir',g_Config.sPlugDir);

  uModValue();
end;


procedure TfrmGeneralConfig.RefDlgConf;
begin
  ColorBoxHint.Selected:=Application.HintColor;
end;
procedure TfrmGeneralConfig.ColorBoxHintChange(Sender: TObject);
begin
  Application.HintColor:=ColorBoxHint.Selected;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -