2024-03-05 10:37:18 +00:00
|
|
|
|
using Supercell.GUT.Titan.Logic.DataStream;
|
2024-03-04 13:19:32 +00:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
2024-03-05 10:37:18 +00:00
|
|
|
|
ByteStream byteStream = new ByteStream();
|
2024-03-04 13:19:32 +00:00
|
|
|
|
|
|
|
|
|
logicBase.Encode(byteStream);
|
|
|
|
|
byteStream.ResetOffset();
|
|
|
|
|
|
|
|
|
|
this.Decode(byteStream);
|
|
|
|
|
|
|
|
|
|
byteStream.Destruct();
|
|
|
|
|
}
|
|
|
|
|
}
|