예제 #1
0
        public NetReceivedData(NetConnection connection, NetDataPackage dataPackage)
        {
            this.connection = connection;
            id       = dataPackage.id;
            dataType = dataPackage.dataType != null?Type.GetType(dataPackage.dataType) : null;

            data             = dataPackage.serializedData.Deserialize();
            responseRequired = dataPackage.responseRequired;
            error            = (Error)dataPackage.serializedError.Deserialize();
        }
예제 #2
0
        public static NetRequest CreateAndSend(NetConnection connection, NetDataPackage dataPackage, int channel = Channel.ReliableSequenced)
        {
            NetRequest netRequest = new NetRequest()
            {
                id         = dataPackage.id,
                connection = connection,
            };

            dataPackage.responseRequired = true;
            netRequest.sentDataPackage   = dataPackage;
            netRequest.RegisterResponseHandler();
            connection.Send(dataPackage, channel);

            connection.OnDisconnectEvent.RegisterListener(netRequest.Dispose);

            return(netRequest);
        }
예제 #3
0
 public static NetRequest CreateAndSend(NetConnection connection, object serializableData, int channel = Channel.ReliableSequenced)
 {
     return(CreateAndSend(connection, NetDataPackage.CreateFrom(serializableData, responseRequired: true), channel));
 }