提交示例代码

This commit is contained in:
Bob.Song
2026-03-05 11:39:06 +08:00
commit 25958f58c3
2534 changed files with 209593 additions and 0 deletions

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