Supercell.GUT/Supercell.GUT.Titan/Logic/Message/VersionedMessage.cs

32 lines
662 B
C#
Raw Normal View History

namespace Supercell.GUT.Titan.Logic.Message;
public abstract class VersionedMessage : PiranhaMessage
{
public int Version { get; set; }
public VersionedMessage() : base(0)
{
this.Version = 0;
}
public VersionedMessage(int messageVersion) : base(messageVersion)
{
this.Version = 0;
}
public override void Encode()
{
this.ByteStream.WriteInt(this.Version);
}
public override void Decode()
{
this.Version = this.ByteStream.ReadInt();
}
public void SetVersion(int major, int build, int minor)
{
this.Version = minor | (major << 20) | (build << 12);
}
}