/// <summary> /// Affiche le message et l'en-tête de l'écran principal /// </summary> /// <param name="partie">La partie en cour</param> public static void AfficherEcranPrincipal(Partie partie) { AfficherEnTete("Le Jeux du Pendu"); Console.WriteLine(" Speudo du joueur : {0}", partie.getSpeudo()); Console.WriteLine(" Mot trouvé : {0}", partie.getNbrMotTrouve()); Console.WriteLine(" Quantité d'erreur : {0}", partie.getNbrErreurTotal()); Console.WriteLine(); AfficherPendu(partie.getErreur()); AfficherCaseMot(partie.getMotJoueur()); if (partie.isPartieFini()) { string str; if (partie.isMotCorrect()) { Console.ForegroundColor = ConsoleColor.DarkGreen; str = "Félicitation ! Vous avez gagné !"; } else { Console.ForegroundColor = ConsoleColor.DarkRed; str = "Désolée mais vous avez perdu !"; } Console.Write(new string(' ', (Console.WindowWidth - str.Length) / 2)); Console.WriteLine(str); Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine(); }
static void Main(string[] args) { // Affichage l'introduction Affichage.AfficherIntroduction(); // Initialisation de la partie et saisie du speudo Partie partie = new Partie(Saisie.SaisieSpeudo()); bool rejouer = true; do { // Affichage de l'écran principale Affichage.AfficherEcranPrincipal(partie); // Affichage de la partie terminée if (partie.isPartieFini()) { rejouer = Saisie.SaisieRejouer(); partie.NouvellePartie(); } else { // Afficher la saisie d'un caractère partie.VerifierCaractere(Saisie.SaisieCaractere()); } } while (rejouer); Console.ReadKey(); }
public void answerTest(Char c) { try { if (game.getlistEchec().Contains(c) == true) { MessageBox.Show("Vous avez deja tester cette lettre"); return; } if (printWord.testLetter(hide_Word.getSecretArray(), c) == false) { game.addEchec(c); repaint(); } Affiche.Text = printWord.getWord(); lb_Echec.Text = game.getEchecList(); if (printWord.testWord(hide_Word.getSecretArray()) == true) { MessageBox.Show("Vous avez gagner!"); game = new Partie(); } } catch (Exception e) { MessageBox.Show("Erreur: " + e.Message); } }
public void initializeGame() { game = new Partie(); printWord = new printWord(hideWord); hide_Word = new FindAWord(hideWord); img1.BackgroundImage = null; Affiche.Text = printWord.getWord(); lb_Echec.Text = game.getEchecList(); }