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); });
        }
Exemple #2
0
        public override void Send(Protobuf protobuf)
        {
            beforeSendProto(protobuf);
            var data = coder.Encode(protobuf);

            SendJS(data, data.Length);
        }
Exemple #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);
 }
Exemple #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);
            });
        }
Exemple #5
0
 private void beforeSendProto(Protobuf protobuf)
 {
     UnityEngine.Debug.LogFormat("Send protobuf {0}", protobuf.ProtoID);
 }
 public abstract void Send(Protobuf protobuf);