Example #1
0
        private static void HandleReadyForMatch(int connectionId, byte[] data)
        {
            ByteBuffer buffer = new ByteBuffer();

            buffer.WriteBytes(data);
            int packageID = buffer.ReadInteger();
            int matchID   = buffer.ReadInteger();

            if (MatchMaker.matches[matchID].p1.connectionID == connectionId)
            {
                MatchMaker.matches[matchID].p1.Ready = true;
                Console.WriteLine("Player '{0}' ready for match", MatchMaker.matches[matchID].p1.username);
            }
            else
            {
                MatchMaker.matches[matchID].p2.Ready = true;
                Console.WriteLine("Player '{0}' ready for match", MatchMaker.matches[matchID].p2.username);
            }

            MatchMaker.StartMatch(matchID);
        }