Supercell.GUT/Supercell.GUT.Logic/Base/LogicBase.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

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