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