You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

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<T>() where T : struct, ProtoCSStruct.IStructMessage<T>
//{
// return ref ((ProtoCSStruct.StructMessageParser<T>)Parser).GetMessage();
//}
public byte[] Data;
public void SetData<T>(ref T msg) where T : struct, IStructMessage<T>
{
Data = StructMessageParseUtils.ToByteArray(ref msg);
}
public void ParseFrom<T>(ref T message )
where T : struct, IStructMessage<T>
{
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);
}
}