quantum-space-buddies/QSB/Player/Events/PlayerInformationMessage.cs
2021-08-08 20:04:15 +01:00

45 lines
1.3 KiB
C#

using QSB.ClientServerStateSync;
using QSB.Messaging;
using QuantumUNET.Transport;
namespace QSB.Player.Events
{
public class PlayerInformationMessage : PlayerMessage
{
public string PlayerName { get; set; }
public PlayerState PlayerState { get; set; }
public ClientState ClientState { get; set; }
public override void Deserialize(QNetworkReader reader)
{
base.Deserialize(reader);
PlayerName = reader.ReadString();
PlayerState = new PlayerState
{
IsReady = reader.ReadBoolean(),
FlashlightActive = reader.ReadBoolean(),
SuitedUp = reader.ReadBoolean(),
ProbeLauncherEquipped = reader.ReadBoolean(),
SignalscopeEquipped = reader.ReadBoolean(),
TranslatorEquipped = reader.ReadBoolean(),
ProbeActive = reader.ReadBoolean()
};
ClientState = (ClientState)reader.ReadInt32();
}
public override void Serialize(QNetworkWriter writer)
{
base.Serialize(writer);
writer.Write(PlayerName);
writer.Write(PlayerState.IsReady);
writer.Write(PlayerState.FlashlightActive);
writer.Write(PlayerState.SuitedUp);
writer.Write(PlayerState.ProbeLauncherEquipped);
writer.Write(PlayerState.SignalscopeEquipped);
writer.Write(PlayerState.TranslatorEquipped);
writer.Write(PlayerState.ProbeActive);
writer.Write((int)ClientState);
}
}
}