Beispiel #1
0
 public MultiPlayerGame(IMultiPlayerViewModel vm, Window parent)
 {
     InitializeComponent();
     this.vm                      = vm;
     this.parent                  = parent;
     this.DataContext             = this.vm;
     this.KeyDown                += this.GameSurface_KeyDown;
     this.vm.OnGameStatusChanged += this.OnStatusChanged;
 }
Beispiel #2
0
        private void btn_join_Click(object sender, RoutedEventArgs e)
        {
            IMultiPlayerViewModel vm = this.multi_vm.JoinGame();

            //while(vm.Status == 0) { }

            if (vm == null || vm.Status == 2)
            {
                MessageBox.Show("Could not join game!");
                return;
            }

            Window next = new MultiPlayerGame(vm, this.parent);

            next.Show();
            this.parent = null;
            this.Close();
        }
Beispiel #3
0
        private void btn_startgame_Click(object sender, RoutedEventArgs e)
        {
            this.multi_vm.MazeName    = this.game_properties.txt_gamename.Text;
            this.multi_vm.MazeRowsStr = this.game_properties.txt_rows.Text;
            this.multi_vm.MazeColsStr = this.game_properties.txt_cols.Text;

            IMultiPlayerViewModel vm = this.multi_vm.StartGame();

            if (vm == null)
            {
                MessageBox.Show("Invalid input!");
                return;
            }

            Window next = new MultiPlayerGame(vm, this.parent);

            next.Show();
            this.parent = null;
            this.Close();
        }