示例#1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            // 双击进入房间
            m_password = "";
            ListViewItem selItem = listView1.SelectedItems[0];

            //房间是否已满
            if (MAX_MEMBER <= uint.Parse(selItem.SubItems[2].Text))
            {
                MessageBox.Show("房间已满。");
                return;
            }

            //不公开则显示输入
            if (selItem.SubItems[3].Text == "不公开")
            {
                frmEnterPassword passwordDlg = new frmEnterPassword();
                passwordDlg.ShowDialog();
                //密码为空,取消进入房间。
                if (m_password == "")
                {
                    return;
                }
            }

            //发送请求
            Protocol.C2SEnterRoomReq request = new Protocol.C2SEnterRoomReq();
            request.room_id  = uint.Parse(selItem.Text);
            request.password = m_password;
            NetworkEvent.sendPacket <Protocol.C2SEnterRoomReq>(request);
        }
示例#2
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            // 双击进入房间
            m_password = "";
            ListViewItem selItem = listView1.SelectedItems[0];

            //房间是否已满
            if (MAX_MEMBER <= uint.Parse(selItem.SubItems[2].Text))
            {
                MessageBox.Show("房间已满。");
                return;
            }

            //不公开则显示输入
            if (selItem.SubItems[3].Text == "不公开")
            {
                frmEnterPassword passwordDlg = new frmEnterPassword();
                passwordDlg.ShowDialog();
                //密码为空,取消进入房间。
                if (m_password == "")
                {
                    return;
                }
            }

            //发送请求
            Protocol.C2SEnterRoomReq request = new Protocol.C2SEnterRoomReq();
            request.room_id = uint.Parse(selItem.Text);
            request.password = m_password;
            NetworkEvent.sendPacket<Protocol.C2SEnterRoomReq>(request);
        }