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

45 lines
1.3 KiB
C#
Raw Normal View History

using QSB.ClientServerStateSync;
using QSB.Messaging;
using QuantumUNET.Transport;
2020-11-03 21:33:48 +00:00
namespace QSB.Player.Events
{
public class PlayerInformationMessage : PlayerMessage
2020-12-02 21:23:01 +00:00
{
public string PlayerName { get; set; }
2021-04-18 17:42:22 +00:00
public PlayerState PlayerState { get; set; }
public ClientState ClientState { 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();
2021-04-18 17:42:22 +00:00
PlayerState = new PlayerState
{
2021-04-18 17:46:55 +00:00
IsReady = reader.ReadBoolean(),
2021-04-18 17:42:22 +00:00
FlashlightActive = reader.ReadBoolean(),
SuitedUp = reader.ReadBoolean(),
ProbeLauncherEquipped = reader.ReadBoolean(),
SignalscopeEquipped = reader.ReadBoolean(),
TranslatorEquipped = reader.ReadBoolean(),
ProbeActive = reader.ReadBoolean()
};
ClientState = (ClientState)reader.ReadInt32();
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);
2021-04-18 17:46:55 +00:00
writer.Write(PlayerState.IsReady);
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);
writer.Write((int)ClientState);
2020-12-02 21:23:01 +00:00
}
}
}