59 lines
1.8 KiB
C#
59 lines
1.8 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>();
|
|
scene.AddComponent<PlayerBasicCacheManageComponent>();
|
|
break;
|
|
}
|
|
case SceneType.Social:
|
|
{
|
|
//用于管理玩家的组件
|
|
scene.AddComponent<SocialUnitManageComponent>();
|
|
scene.AddComponent<ChatChannelCenterComponent>();
|
|
scene.AddComponent<MailManageComponent>();
|
|
break;
|
|
}
|
|
case SceneType.Map:
|
|
{
|
|
Log.Info("创建地图场景===");
|
|
break;
|
|
}
|
|
}
|
|
|
|
await FTask.CompletedTask;
|
|
}
|
|
} |