mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-11-10 07:44:37 +00:00
8c6a533918
todo: improve code and finish base structures
42 lines
889 B
C#
42 lines
889 B
C#
using Supercell.GUT.Titan.Logic.DataStream;
|
|
|
|
namespace Supercell.GUT.Logic.Base;
|
|
|
|
public abstract class LogicBase
|
|
{
|
|
public int LogicDataVersion { get; set; }
|
|
|
|
public LogicBase(int logicDataVersion)
|
|
{
|
|
this.LogicDataVersion = logicDataVersion;
|
|
}
|
|
|
|
public virtual void Encode(ChecksumEncoder checksumEncoder)
|
|
{
|
|
checksumEncoder.WriteInt(this.LogicDataVersion);
|
|
}
|
|
|
|
public virtual void Decode(ByteStream byteStream)
|
|
{
|
|
this.LogicDataVersion = byteStream.ReadInt();
|
|
}
|
|
|
|
public virtual void Destruct()
|
|
{
|
|
this.LogicDataVersion = 0;
|
|
}
|
|
|
|
public virtual void Copy(LogicBase logicBase)
|
|
{
|
|
this.Destruct();
|
|
|
|
ByteStream byteStream = new ByteStream();
|
|
|
|
logicBase.Encode(byteStream);
|
|
byteStream.ResetOffset();
|
|
|
|
this.Decode(byteStream);
|
|
|
|
byteStream.Destruct();
|
|
}
|
|
}
|