OnReceivePayload() 개인적인 메소드

Logs the payload's sequence ID to record payload packet loss. Returns true if we should accept the payload, false if it's too old.
private OnReceivePayload ( long curTime, ushort sequence ) : bool
curTime long
sequence ushort
리턴 bool
예제 #1
0
        private void HandlePayload(
            NetPeer peer,
            byte[] buffer,
            int length)
        {
            if (peer.IsConnected == false)
            {
                return;
            }

            // Read the payload
            bool success =
                NetEncoding.ReadPayload(
                    CreateEvent,
                    peer,
                    buffer,
                    length,
                    out ushort payloadSeq,
                    out NetEvent evnt);

            // Validate
            if (success == false)
            {
                NetDebug.LogError("Error reading payload");
                return;
            }

            // Enqueue the event for processing if the peer can receive it
            if (peer.OnReceivePayload(Time, payloadSeq))
            {
                eventOut.Enqueue(evnt);
            }
        }