Files
Fishing2Server/Hotfix/OnSceneCreate_Init.cs
2025-08-08 09:13:09 +08:00

52 lines
1.5 KiB
C#

using Fantasy;
using Fantasy.Async;
using Fantasy.Event;
using NB.Authentication;
using NB.Chat;
using NB.Game;
using NB.Gate;
namespace NB;
public class OnSceneCreate_Init : AsyncEventSystem<OnCreateScene>
{
protected override async FTask Handler(OnCreateScene self)
{
var scene = self.Scene;
switch (scene.SceneType)
{
case SceneType.Authentication:
{
// 用于鉴权服务器注册和登录相关逻辑的组件
scene.AddComponent<AuthenticationComponent>().UpdatePosition();
// 用于颁发ToKen证书相关的逻辑。
scene.AddComponent<AuthenticationJwtComponent>();
break;
}
case SceneType.Gate:
{
// 用于管理网关所有连接的组件
scene.AddComponent<GateUnitManageComponent>();
// 用于验证JWT是否合法的组件
scene.AddComponent<GateJWTComponent>();
break;
}
case SceneType.Game:
{
//用于管理玩家的组件
scene.AddComponent<PlayerManageComponent>();
break;
}
case SceneType.Chat:
{
//用于管理玩家的组件
scene.AddComponent<ChatUnitManageComponent>();
scene.AddComponent<ChatChannelCenterComponent>();
break;
}
}
await FTask.CompletedTask;
}
}