Exemplo n.º 1
0
 private void broadcastMsg(string fromUser, string msg)
 {
     foreach (object o in clients.Values)
     {
         GameClient gc = (GameClient)o;
         if (gc.inLobby())
         {
             if (gc.isConnected())
             {
                 gc.sendMessage(Message.MSG + " " + fromUser + " 0 " + msg);
             }
             else
             {
                 dcList.Add(gc);
             }
         }
     }
     clearClosedClients();
 }
Exemplo n.º 2
0
 public void alertLeaveLobby(GameClient c)
 {
     //we have to be locked from an above method
     foreach (object o in clients.Values)
     {
         GameClient gc = (GameClient)o;
         if (!gc.Equals(c))
         {
             if (gc.isConnected())
             {
                 gc.sendMessage(Message.NOW_LEFT_LOBBY + " " + c.getUserName());
             }
             else
             {
                 dcList.Add(gc);
             }
         }
     }
     clearClosedClients();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Broadcast to everyone a new table was created.
 /// </summary>
 /// <param name="tid"></param>
 public void alertNewTable(int tid)
 {
     //we have to be locked from an above method
     if (tables.ContainsKey(tid))
     {
         //tell everyone a new table was created.
         foreach (object o in clients.Values)
         {
             GameClient gc = (GameClient)o;
             if (gc.isConnected())
             {
                 gc.sendMessage(Message.NEW_TBL + " " + tid.ToString());
             }
             else
             {
                 dcList.Add(gc);
             }
         }
         clearClosedClients();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Broadcast to everyone info about the table passed in.
 /// </summary>
 /// <param name="tid"></param>
 public void alertTableUpdate(int tid)
 {
     //we have to be locked from an above method
     if (tables.ContainsKey(tid))
     {
         //broadcast to everyone info about this table.
         foreach (object o in clients.Values)
         {
             GameClient gc = (GameClient)o;
             if (gc.isConnected())
             {
                 sayWhoOnTbl(gc, tid);
             }
             else
             {
                 dcList.Add(gc);
             }
         }
         clearClosedClients();
     }
 }