MiniUDP.NetPeer.QueueNotification C# (CSharp) Метод

QueueNotification() приватный Метод

Queues a new notification to be send out reliably during ticks.
private QueueNotification ( NetEvent data ) : bool
data NetEvent
Результат bool
        internal bool QueueNotification(NetEvent data)
        {
            int notificationCount = this.outgoing.Count;
              if (notificationCount >= NetConfig.MaxPendingNotifications)
              {
            NetDebug.LogError("Notification queue full");
            return false;
              }

              data.Sequence = this.notificationSeq++;
              this.outgoing.Enqueue(data);
              return true;
        }

Same methods

NetPeer::QueueNotification ( byte data, ushort length ) : bool

Usage Example

Пример #1
0
        public void TestReliableCleanup()
        {
            NetPeer netPeer = new NetPeer(null, "Token", false, 0);
              for (int i = 0; i < 20; i++)
            netPeer.QueueNotification(new NetEvent());

              netPeer.OnReceiveCarrier(0, 10, (x) => x = null);
              // First sequence number is 1, so we should have 10 remaining
              Assert.AreEqual(10, netPeer.Outgoing.Count());
        }