Ejemplo n.º 1
0
        /// <summary>
        /// Send setup messages to the newly connected client.
        /// Tell the client they are in the lobby,
        /// who is in the lobby,
        /// and what tables are up.
        /// Finally, start the listening thread for the client.
        /// </summary>
        /// <param name="client"></param>
        public void sendConnectionMsg(GameClient client)
        {
            /** We should be locked from start listening */
            //if the client is not in the client data structure yet, add it.
            if (!clients.Contains(client.getUserName()))
            {
                clients.Add(client.getUserName(), client);
            }
            //first join the lobby.
            client.joinLobby();
            //get everyone else in the lobby.
            string lobbyList = "";

            foreach (object o in clients.Values)
            {
                GameClient gc = (GameClient)o;
                if (gc.inLobby())
                {
                    lobbyList += gc.getUserName() + " ";
                }
            }
            client.sendMessage(Message.WHO_IN_LOBBY + " " + lobbyList);
            //get all the tables.
            string tids = "";

            foreach (int i in tables.Keys)
            {
                tids += i.ToString() + " ";
            }
            client.sendMessage(Message.TBL_LIST + " " + tids.Trim());
            //tell everyone this client joined the lobby.
            this.alertJoinLobby(client);
            //finally, start the listening thread for the game client to hear incoming requests.
            client.Start();
        }
Ejemplo n.º 2
0
 private void putOffTable(GameClient c, GameTable t, bool disconnecting)
 {
     t.nowLeaving(c);
     c.leaveTable(t.getTid());
     alertTableUpdate(t.getTid());
     c.joinLobby();
     if (!disconnecting)
     {
         alertJoinLobby(c);
     }
 }
Ejemplo n.º 3
0
 private void putOffTable(GameClient c, GameTable t, bool disconnecting)
 {
     t.nowLeaving(c);
     c.leaveTable(t.getTid());
     alertTableUpdate(t.getTid());
     c.joinLobby();
     if(!disconnecting)
         alertJoinLobby(c);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Send setup messages to the newly connected client.
 /// Tell the client they are in the lobby,
 /// who is in the lobby, 
 /// and what tables are up.
 /// Finally, start the listening thread for the client.
 /// </summary>
 /// <param name="client"></param>
 public void sendConnectionMsg(GameClient client)
 {
     /** We should be locked from start listening */
     //if the client is not in the client data structure yet, add it.
     if (!clients.Contains(client.getUserName())) {
         clients.Add(client.getUserName(), client);
     }
     //first join the lobby.
     client.joinLobby();
     //get everyone else in the lobby.
     string lobbyList = "";
     foreach (object o in clients.Values) {
         GameClient gc = (GameClient)o;
         if (gc.inLobby()) {
             lobbyList += gc.getUserName() + " ";
         }
     }
     client.sendMessage(Message.WHO_IN_LOBBY + " " + lobbyList);
     //get all the tables.
     string tids = "";
     foreach (int i in tables.Keys) {
         tids += i.ToString() + " ";
     }
     client.sendMessage(Message.TBL_LIST + " " + tids.Trim());
     //tell everyone this client joined the lobby.
     this.alertJoinLobby(client);
     //finally, start the listening thread for the game client to hear incoming requests.
     client.Start();
 }