[+] 接入ET8服务端

[+] 接入ET8服务端
This commit is contained in:
ALEXTANG
2023-07-13 12:23:48 +08:00
parent e0be062006
commit 336d4b2eb9
1316 changed files with 130657 additions and 626 deletions

View File

@@ -0,0 +1,44 @@
using System;
using System.Net;
namespace ET.Server
{
[Event(SceneType.Main)]
public class EntryEvent2_InitServer: AEvent<Scene, ET.EventType.EntryEvent2>
{
protected override async ETTask Run(Scene root, ET.EventType.EntryEvent2 args)
{
World.Instance.AddSingleton<HttpDispatcher>();
World.Instance.AddSingleton<ConsoleDispatcher>();
switch (Options.Instance.AppType)
{
case AppType.Server:
{
// 根据配置创建纤程
var processScenes = StartSceneConfigCategory.Instance.GetByProcess(root.Fiber().Process);
foreach (StartSceneConfig startConfig in processScenes)
{
await FiberManager.Instance.Create(SchedulerType.ThreadPool, startConfig.Id, startConfig.Zone, startConfig.Type, startConfig.Name);
}
break;
}
case AppType.Watcher:
{
root.AddComponent<WatcherComponent>();
break;
}
case AppType.GameTool:
{
break;
}
}
if (Options.Instance.Console == 1)
{
root.AddComponent<ConsoleComponent>();
}
}
}
}