Exemplo n.º 1
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            FormSelectionAventure fa = new FormSelectionAventure(this);
            fa.ShowDialog();
            if (fa.LivreSelectionne == null)
            {
                return;
            }
            LivreSelectionne = fa.LivreSelectionne;

            Moi = fa.Moi;
            if (fa.Connected)
            {
                ModeEnLigne = TypeModeEnLigne.Client;
                Serveur = fa.Sender;
            }
            else
            {
                ModeEnLigne = TypeModeEnLigne.Aucun;
                Serveur = null;
            }

            MonJeu = new Jeu(LivreSelectionne.Repertoire);
            MonJeu.ChangerParagraphe(LivreSelectionne.Repertoire + "\\Paragraphes\\1.xml");
            MettreAJour();
            Carte = new FormCarte(MonJeu);
            Rec = "";

            //Test de connexion
            try
            {
                TcpListener server = new TcpListener(GetLocalIPAdress(), 9050);
                server.Start();
                server.Stop();

                //Connexion réussie
                Thread listener = new Thread(new ThreadStart(LancerEcoute));
                listener.IsBackground = true;
                listener.Start();
            }
            catch
            {
                MessageBox.Show("Impossible d'initialiser le réseau. Le mode en-ligne a été désactiver. Pour le réactiver, vérifiez vos paramètres de pare-feu et relancez l'application.");
            }
        }
        private void bRecZone_Click(object sender, EventArgs e)
        {
            FormCarte Carte = new FormCarte(MonJeu);

            Carte.CaptureZone(RecZone);
            if (Carte.ZoneCapturee != Rectangle.Empty)
            {
                tbRecZone.Text = Carte.ZoneCapturee.ToString();
                RecZone = Carte.ZoneCapturee;
            }
        }
Exemplo n.º 3
0
 private void bCarte_Click(object sender, EventArgs e)
 {
     if (Carte.IsDisposed)
         Carte = new FormCarte(MonJeu);
     Carte.Show();
 }
        private void bPopCurseur_Click(object sender, EventArgs e)
        {
            FormCarte Carte = new FormCarte(MonJeu);

            Carte.CapturePoint(PopCurseur);
            if (Carte.PointCapturee != new Point(-50, -50))
            {
                tbPopCurseur.Text = Carte.PointCapturee.ToString();
                PopCurseur = Carte.PointCapturee;
            }
        }