Exemple #1
0
 static void userLoggedOut(Field userdata)
 {
     lock (playersByID)
     {
         int id = (short)userdata.getField("id").getInt();
         InfoFeed.displayMessage(new InfoMessage(playersByID[id].name + " logged out", Time.time + 5));
         playersByID.Remove(id);
     }
 }
Exemple #2
0
 static void userLoggedIn(Field userdata)
 {
     lock (playersByID) {
         int id = (short)userdata.getField("id").getInt();
         if (!playersByID.ContainsKey(id))
         {
             Player p = new Player(id, userdata.getField("name").getString());
             InfoFeed.displayMessage(new InfoMessage(p.name + "(" + p.id + ") logged in", Time.time + 5));
             playersByID.Add(id, p);
             if (id == myPlayerID)
             {
                 myPlayer = p;
                 myPlayer.setActivePlayer();
             }
         }
         else
         {
             Debug.LogWarning("Duplicate login for player " + userdata.getField("name").getString());
         }
     }
 }