提交示例代码
This commit is contained in:
32
聊天系统课程代码/Server/Hotfix/OnSceneCreate_Init.cs
Normal file
32
聊天系统课程代码/Server/Hotfix/OnSceneCreate_Init.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user