设为首页 加入收藏

TOP

DELPHI版传奇引擎学习菜鸟篇(applem2)-03(四)
2017-10-10 12:07:27 】 浏览:6404
Tags:DELPHI 传奇 引擎 学习 菜鸟篇 applem2 -03

boIP2 then SaveList.Add(sLocalIPaddr2); SaveList.SaveToFile(sIniFile + '!addrtable.txt'); SaveList.Clear; sIniFile := sLocalIPaddr; for I := Low(g_Config.RunGate.GetStart) to High(g_Config.RunGate.GetStart) do begin if g_Config.RunGate.GetStart[I] then sIniFile := sIniFile + Format(' %s %d', [g_sExtIPaddr, g_Config.RunGate.GatePort[I]]); end; SaveList.Add(sIniFile); if g_boIP2 then begin sIniFile := sLocalIPaddr2; for I := Low(g_Config.RunGate.GetStart) to High(g_Config.RunGate.GetStart) do begin if g_Config.RunGate.GetStart[I] then sIniFile := sIniFile + Format(' %s %d', [g_sExtIPaddr2, g_Config.RunGate.GatePort[I]]); end; SaveList.Add(sIniFile); end; SaveList.SaveToFile(g_sGameDirectory + 'DBServer\!serverinfo.txt'); SaveList.Free; if not FileExists(g_sGameDirectory + 'DBServer\FUserName.txt') then begin SaveList := TStringList.Create; SaveList.Add(';创建人物过滤字符,一行一个过滤'); SaveList.SaveToFile(g_sGameDirectory + 'DBServer\FUserName.txt'); SaveList.Free; end; end;

启动和停止服务的过程也不是太复杂,不过我看着怎么就那么"复杂",等待都过完一遍后要从头重新写一遍.

procedure TfrmMain.StartGame;
var
  I: Integer;
begin
  m_dwRunTick := GetTickCount;  //返回系统启动经历的毫秒数
  FillChar(DBServer, SizeOf(TProgram), #0); //用指定的值填充连续的字节为进程启动做准备
  //读取服务启动前的初始化状态,以下类似
  DBServer.boGetStart := g_Config.DBServer.GetStart;
  DBServer.boReStart := True;
  DBServer.sDirectory := g_sGameDirectory + 'DBServer\';
  DBServer.sProgramFile := g_Config.DBServer.ProgramFile;
  DBServer.nMainFormX := g_Config.DBServer.MainFormX;
  DBServer.nMainFormY := g_Config.DBServer.MainFormY;

  FillChar(LoginServer, SizeOf(TProgram), #0);
  LoginServer.boGetStart := g_Config.LoginSrv.GetStart;
  LoginServer.boReStart := True;
  LoginServer.sDirectory := g_sGameDirectory + 'LoginSrv\';
  LoginServer.sProgramFile := g_Config.LoginSrv.ProgramFile;
  LoginServer.nMainFormX := g_Config.LoginSrv.MainFormX;
  LoginServer.nMainFormY := g_Config.LoginSrv.MainFormY;

  FillChar(LogServer, SizeOf(TProgram), #0);
  LogServer.boGetStart := g_Config.LogServer.GetStart;
  LogServer.boReStart := True;
  LogServer.sDirectory := g_sGameDirectory + 'LogServer\';
  LogServer.sProgramFile := g_Config.LogServer.ProgramFile;
  LogServer.nMainFormX := g_Config.LogServer.MainFormX;
  LogServer.nMainFormY := g_Config.LogServer.MainFormY;

  FillChar(M2Server, SizeOf(TProgram), #0);
  M2Server.boGetStart := g_Config.M2Server.GetStart;
  M2Server.boReStart := True;
  M2Server.sDirectory := g_sGameDirectory + 'Mir200\';
  M2Server.sProgramFile := g_Config.M2Server.ProgramFile;
  M2Server.nMainFormX := g_Config.M2Server.MainFormX;
  M2Server.nMainFormY := g_Config.M2Server.MainFormY;
  //RunGate可以启动8个进程,所以用循环读取
  FillChar(RunGate, SizeOf(RunGate), #0);
  for I := Low(RunGate) to High(RunGate) do
  begin
    RunGate[I].btStartStatus := 0;
    RunGate[I].boGetStart := g_Config.RunGate.GetStart[I];
    RunGate[I].boReStart := True;
    RunGate[I].sDirectory := g_sGameDirectory + 'RunGate\';
    RunGate[I].sProgramFile := g_Config.RunGate.ProgramFile;
    if ((I + 1) mod 2) = 0 then
      RunGate[I].nMainFormX := g_Config.RunGate.MainFormX + 276
    else
      RunGate[I].nMainFormX := g_Config.RunGate.MainFormX;
    if I in [2, 3, 6, 7] then
      RunGate[I].n  
		
编程开发网
首页 上一页 1 2 3 4 5 6 下一页 尾页 4/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇DELPHI版传奇引擎学习菜鸟篇(appl.. 下一篇编写简单的C/S聊天程序