private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox1.Text) && comboBox1.SelectedItem != null && comboBox2.SelectedItem != null)
            {
                //label4.Text = comboBox1.SelectedText;
                client.CreateGame(new Game {
                    Name = textBox1.Text
                });
                Game        game        = client.ChooseGame(textBox1.Text, false);
                Map         map         = client.ChooseMap(comboBox1.Text);
                QuestionSet questionSet = client.RetrieveQuestionSetByTitle(comboBox2.Text);
                client.AddMap(game, map);
                client.AddQuestionSet(game, questionSet);
                client.AddPlayer(game, PlayerCredentials.Instance.Player);


                MessageBox.Show("Game created!", "Info",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Hide();
                (new Lobby(game)).Show();
            }
            else
            {
                MessageBox.Show("All fields must be filled!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public Lobby(Game game)
        {
            InitializeComponent();

            Game gameEntity = client.ChooseGame(game.Name, true);

            CurrentGame.Instance.Game = gameEntity;
            label1.Text = gameEntity.Name;
            label3.Text = gameEntity.QuestionSet.Title;
            label5.Text = gameEntity.Map.Name;

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

            Start_Game.Enabled = false;
            CheckIfLobbyHost();
        }
示例#3
0
        // a list of the players that play and own nodes

        public MapScreen(Game Game)
        {
            InitializeComponent();
            currentRoundAction = CurrentRound.Instance.Round.RoundActions.LastOrDefault();
            Game GameEntity = client.ChooseGame(Game.Name, true);

            CurrentGame = GameEntity;
            playerOrder = client.getGamePlayerOrder(CurrentGame).OrderBy(x => x.Position).ToArray();
            AddAllNodeButtonsToList();
            AddEventHandlersToButtons();
            AssignPlayerColors();
            ColorOccupiedNodes(NodeButtons);
        }
示例#4
0
        private void JoinGame_Click(object sender, EventArgs e)
        {
            Game game  = listBox1.SelectedItem as Game;
            Game game2 = client.ChooseGame(game.Name, false);
            //label1.Text = CurrentPlayer.Name;
            bool success = client.JoinGame(game2, PlayerCredentials.Instance.Player);

            if (success)
            {
                this.Hide();
                (new Lobby(game2)).Show();
            }
            else
            {
                MessageBox.Show("Unable to join game!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public void UpdateCurrentGame()
        {
            Game gameEntity = client.ChooseGame(Game.Name, true);

            Game = gameEntity;
        }