mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-11-14 01:14:37 +00:00
8c6a533918
todo: improve code and finish base structures
31 lines
662 B
C#
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);
|
|
}
|
|
}
|