32 lines
909 B
C#
32 lines
909 B
C#
using Fantasy.Async;
|
|
using Fantasy.Event;
|
|
|
|
namespace Fantasy;
|
|
|
|
public sealed class OnSceneCreate_Init : AsyncEventSystem<OnCreateScene>
|
|
{
|
|
protected override async FTask Handler(OnCreateScene self)
|
|
{
|
|
var scene = self.Scene;
|
|
|
|
switch (scene.SceneType)
|
|
{
|
|
case SceneType.Gate:
|
|
{
|
|
// GateUnit管理组件。
|
|
scene.AddComponent<GateUnitManageComponent>();
|
|
break;
|
|
}
|
|
case SceneType.Chat:
|
|
{
|
|
// 序列化组件。
|
|
scene.AddComponent<SerializerComponent>().Initialize();
|
|
// ChatUnit管理组件。
|
|
scene.AddComponent<ChatUnitManageComponent>();
|
|
// 聊天频道中控中心组件。
|
|
scene.AddComponent<ChatChannelCenterComponent>();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |