频道聊天相关
This commit is contained in:
@@ -1,10 +1,38 @@
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Helper;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class ChatChannelCenterComponentAwakeSystem : AwakeSystem<ChatChannelCenterComponent>
|
||||
{
|
||||
protected override void Awake(ChatChannelCenterComponent self)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ChatChannelCenterComponentDestroySystem : DestroySystem<ChatChannelCenterComponent>
|
||||
{
|
||||
protected override void Destroy(ChatChannelCenterComponent self)
|
||||
{
|
||||
self.Channels.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ChatChannelCenterComponentSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="channelId"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryGet(this ChatChannelCenterComponent self, long channelId, out ChatChannel? channel)
|
||||
{
|
||||
return self.Channels.TryGetValue(channelId, out channel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 申请创建一个频道
|
||||
/// </summary>
|
||||
@@ -26,18 +54,6 @@ public static class ChatChannelCenterComponentSystem
|
||||
return channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="channelId"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryGet(this ChatChannelCenterComponent self, long channelId, out ChatChannel? channel)
|
||||
{
|
||||
return self.Channels.TryGetValue(channelId, out channel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解散
|
||||
/// </summary>
|
||||
|
||||
26
Hotfix/Chat/System/ChatChannelSystem.cs
Normal file
26
Hotfix/Chat/System/ChatChannelSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace NB.Chat;
|
||||
|
||||
public static class ChatChannelSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 进入频道
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="unit"></param>
|
||||
public static void Enter(this ChatChannel channel, ChatUnit 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, ChatUnit unit)
|
||||
{
|
||||
channel.Units.Remove(unit.Id);
|
||||
unit.CurrentChannel = 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user