コード例 #1
0
 public override void Serialize(Stream stream)
 {
     using (var w = stream.ToBinaryWriter(true))
     {
         w.WriteEnum(GameRuleMapper.GetOpCode(GetType()));
         Serializer.Serialize(w, this);
     }
 }
コード例 #2
0
        public ProudMessage GetMessage(ISession session, ushort opCode, BinaryReader r)
        {
            if (Enum.IsDefined(typeof(GameOpCode), opCode))
            {
                return(GameMapper.GetMessage((GameOpCode)opCode, r));
            }

            if (Enum.IsDefined(typeof(GameRuleOpCode), opCode))
            {
                return(GameRuleMapper.GetMessage((GameRuleOpCode)opCode, r));
            }

            throw new NetsphereBadOpCodeException(opCode);
        }