예제 #1
0
        void Server_onConnection(string id)
        {
            Log.Text += (id + " connected!" + Environment.NewLine); //Updates the log textbox when new user joined
            int numPeopleCon = Server.Users.Count;

            if (minNumPeople == Server.Users.Count)
            {
                string message = everyoneConnected + ":";
                Log.Text += (message + Environment.NewLine);
                Server.Brodcast(ConvertStringToBytes(message));

                message   = sendingQuestion + ":What number is my name";
                Log.Text += (message + Environment.NewLine);
                Server.Brodcast(ConvertStringToBytes(message));
            }
            else
            {
                string message = waitingForPeopleCon + ":Waiting for " + (minNumPeople - numPeopleCon) + " to join";
                Log.Text += (message + Environment.NewLine);
                Server.Brodcast(ConvertStringToBytes(message));
            }
        }
예제 #2
0
 public void sendNumberPlayer(int count)
 {
     server.Brodcast(Utils.ObjectToByteArray(count.ToString()));
 }