聊天频道

This commit is contained in:
2025-08-08 09:13:09 +08:00
parent e1a4db89ae
commit 61496d4616
11 changed files with 190 additions and 6 deletions

View File

@@ -0,0 +1,39 @@
using Fantasy;
namespace NB.Chat;
public static class ChatChannelHelper
{
/// <summary>
/// 申请一个频道
/// </summary>
/// <param name="scene"></param>
/// <param name="channelId"></param>
/// <returns></returns>
public static ChatChannelComponent Apply(Scene scene, long channelId)
{
return scene.GetComponent<ChatChannelCenterComponent>().Apply(channelId);
}
/// <summary>
/// 尝试获取一个频道
/// </summary>
/// <param name="scene"></param>
/// <param name="channelId"></param>
/// <param name="channel"></param>
/// <returns></returns>
public static bool TryGet(Scene scene, long channelId, out ChatChannelComponent? channel)
{
return scene.GetComponent<ChatChannelCenterComponent>().TryGet(channelId, out channel);
}
/// <summary>
/// 解散频道
/// </summary>
/// <param name="scene"></param>
/// <param name="channelId"></param>
public static void Disband(Scene scene, long channelId)
{
scene.GetComponent<ChatChannelCenterComponent>().Disband(channelId);
}
}