Esempio n. 1
0
        protected void afterReceiveProto(Protobuf protobuf)
        {
            UnityEngine.Debug.LogFormat("Recv protobuf {0}", protobuf.ProtoID);
            var msgType = (Message.MessageType)Enum.Parse(typeof(Message.MessageType), protobuf.ProtoID.ToString());

            actions.Enqueue(() => { Message.MessageSystem <Message.MessageType> .Notify(msgType, protobuf.Proto); });
        }
Esempio n. 2
0
        public override void Send(Protobuf protobuf)
        {
            beforeSendProto(protobuf);
            var data = coder.Encode(protobuf);

            SendJS(data, data.Length);
        }
Esempio n. 3
0
 public void Send(Protobuf protobuf)
 {
     if(socket == null || !socket.Connected)
     {
         UnityEngine.Debug.LogError("Socket was not established!");
         return;
     }
     beforeSendProto(protobuf);
     var data = coder.Encode(protobuf);
     socket.BeginSend(data, 0, data.Length, SocketFlags.None, beginSendCallback, socket);
 }
Esempio n. 4
0
        private void afterReceiveProto(Protobuf protobuf)
        {
            if (protobuf.ProtoID == ProtoNameIds.HEARTBEAT)
            {
                AGrail.GameManager.heart = 0;
            }
            var msgType = (Message.MessageType)Enum.Parse(typeof(Message.MessageType), protobuf.ProtoID.ToString());

            actions.Enqueue(() =>
            {
                UnityEngine.Debug.LogFormat("Recv protobuf {0}", protobuf.ProtoID);
                Message.MessageSystem <Message.MessageType> .Notify(msgType, protobuf.Proto);
            });
        }
Esempio n. 5
0
 private void beforeSendProto(Protobuf protobuf)
 {
     UnityEngine.Debug.LogFormat("Send protobuf {0}", protobuf.ProtoID);
 }
Esempio n. 6
0
 public abstract void Send(Protobuf protobuf);