Пример #1
0
        private void InitializeComboBoxes()
        {
            DBGame        dataBase = DBGame.conn();
            List <String> langs    = dataBase.getLanguages();

            String[] masObj = langs.ToArray();
            comboBox9.Items.AddRange(masObj);
            comboBox9.SelectedItem = langs.First();

            playersCB    = new ComboBox[8];
            playersCB[0] = comboBox1;
            playersCB[1] = comboBox2;
            playersCB[2] = comboBox3;
            playersCB[3] = comboBox4;
            playersCB[4] = comboBox5;
            playersCB[5] = comboBox6;
            playersCB[6] = comboBox7;
            playersCB[7] = comboBox8;

            List <String> players = new List <String>();

            players.Add("<empty>");
            players.AddRange(dataBase.getPlayers());
            players.Add("N.Noname");
            players.Add("W.Computer");
            players.Add("M.Computer");
            players.Add("S.Computer");
            String[] playersMas = players.ToArray();

            for (int i = 0; i < 8; i++)
            {
                playersCB[i].Items.AddRange(playersMas);
                playersCB[i].SelectedItem = "<empty>";
            }
        }
Пример #2
0
 public static DBGame conn()
 {
     if (singleton == null)
     {
         singleton = new DBGame();
     }
     return(singleton);
 }
Пример #3
0
        private void formDeck(List <String> packs, String lang)
        {
            DBGame dataBase = DBGame.conn();

            deck = new List <Event>();
            foreach (String curPack in packs)
            {
                deck.AddRange(dataBase.getEventsOfPack(curPack, lang));
            }
        }
Пример #4
0
        public void addPoints(int points)
        {
            if (ID == "N" || isBot)
            {
                return;
            }
            DBGame dataBase = DBGame.conn();

            dataBase.addPoints(ID, points);
        }
Пример #5
0
        private void LoadList()
        {
            listView1.Items.Clear();
            DBGame          dataBase = DBGame.conn();
            List <String[]> packList = dataBase.getPacks();

            foreach (String[] strMas in packList)
            {
                ListViewItem lvi = new ListViewItem(strMas[0]);
                lvi.SubItems.Add(strMas[1]);
                listView1.Items.Add(lvi);
            }
        }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            String enteredPassword = textBox1.Text;
            DBGame dataBase        = DBGame.conn();

            if (dataBase.checkPassword(ID, enteredPassword))
            {
                GameWindow.gameWin.passwordChecked();
                this.Close();
            }
            else
            {
                MessageBox.Show("Wrong password, try again");
            }
        }