新增相关协议

This commit is contained in:
2025-08-26 18:03:52 +08:00
parent e0665aae01
commit 7325e268ce
36 changed files with 1402 additions and 1085 deletions

View File

@@ -122,52 +122,51 @@ public static class SocialSceneHelper
#region 线线
public static async FTask<(long, long)> Online(Scene scene, RoleSimpleInfo roleSimple, long gateRuntimeId)
{
var gameSceneConfig = GetSceneConfig();
var gameRouteId = gameSceneConfig.RouteId;
//连接到游戏中心服
var gameResponse = (S2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
gameRouteId, new G2S_EnterRequest()
{
Role = roleSimple,
GateRouteId = gateRuntimeId
});
if (gameResponse.ErrorCode != 0)
{
return (0, 0);
}
return (gameResponse.RoleRouteId, gameRouteId);
// return gameRouteId;
}
public static async FTask Offline(Scene scene, long accountId, long gateRuntimeId, long sceneRouteId)
{
for (int i = 0; i < 10; i++)
{
var gameResponse = (S2G_ExitResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
sceneRouteId, new G2S_ExitRequest()
{
AccountId = accountId,
GateRouteId = gateRuntimeId
});
if (gameResponse.ErrorCode == 0)
{
return;
}
}
Log.Error("重试多次还是退出失败,需检查");
}
private static SceneConfig GetSceneConfig()
{
var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Social);
return gameSceneConfigs.First();
}
// public static async FTask<(long, long)> Online(Scene scene, RoleSimpleInfo roleSimple, long gateRuntimeId)
// {
// var gameSceneConfig = GetSceneConfig();
// var gameRouteId = gameSceneConfig.RouteId;
// //连接到游戏中心服
// var gameResponse = (S2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
// gameRouteId, new G2S_EnterRequest()
// {
// Role = roleSimple,
// GateRouteId = gateRuntimeId
// });
//
// if (gameResponse.ErrorCode != 0)
// {
// return (0, 0);
// }
//
// return (gameResponse.RoleRouteId, gameRouteId);
// }
//
// public static async FTask Offline(Scene scene, long accountId, long gateRuntimeId, long sceneRouteId)
// {
// for (int i = 0; i < 10; i++)
// {
// var gameResponse = (S2G_ExitResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
// sceneRouteId, new G2S_ExitRequest()
// {
// AccountId = accountId,
// GateRouteId = gateRuntimeId
// });
// if (gameResponse.ErrorCode == 0)
// {
// return;
// }
// }
//
// Log.Error("重试多次还是退出失败,需检查");
// }
//
// private static SceneConfig GetSceneConfig()
// {
// var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Social);
//
// return gameSceneConfigs.First();
// }
#endregion
}