2024-03-05 10:37:18 +00:00
|
|
|
|
namespace Supercell.GUT.Titan.Logic.Message;
|
2024-03-04 13:19:32 +00:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|