mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-13 15:04:37 +01:00
31 lines
734 B
C#
31 lines
734 B
C#
using BLHX.Server.Common.Proto.p50;
|
|
|
|
namespace BLHX.Server.Game.Managers
|
|
{
|
|
public class ChatManager
|
|
{
|
|
List<MsgInfo> messages = [];
|
|
|
|
public void SendChat(MsgInfo msgInfo, bool broadcast = true)
|
|
{
|
|
msgInfo.Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds();
|
|
|
|
messages.Add(msgInfo);
|
|
BroadcastChat(msgInfo);
|
|
}
|
|
|
|
void BroadcastChat(MsgInfo msgInfo)
|
|
{
|
|
var ntf = new Sc50101()
|
|
{
|
|
Content = msgInfo.Content,
|
|
Player = msgInfo.Player,
|
|
Type = 1
|
|
};
|
|
|
|
foreach (var conn in GameServer.connections.Values)
|
|
conn.Send(ntf);
|
|
}
|
|
}
|
|
}
|