コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(nomEquipeVerte.Text) || string.IsNullOrEmpty(nomEquipeRouge.Text) ||
                lbQueteRouge.Items.Count == 0 || lbQueteVerte.Items.Count == 0)
            {
                return;
            }
            List <Personnage> liste = new List <Personnage>();

            for (int i = 0; i < cbJoueurRouge.SelectedIndex + 1; i++)
            {
                liste.Add(RTeam[i]);
                Parametres.em.Attach(RTeam[i]);
            }

            List <Personnage> liste2 = new List <Personnage>();

            for (int i = 0; i < cbJoueurVerte.SelectedIndex + 1; i++)
            {
                liste2.Add(GTeam[i]);

                Parametres.em.Attach(GTeam[i]);
            }

            List <string> liste3 = new List <string>();

            foreach (string i in lbQueteRouge.Items)
            {
                liste3.Add(i.ToString());
            }
            List <string> liste4 = new List <string>();

            foreach (string i in lbQueteVerte.Items)
            {
                liste4.Add(i.ToString());
            }

            MapType type;

            if (radioMaraudeur.IsChecked.Value)
            {
                type = MapType.labyrinthe;
            }
            else if (RadioEtage.IsChecked.Value)
            {
                type = MapType.portoloin;
            }
            else
            {
                type = MapType.standard;
            }

            ConfigurationGame conf = new ConfigurationGame(nomEquipeRouge.Text, nomEquipeVerte.Text,
                                                           liste, liste2, liste3, liste4, type);
            //MapGame game = new MapGame(conf);
            MapFinale game = new MapFinale(conf);

            game.ShowDialog();
            this.Close();
        }
コード例 #2
0
        public GameBackgroundWorker(GameSimulation game, MapFinale map)
        {
            this.game                         = game;
            this.map                          = map;
            worker.DoWork                    += worker_DoWork;
            worker.RunWorkerCompleted        += worker_RunWorkerCompleted;
            worker.WorkerReportsProgress      = true;
            worker.ProgressChanged           += new ProgressChangedEventHandler(worker_ReportProgress);
            worker.WorkerSupportsCancellation = true;

            worker.RunWorkerAsync();
        }
コード例 #3
0
        public GameBackgroundWorker(GameSimulation game, MapFinale map)
        {
            this.game = game;
            this.map = map;
            worker.DoWork += worker_DoWork;
            worker.RunWorkerCompleted += worker_RunWorkerCompleted;
            worker.WorkerReportsProgress = true;
            worker.ProgressChanged += new ProgressChangedEventHandler(worker_ReportProgress);
            worker.WorkerSupportsCancellation = true;

            worker.RunWorkerAsync();
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(nomEquipeVerte.Text) || string.IsNullOrEmpty(nomEquipeRouge.Text)
                || lbQueteRouge.Items.Count == 0 || lbQueteVerte.Items.Count == 0)
                return;
            List<Personnage> liste = new List<Personnage>();
            for (int i = 0; i < cbJoueurRouge.SelectedIndex + 1; i++)
            {
                liste.Add(RTeam[i]);
                Parametres.em.Attach(RTeam[i]);
            }

            List<Personnage> liste2 = new List<Personnage>();
            for (int i = 0; i < cbJoueurVerte.SelectedIndex + 1; i++)
            {
                liste2.Add(GTeam[i]);

                Parametres.em.Attach(GTeam[i]);
            }

            List<string> liste3 = new List<string>();
            foreach (string i in lbQueteRouge.Items)
                liste3.Add(i.ToString());
            List<string> liste4 = new List<string>();
            foreach (string i in lbQueteVerte.Items)
                liste4.Add(i.ToString());

            MapType type ;
            if (radioMaraudeur.IsChecked.Value)
                type = MapType.labyrinthe;
            else if (RadioEtage.IsChecked.Value)
                type = MapType.portoloin;
            else
                type = MapType.standard;

            ConfigurationGame conf = new ConfigurationGame(nomEquipeRouge.Text, nomEquipeVerte.Text,
                    liste, liste2, liste3, liste4, type);
            //MapGame game = new MapGame(conf);
            MapFinale game = new MapFinale(conf);
            game.ShowDialog();
            this.Close();
        }