提交 b180b69f 编写于 作者: T tanghai

命令行增加protocol参数,可以命令行指定使用tcp,kcp

上级 5ec6ce33
......@@ -48,7 +48,7 @@ namespace App
switch (startConfig.AppType)
{
case AppType.Manager:
Game.Scene.AddComponent<AppManagerComponent>();
Game.Scene.AddComponent<AppManagerComponent, NetworkProtocol>(options.Protocol);
Game.Scene.AddComponent<NetInnerComponent, string>(innerConfig.Address);
Game.Scene.AddComponent<NetOuterComponent, NetworkProtocol, string>(options.Protocol, outerConfig.Address);
break;
......@@ -92,7 +92,7 @@ namespace App
Game.Scene.AddComponent<NetInnerComponent, string>(innerConfig.Address);
Game.Scene.AddComponent<NetOuterComponent, NetworkProtocol, string>(options.Protocol, outerConfig.Address);
Game.Scene.AddComponent<LocationProxyComponent>();
Game.Scene.AddComponent<AppManagerComponent>();
Game.Scene.AddComponent<AppManagerComponent, NetworkProtocol>(options.Protocol);
Game.Scene.AddComponent<RealmGateAddressComponent>();
Game.Scene.AddComponent<GateSessionKeyComponent>();
Game.Scene.AddComponent<ConfigComponent>();
......
......@@ -7,20 +7,22 @@ using System.Runtime.InteropServices;
namespace ETModel
{
[ObjectSystem]
public class AppManagerComponentStartSystem : StartSystem<AppManagerComponent>
public class AppManagerComponentAwakeSystem : AwakeSystem<AppManagerComponent, NetworkProtocol>
{
public override void Start(AppManagerComponent self)
public override void Awake(AppManagerComponent self, NetworkProtocol protocol)
{
self.Start();
self.Awake(protocol);
}
}
public class AppManagerComponent: Component
{
private NetworkProtocol networkProtocol;
private readonly Dictionary<int, Process> processes = new Dictionary<int, Process>();
public void Start()
public void Awake(NetworkProtocol protocol)
{
this.networkProtocol = protocol;
string[] ips = NetHelper.GetAddressIPs();
StartConfig[] startConfigs = StartConfigComponent.Instance.GetAll();
......@@ -51,7 +53,7 @@ namespace ETModel
string configFile = optionComponent.Options.Config;
StartConfig startConfig = startConfigComponent.Get(appId);
const string exe = "dotnet";
string arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile}";
string arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile} --protocol={this.networkProtocol}";
Log.Info($"{exe} {arguments}");
try
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册