quantum-space-buddies/QSB/Player/Events/PlayerStateMessage.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2020-12-14 16:28:03 +00:00
using QSB.Messaging;
using QuantumUNET.Transport;
2020-11-03 21:33:48 +00:00
namespace QSB.Player.Events
{
2020-12-02 21:23:01 +00:00
public class PlayerStateMessage : PlayerMessage
{
public string PlayerName { get; set; }
public bool PlayerReady { get; set; }
2021-04-18 17:42:22 +00:00
public PlayerState PlayerState { get; set; }
2020-12-11 22:42:21 +00:00
2020-12-23 12:58:45 +00:00
public override void Deserialize(QNetworkReader reader)
2020-12-02 21:23:01 +00:00
{
base.Deserialize(reader);
PlayerName = reader.ReadString();
PlayerReady = reader.ReadBoolean();
2021-04-18 17:42:22 +00:00
PlayerState = new PlayerState
{
FlashlightActive = reader.ReadBoolean(),
SuitedUp = reader.ReadBoolean(),
ProbeLauncherEquipped = reader.ReadBoolean(),
SignalscopeEquipped = reader.ReadBoolean(),
TranslatorEquipped = reader.ReadBoolean(),
ProbeActive = reader.ReadBoolean()
};
2020-12-02 21:23:01 +00:00
}
2020-12-23 12:58:45 +00:00
public override void Serialize(QNetworkWriter writer)
2020-12-02 21:23:01 +00:00
{
base.Serialize(writer);
writer.Write(PlayerName);
writer.Write(PlayerReady);
2021-04-18 17:42:22 +00:00
writer.Write(PlayerState.FlashlightActive);
writer.Write(PlayerState.SuitedUp);
writer.Write(PlayerState.ProbeLauncherEquipped);
writer.Write(PlayerState.SignalscopeEquipped);
writer.Write(PlayerState.TranslatorEquipped);
writer.Write(PlayerState.ProbeActive);
2020-12-02 21:23:01 +00:00
}
}
2020-12-03 08:28:05 +00:00
}