/// <summary> /// /// </summary> /// <returns>Boolean corresponding to the success of the operation</returns> private bool MessageOutputLevel() { try { if (NumberOfPlayer == 2) { Level = new Level(1); Console.WriteLine("The first player will now choose a number : "); Level.MysteryNumber = CheckNumberEntered(Console.ReadLine()); } else { Console.WriteLine("Please choose your level now."); Console.WriteLine("Level 1 will be between 0 and 50."); Console.WriteLine("Level 2 will be between 0 and 100."); Console.WriteLine("Level 3 will be between -100 and 100."); Console.Write("Please enter the level you want : "); int numberLevel = CheckNumberEntered(Console.ReadLine()); while (numberLevel < 1 || numberLevel > 3) { Console.WriteLine("Error in the choice of level."); Console.Write("Please enter a level between 1 and 3 : "); numberLevel = CheckNumberEntered(Console.ReadLine()); } InitLevel(numberLevel); } Console.Clear(); } catch (Exception) { return false; } return true; }
/// <summary> /// /// </summary> /// <param name="_level"></param> /// <returns>Boolean corresponding to the success of the operation</returns> private bool InitLevel(int _level) { try { Level = new Level(_level); } catch (Exception) { return false; } return true; }