Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: C#  |  size: 0.89 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Schizophrenia
  7. {
  8.     class PacketQueue
  9.     {
  10.         public System.Threading.Thread thread;
  11.         public List<int> packets;
  12.         public PacketQueue()
  13.         {
  14.             packets = new List<int>();
  15.             thread = new System.Threading.Thread(start);
  16.             thread.Start();
  17.         }
  18.         public void start()
  19.         {
  20.             while (true)
  21.             {
  22.                 GameManager.MPCLIENT.ReadPacket();
  23.                 packets.Add(BitConverter.ToInt16(GameManager.MPCLIENT._received, 0));
  24.                 Console.WriteLine(packets[packets.Count - 1]);
  25.             }
  26.  
  27.         }
  28.         public int getLatest()
  29.         {
  30.             int r = packets[packets.Count - 1];
  31.             packets.RemoveAt(packets.Count - 1);
  32.             return r;
  33.         }
  34.     }
  35. }