设为首页 加入收藏

TOP

DELPHI版传奇引擎学习菜鸟篇(applem2)-03(三)
2017-10-10 12:07:27 】 浏览:6211
Tags:DELPHI 传奇 引擎 学习 菜鸟篇 applem2 -03
nGate.GetStart[6]; CheckBoxboRunGate_GetStart8.Checked := g_Config.RunGate.GetStart[7]; EditRunGate_MainFormX.Value := g_Config.RunGate.MainFormX; EditRunGate_MainFormY.Value := g_Config.RunGate.MainFormY; EditRunGate_GatePort1.Text := IntToStr(g_Config.RunGate.GatePort[0]); EditRunGate_GatePort2.Text := IntToStr(g_Config.RunGate.GatePort[1]); EditRunGate_GatePort3.Text := IntToStr(g_Config.RunGate.GatePort[2]); EditRunGate_GatePort4.Text := IntToStr(g_Config.RunGate.GatePort[3]); EditRunGate_GatePort5.Text := IntToStr(g_Config.RunGate.GatePort[4]); EditRunGate_GatePort6.Text := IntToStr(g_Config.RunGate.GatePort[5]); EditRunGate_GatePort7.Text := IntToStr(g_Config.RunGate.GatePort[6]); EditRunGate_GatePort8.Text := IntToStr(g_Config.RunGate.GatePort[7]); EditSelGate_MainFormX.Value := g_Config.SelGate.MainFormX; EditSelGate_MainFormY.Value := g_Config.SelGate.MainFormY; CheckBoxboSelGate_GetStart.Checked := g_Config.SelGate.GetStart1; CheckBoxboSelGate_GetStart2.Checked := g_Config.SelGate.GetStart2; Edit

SelGate_GatePort.Text :
= IntToStr(g_Config.SelGate.GatePort[0]); EditSelGate_GatePort1.Text := IntToStr(g_Config.SelGate.GatePort[1]); EditLoginGate_MainFormX.Value := g_Config.LoginGate.MainFormX; EditLoginGate_MainFormY.Value := g_Config.LoginGate.MainFormY; CheckBoxboLoginGate_GetStart.Checked := g_Config.LoginGate.GetStart; EditLoginGate_GatePort.Text := IntToStr(g_Config.LoginGate.GatePort); CheckBoxPlugTopGetStart.Checked :=g_Config.PlugTop.GetStart; CheckBoxPlugTop.Checked:=g_Config.PlugTop.GetStart; EditPlugTop_MainFormX.Value:=g_Config.PlugTop.MainFormX; EditPlugTop_MainFormY.Value:=g_Config.PlugTop.MainFormY; m_boOpen := True; end;

看着上边好多类似的取值方式,让我想到了继承,可惜之前定义的都是结构,不然可以优化多,这个函数倒不用多做说明,太通俗易懂了.

下边几个过程是将设置写入服务配置文件,都是类似的,也不用多想就可以看懂,一共9个,第一个是调用其他8个的过程,就是主界面上保存设置按钮的事件.

procedure TfrmMain.GenGameConfig;
begin
  GenDBServerConfig();
  GenLoginServerConfig();
  GenM2ServerConfig();
  GenLogServerConfig();
  GenRunGateConfig();
  GenSelGateConfig();
  GenLoginGateConfig();
  GenPlugTopConfig();
end;

procedure TfrmMain.GenDBServerConfig;
var
  sIniFile: string;
  SaveList: TStringList;
  I: Integer;
begin
  IfNoDirThenCreate(g_sGameDirectory + 'DBServer\');
  IfNoDirThenCreate(g_sGameDirectory + 'DBServer\DB\');

  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2,'ServerName',g_sGameName);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'ServerAddr', sLocalIPaddr);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'ServerPort', g_Config.DBServer.ServerPort);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'GateAddr', sAllIPaddr);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'GatePort', g_Config.DBServer.GatePort);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'IDSAddr', sLocalIPaddr);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'IDSPort', g_Config.LoginSrv.ServerPort);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'DBName', g_sHeroDBName);
  WriteIniValue('Dbsrc.ini',DBSERVERSECTIONNAME2, 'DBDir', '.\DB\');

  SaveList := TStringList.Create;
  SaveList.Add(sLocalIPaddr);
  if g_
			
		  
编程开发网
首页 上一页 1 2 3 4 5 6 下一页 尾页 3/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇DELPHI版传奇引擎学习菜鸟篇(appl.. 下一篇编写简单的C/S聊天程序

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

array(4) { ["type"]=> int(8) ["message"]=> string(24) "Undefined variable: jobs" ["file"]=> string(32) "/mnt/wp/cppentry/do/bencandy.php" ["line"]=> int(217) }