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>
This commit is contained in:
committed by
GitHub
parent
6b94db0336
commit
e852ada6c8
34
Content.Shared/Players/PlayTimeTracking/MsgPlayTime.cs
Normal file
34
Content.Shared/Players/PlayTimeTracking/MsgPlayTime.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user