Supercell.GUT/Supercell.GUT.Titan/Logic/Message/VersionedMessage.cs
BreadDEV 8c6a533918 [v0.0.2] you can enter menu now. but still early state
todo: improve code and finish base structures
2024-03-05 17:37:18 +07:00

31 lines
662 B
C#

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);
}
}