未验证 提交 d7047073 编写于 作者: xh704872627's avatar xh704872627 提交者: GitHub

修改ET6服务器启动失败BUG (#170)

* Log输出到Console

* 使用Config前添加ConfigComponent
使用OuterAddress拼接好的外网地址
修改TimerComponent关于TimeOut相关代码
上级 b9d5ec4a
......@@ -51,7 +51,7 @@
<logger name="*" minlevel="Info" maxlevel="Info" writeTo="info" />
<logger name="*" minlevel="Warn" maxlevel="Warn" writeTo="warn" />
<logger name="*" minlevel="Error" maxlevel="Error" writeTo="error" />
<logger name="*" minlevel="Error" maxlevel="Error" writeTo="errorConsole" />
<logger name="*" minlevel="Trace" maxlevel="Error" writeTo="errorConsole" />
<logger name="*" minlevel="Fatal" maxlevel="Fatal" writeTo="fatal" />
</rules>
</nlog>
\ No newline at end of file
......@@ -28,7 +28,7 @@ namespace ET
public static class ActorMessageSenderComponentSystem
{
public static void Check(this ActorMessageSenderComponent self)
public static void Check(this ActorMessageSenderComponent self, bool isTimeOut)
{
long timeNow = TimeHelper.Now();
foreach ((int key, ActorMessageSender value) in self.requestCallback)
......
......@@ -29,7 +29,7 @@ namespace ET
public static class ActorLocationSenderComponentSystem
{
public static void Check(this ActorLocationSenderComponent self)
public static void Check(this ActorLocationSenderComponent self, bool isTimeOut)
{
using (ListComponent<long> list = EntityFactory.Create<ListComponent<long>>(self.Domain))
{
......
......@@ -7,13 +7,14 @@ namespace ET
{
public override void Run()
{
Game.Scene.AddComponent<ConfigComponent>();
Options options = Game.Scene.GetComponent<Options>();
StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(options.Process);
Game.Scene.AddComponent<TimerComponent>();
Game.Scene.AddComponent<OpcodeTypeComponent>();
Game.Scene.AddComponent<MessageDispatcherComponent>();
Game.Scene.AddComponent<ConfigComponent>();
Game.Scene.AddComponent<CoroutineLockComponent>();
// 发送普通actor消息
Game.Scene.AddComponent<ActorMessageSenderComponent>();
......
......@@ -20,10 +20,10 @@ namespace ET
switch (scene.SceneType)
{
case SceneType.Realm:
scene.AddComponent<NetOuterComponent, string>($"{startSceneConfig.OuterPort}:{startSceneConfig.OuterPort}");
scene.AddComponent<NetOuterComponent, string>(startSceneConfig.OuterAddress);
break;
case SceneType.Gate:
scene.AddComponent<NetOuterComponent, string>($"{startSceneConfig.OuterPort}:{startSceneConfig.OuterPort}");
scene.AddComponent<NetOuterComponent, string>(startSceneConfig.OuterAddress);
scene.AddComponent<PlayerComponent>();
scene.AddComponent<GateSessionKeyComponent>();
break;
......
......@@ -93,7 +93,7 @@ namespace ET
try
{
this.Callback.Invoke(isTimeout);
this.Callback?.Invoke(isTimeout);
}
catch (Exception e)
{
......@@ -292,14 +292,14 @@ namespace ET
/// <param name="time"></param>
/// <param name="action"></param>
/// <returns></returns>
public long NewRepeatedTimer(long time, Action action)
public long NewRepeatedTimer(long time, Action<bool> action)
{
if (time < 30)
{
throw new Exception($"repeated time < 30");
}
long tillTime = TimeHelper.Now() + time;
RepeatedTimer timer = EntityFactory.CreateWithParent<RepeatedTimer, long, Action>(this, time, action);
RepeatedTimer timer = EntityFactory.CreateWithParent<RepeatedTimer, long, Action<bool>>(this, time, action);
this.timers[timer.Id] = timer;
AddToTimeId(tillTime, timer.Id);
return timer.Id;
......
......@@ -21,10 +21,7 @@
RepeatedTimer repeatedTimer = TimerComponent.Instance.GetRepeatedTimer(self.RepeatedTimer);
if (repeatedTimer != null)
{
repeatedTimer.Callback = (isTimeout) =>
{
self.Check();
};
repeatedTimer.Callback = self.Check;
}
}
}
......@@ -44,7 +41,7 @@
public static class SessionIdleCheckerComponentSystem
{
public static void Check(this SessionIdleCheckerComponent self)
public static void Check(this SessionIdleCheckerComponent self, bool isTimeOut)
{
Session session = self.GetParent<Session>();
long timeNow = TimeHelper.Now();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册