Beispiel #1
0
 /// <summary>
 /// Removes a player from the index list based on the players index
 /// </summary>
 /// <param name="index">The index of the player to remove</param>
 public static void RemovePlayerFromIndexList(TcpClientIdentifier tcpID)
 {
     rwLock.EnterWriteLock();
     try {
         int index = playerIDToTcpIDList.IndexOfValue(tcpID);
         if (index > -1)
         {
             playerIDToTcpIDList.RemoveAt(index);
         }
     } finally {
         rwLock.ExitWriteLock();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Adds a player to the index list
 /// </summary>
 /// <param name="playerID">The id of the player to add</param>
 /// <param name="tcpID">The id of the tcp client to add</param>
 public static void AddPlayerToIndexList(string playerID, TcpClientIdentifier tcpID)
 {
     rwLock.EnterUpgradeableReadLock();
     try {
         int index = playerIDToTcpIDList.IndexOfKey(playerID);
         if (index == -1)
         {
             rwLock.EnterWriteLock();
             try {
                 playerIDToTcpIDList.Add(playerID, tcpID);
             } finally {
                 rwLock.ExitWriteLock();
             }
         }
     } finally {
         rwLock.ExitUpgradeableReadLock();
     }
 }