using Fantasy;

namespace NB.Chat;

public static class ChatChannelSystem
{
    /// <summary>
    /// 进入频道
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="unit"></param>
    public static void Enter(this ChatChannel channel, SocialUnit unit)
    {
        channel.Units.Add(unit.Id);
        unit.CurrentChannel = channel.Id;
    }

    /// <summary>
    /// 离开频道
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="unit"></param>
    public static void Exit(this ChatChannel channel, SocialUnit unit)
    {
        channel.Units.Remove(unit.Id);
        unit.CurrentChannel = 0;
    }
}