Files
Fishing2Server/Hotfix/Chat/Helper/ChatSceneHelper.cs
2025-08-07 09:16:23 +08:00

29 lines
843 B
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;
using Fantasy.Platform.Net;
namespace NB.Chat;
public static class ChatSceneHelper
{
/// <summary>
/// 广播消息
/// </summary>
/// <param name="scene"></param>
/// <param name="message"></param>
public static void Broadcast(Scene scene, string message)
{
//发送给所有Gate服务器让Gate转发给其他客户端
var gateConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Gate);
var sendMessage = new Chat2C_Message()
{
Message = message
};
var networkMessagingComponent = scene.NetworkMessagingComponent;
foreach (var config in gateConfigs)
{
//发送给Gate服务器转发消息
networkMessagingComponent.SendInnerRoute(config.RouteId, sendMessage);
}
}
}