Files
ServerStudy/聊天系统课程代码/Server/Hotfix/OnSceneCreate_Init.cs
2026-03-05 11:39:06 +08:00

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;
}
}
}
}