Files
Fishing2Server/Hotfix/OnSceneCreate_Init.cs
2025-07-27 23:46:43 +08:00

43 lines
1.2 KiB
C#

using Fantasy;
using Fantasy.Async;
using Fantasy.Event;
using NB.Authentication;
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:
{
// 用于验证JWT是否合法的组件
scene.AddComponent<GateJWTComponent>();
// 用于管理玩家的组件
scene.AddComponent<PlayerManageComponent>();
break;
}
case SceneType.Game:
{
//游戏服用于管理用户的组件
scene.AddComponent<RoleManagerComponent>();
break;
}
}
await FTask.CompletedTask;
}
}