예제 #1
0
        /// <summary>
        /// Converts the stream to a PerformanceQueueItem and adds it to the receive queue
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="stream"></param>
        /// <param name="receiveTime"></param>
        internal static void RpcReceiveQueueItem(ulong clientId, Stream stream, float receiveTime, RpcQueueContainer.QueueItemType queueItemType)
        {
            if (NetworkManager.Singleton.IsServer && clientId == NetworkManager.Singleton.ServerClientId)
            {
                return;
            }

            ProfilerStatManager.RpcsRcvd.Record();
            PerformanceDataManager.Increment(ProfilerConstants.NumberOfRPCsReceived);

#if DEVELOPMENT_BUILD || UNITY_EDITOR
            switch (queueItemType)
            {
            case RpcQueueContainer.QueueItemType.ServerRpc:
                s_RpcReceiveQueueItemServerRpc.Begin();
                break;

            case RpcQueueContainer.QueueItemType.ClientRpc:
                s_RpcReceiveQueueItemClientRpc.Begin();
                break;
            }
#endif

            var rpcQueueContainer = NetworkManager.Singleton.RpcQueueContainer;
            rpcQueueContainer.AddQueueItemToInboundFrame(queueItemType, receiveTime, clientId, (NetworkBuffer)stream);

#if DEVELOPMENT_BUILD || UNITY_EDITOR
            switch (queueItemType)
            {
            case RpcQueueContainer.QueueItemType.ServerRpc:
                s_RpcReceiveQueueItemServerRpc.End();
                break;

            case RpcQueueContainer.QueueItemType.ClientRpc:
                s_RpcReceiveQueueItemClientRpc.End();
                break;
            }
#endif
        }
 public void RpcReceiveQueueItem(ulong clientId, Stream stream, float receiveTime, RpcQueueContainer.QueueItemType queueItemType) => VerifyCalled(nameof(RpcReceiveQueueItem));