Files
crystall-punk-14/Content.Shared/Players/PlayTimeTracking/MsgPlayTime.cs
Pieter-Jan Briers e852ada6c8 Play time tracking: Job timers 3: more titles: when the (#9978)
Co-authored-by: Veritius <veritiusgaming@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-08-07 16:00:42 +10:00

35 lines
898 B
C#

using Lidgren.Network;
using Robust.Shared.Network;
namespace Content.Shared.Players.PlayTimeTracking;
/// <summary>
/// Sent server -> client to inform the client of their play times.
/// </summary>
public sealed class MsgPlayTime : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.EntityEvent;
public Dictionary<string, TimeSpan> Trackers = new();
public override void ReadFromBuffer(NetIncomingMessage buffer)
{
var count = buffer.ReadVariableInt32();
for (var i = 0; i < count; i++)
{
Trackers.Add(buffer.ReadString(), buffer.ReadTimeSpan());
}
}
public override void WriteToBuffer(NetOutgoingMessage buffer)
{
buffer.WriteVariableInt32(Trackers.Count);
foreach (var (role, time) in Trackers)
{
buffer.Write(role);
buffer.Write(time);
}
}
}