58 lines
2.2 KiB
C#
58 lines
2.2 KiB
C#
|
|
||
|
|
||
|
using System.Net;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
public class AppStartEvent: AEvent<EventType.AppStart>
|
||
|
{
|
||
|
|
||
|
public override async ETTask Run(EventType.AppStart a)
|
||
|
{
|
||
|
ConfigComponent configComponent = Game.Scene.AddComponent<ConfigComponent>();
|
||
|
Options options = Game.Options;
|
||
|
Log.Info($"当前进程:{options.Process}");
|
||
|
StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(options.Process);
|
||
|
|
||
|
StartZoneConfig startZoneConfig = StartZoneConfigCategory.Instance.Get(options.Process);
|
||
|
Game.Scene.AddComponent<DBComponent, string, string>(startZoneConfig.DBConnection, startZoneConfig.DBName);
|
||
|
|
||
|
Game.Scene.AddComponent<TimerComponent>();
|
||
|
Game.Scene.AddComponent<OpcodeTypeComponent>();
|
||
|
Game.Scene.AddComponent<MessageDispatcherComponent>();
|
||
|
|
||
|
|
||
|
Game.Scene.AddComponent<CoroutineLockComponent>();
|
||
|
// 发送普通actor消息
|
||
|
Game.Scene.AddComponent<ActorMessageSenderComponent>();
|
||
|
// 发送location actor消息
|
||
|
Game.Scene.AddComponent<ActorLocationSenderComponent>();
|
||
|
// 访问location server的组件
|
||
|
Game.Scene.AddComponent<LocationProxyComponent>();
|
||
|
Game.Scene.AddComponent<ActorMessageDispatcherComponent>();
|
||
|
// 数值订阅组件
|
||
|
Game.Scene.AddComponent<NumericWatcherComponent>();
|
||
|
// 控制台组件
|
||
|
Game.Scene.AddComponent<ConsoleComponent>();
|
||
|
|
||
|
Game.Scene.AddComponent<NetThreadComponent>();
|
||
|
Game.Scene.AddComponent<NetInnerComponent, IPEndPoint>(processConfig.InnerAddress);
|
||
|
|
||
|
//!自定义组件
|
||
|
Game.Scene.AddComponent<AppConfig>();
|
||
|
Game.Scene.AddComponent<Notice>();
|
||
|
Game.Scene.AddComponent<MainStoryAIComponent>();
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
|
||
|
foreach (StartSceneConfig startConfig in processScenes)
|
||
|
{
|
||
|
Scene scene = await SceneFactory.Create(Game.Scene, startConfig.SceneId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|