38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Authentication;
|
|
using Fantasy;
|
|
using Fantasy.Async;
|
|
using Fantasy.Authentication;
|
|
using Fantasy.Event;
|
|
using Fantasy.Gate;
|
|
|
|
namespace System;
|
|
|
|
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>();
|
|
// 用于管理GameAccount的组件
|
|
scene.AddComponent<GameAccountManageComponent>();
|
|
break;
|
|
}
|
|
}
|
|
|
|
await FTask.CompletedTask;
|
|
}
|
|
} |