/// <summary> /// Writes a line in the box drawn using DrawBox(). /// </summary> /// <param name="str">The string to write into the box.</param> /// <param name="timeout">Time to wait between writing each character (default = 10).</param> public static void WriteLineToBox(string str, int timeout = 10) { Console.SetCursorPosition(3, CurLine); AenigmaUtils.SlowPrint(str, timeout); CurLine++; Console.SetCursorPosition(3, CurLine); }
public static void JumpToLevel(AenigmaLevel level) { // Do some sanity checking on the level. if (level == null) { throw new InvalidLevelException("Cannot load a null level."); } if (level.ID == Guid.Empty) { throw new InvalidLevelException("Cannot load a level with an empty GUID."); } if (string.IsNullOrEmpty(level.Data) || string.IsNullOrWhiteSpace(level.Data)) { throw new InvalidLevelException("Cannot load a level with no level data."); } CurrentLevel = level; // Reset the lives counter to 3. NumberOfLives = 3; // If this is the starting level, then increment the attempts counter and set the "last played" time. if (CurrentLevel.Password != null && CurrentLevel.Password.ToLower() == "start") { NumberOfAttempts++; AenigmaMenuUtils.LastPlayed = DateTime.UtcNow; } // Draw the level data. Console.Clear(); AenigmaUtils.SlowPrint(level.Data, 0); HandleLevel(CurrentLevel); }