Files
Fishing2Server/Hotfix/Outer/Demo/SubScene/C2G_CreateSubSceneRequestHandler.cs
2025-07-14 17:08:18 +08:00

26 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Fantasy.Async;
using Fantasy.Network;
using Fantasy.Network.Interface;
using Fantasy.Platform.Net;
namespace Fantasy;
public sealed class C2G_CreateSubSceneRequestHandler : MessageRPC<C2G_CreateSubSceneRequest, G2C_CreateSubSceneResponse>
{
protected override async FTask Run(Session session, C2G_CreateSubSceneRequest request, G2C_CreateSubSceneResponse response, Action reply)
{
var scene = session.Scene;
var sceneConfig = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Map)[0];
var createSubSceneResponse = (M2G_CreateSubSceneResponse)await scene.NetworkMessagingComponent.CallInnerRoute(sceneConfig.RouteId, new G2M_CreateSubSceneRequest());
if (createSubSceneResponse.ErrorCode != 0)
{
// 创建SubScene失败。
response.ErrorCode = createSubSceneResponse.ErrorCode;
return;
}
// 记录下这个RouteId以便后续的消息转发。
session.AddComponent<GateSubSceneFlagComponent>().SubSceneRouteId = createSubSceneResponse.SubSceneRouteId;
}
}