using ProtoCSStruct; using Sog; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Game { public class MsgCache { //public ProtoCSStruct.IStructMessageParser Parser; //public ref T GetMessage() where T : struct, ProtoCSStruct.IStructMessage //{ // return ref ((ProtoCSStruct.StructMessageParser)Parser).GetMessage(); //} public byte[] Data; public void SetData(ref T msg) where T : struct, IStructMessage { Data = StructMessageParseUtils.ToByteArray(ref msg); } public void ParseFrom(ref T message ) where T : struct, IStructMessage { CodedInputStream input = new CodedInputStream(Data); message.ReadFrom(input); } } public abstract class IPlayerMsgCache { abstract public void clear(); abstract public bool CheckRepeateMsg(PlayerOnGame player, StructPacket packet); abstract public void AddSendMsg(PlayerOnGame player, StructPacket packetReq, MsgCache msg); } }