Esempio n. 1
0
        public void refreshPlayerList()
        {
            if (GameInstance.Instance.Game != null)
            {
                Game gameEntity = client.RetrieveGame(GameInstance.Instance.Game.Name, true);

                listBox1.DataSource    = gameEntity.Players;
                listBox1.DisplayMember = "Name";
                listBox1.ValueMember   = "Name";
            }
        }
        private void JoinGame_Click(object sender, EventArgs e)
        {
            Game game = listBox1.SelectedItem as Game;

            Game game2   = client.RetrieveGame(game.Name, false);
            bool success = client.JoinGame(game2);

            if (success)
            {
                this.Hide();
                (new Lobby(game2, client)).Show();
            }
            else
            {
                MessageBox.Show("Unable to join game!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        public Lobby(Game game, ConquestionServiceClient conquestionServiceClient)
        {
            InitializeComponent();
            client = conquestionServiceClient;
            Game gameEntity = client.RetrieveGame(game.Name, true);

            GameInstance.Instance.Game   = gameEntity;
            GameInstance.Instance.client = client;
            label1.Text = gameEntity.Name;
            label3.Text = gameEntity.QuestionSet.Title;


            listBox1.DataSource    = gameEntity.Players;
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember   = "Name";

            Start_Game.Enabled = false;
            CheckIfLobbyHost();
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox1.Text) && comboBox2.SelectedItem != null)
            {
                QuestionSet questionSet = client.RetrieveQuestionSetByTitle(comboBox2.Text);

                client.CreateGame2(new Game {
                    Name = textBox1.Text
                }, questionSet.Title, Int32.Parse(maskedTextBox1.Text));
                Game game = client.RetrieveGame(textBox1.Text, false);;

                client.AddPlayer(game);

                this.Hide();
                (new Lobby(game, client)).Show();
            }
            else
            {
                MessageBox.Show("All fields must be filled!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void UpdateCurrentGame()
        {
            Game gameEntity = client.RetrieveGame(Game.Name, true);

            Game = gameEntity;
        }