广播聊天

This commit is contained in:
bob
2025-08-07 17:51:25 +08:00
parent 70bfe43a80
commit e1a4db89ae
19 changed files with 347 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
using System.Net;
using Fantasy;
using Fantasy.Async;
using Fantasy.Network;
using Fantasy.Platform.Net;
@@ -7,10 +8,30 @@ namespace NB.Game;
public static class GameSceneHelper
{
public static SceneConfig GetSceneConfig(Session session)
private static SceneConfig GetSceneConfig()
{
var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Game);
return gameSceneConfigs.First();
}
public static async FTask<long> Online(Scene scene, long accountID, long gateRuntimeId)
{
var gameSceneConfig = GetSceneConfig();
var gameRouteId = gameSceneConfig.RouteId;
//连接到游戏中心服
var gameResponse = (Game2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
gameRouteId, new G2Game_EnterRequest()
{
AccountId = accountID,
GateRouteId = gateRuntimeId
});
if (gameResponse.ErrorCode != 0)
{
return 0;
}
return gameResponse.RoleRouteId;
}
}