Esempio n. 1
0
        /// <summary>
        /// Eveent que es dona quan el element seleccionat en el comboBox_Enemic ha canviat
        /// </summary>
        private void comboBox_enemic_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Player playerEnemic = gameController.getPlayerEnemic((sender as ComboBox).SelectedItem as string);

            if (playerEnemic != null)
            {
                celesEnemigues.Clear();
                foreach (Cela c in playerEnemic.panell)
                {
                    CelaControl control = new CelaControl();
                    control.CelaDelPanell = c;
                    celesEnemigues.Add(control);
                    control.Click += Cela_Clicked_Enemic;

                    Grid.SetColumn(control, c.Column);
                    Grid.SetRow(control, c.Row);
                    grid_enemic.Children.Add(control);
                }

                if (gameController.connectaClient(playerEnemic))
                {
                    actualitzaPanellEnemic();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Actualitza el panell d'usuari JugadorAmic
        /// </summary>
        private void actualitzaPanellAmic()
        {
            Player playerAmic = gameController.getPlayerAmic();

            if (playerAmic != null)
            {
                foreach (Cela c in playerAmic.panell)
                {
                    CelaControl control = new CelaControl();
                    c.Tocada = false;
                    control.CelaDelPanell = c;
                    celesAmigues.Add(control);
                    control.Click += Cela_Clicked_Amic;

                    Grid.SetColumn(control, c.Column);
                    Grid.SetRow(control, c.Row);
                    grid_amic.Children.Add(control);

                    label_nomJugadorAmic.Content = playerAmic.nom;
                }
            }
        }