Пример #1
0
        public NetMsg(NetProtocolEnum InNetProtocolEnum, JsonData InMsgJsonData, int InKey)
        {
            Assert.IsNotNull(InMsgJsonData);

            Key = InKey;
            InMsgJsonData["msgMark"] = Key;
            NetProtocolType          = InNetProtocolEnum;
            InMsgJsonData["name"]    = InNetProtocolEnum.GetNetProtocolName();
            binaryMsg = Encoding.Default.GetBytes(InMsgJsonData.ToJson());

            WhetherWaiting = false;
        }
Пример #2
0
        public NetMsg(NetProtocolEnum InNetProtocolEnum, JsonData InMsgJsonData)
        {
            Assert.IsNotNull(InMsgJsonData);

            NetProtocolType       = InNetProtocolEnum;
            InMsgJsonData["name"] = InNetProtocolEnum.GetNetProtocolName();

            Key = singletonKey;
            InMsgJsonData["echo"] = Key;
            binaryMsg             = Encoding.Default.GetBytes(InMsgJsonData.ToJson());

            WhetherWaiting = false;

            if (++singletonKey == int.MaxValue)
            {
                singletonKey = 1;
            }
        }