Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[]             response = new byte[200];
            CreateRoomRequest  req      = new CreateRoomRequest();
            CreateRoomResponse res      = new CreateRoomResponse();

            req.maxPlayers    = int.Parse(players_text.Text);
            req.questionCount = int.Parse(q_text.Text);
            req.roomName      = name_text.Text;
            req.answerTimeout = int.Parse(time_text.Text);
            byte[] request = serializer.buildMessage <CreateRoomRequest>(ref req, 4);
            Client.client_socket.Send(request);
            res = serializer.DeAssembleMessage <CreateRoomResponse>(response);
            if (res.status == 1)
            {
                if (lobby == null)
                {
                    lobby = new lobbyRoom(true);

                    lobby.Parent = this;
                }

                lobby.Show();

                this.Hide();
            }
        }
Example #2
0
        private void join_button_Click(object sender, EventArgs e)
        {
            byte[]           response = new byte[300];
            JoinRoomResponse res      = new JoinRoomResponse();
            joinRoomRequest  req      = new joinRoomRequest();

            req.roomId = int.Parse(id.Text);
            byte[] request = serializer.buildMessage <joinRoomRequest>(ref req, 7);
            Client.client_socket.Send(request);
            res = serializer.DeAssembleMessage <JoinRoomResponse>(response);
            if (res.status == 1)
            {
                if (lobby == null)
                {
                    lobby = new lobbyRoom(false);

                    lobby.Parent = this;
                }

                lobby.Show();

                this.Hide();
            }
        }