private void showHelp() { Console.Clear(); ChangeConsoleColors.to_info_ForegroundColor(); ChangeConsoleColors.to_info_BackgroundColor(); Console.SetCursorPosition(0, 5); Console.Write("\tControls:\n"); Console.Write("\tUp: Rotate\n"); Console.Write("\tLeft: Move Left\n"); Console.Write("\tRight: Move Right\n"); Console.Write("\tDown: Move Down by three lines\n\n"); Console.Write("\tRules:\n"); Console.Write("\tJust try to fill up every row.\n" + "\tPoints are earned one by one by filling up every row.\n" + "\tLevel increased by earning every 5 Points.\n" + "\tThe falling Down speed of every shape will be increased\n" + "\twith the increment of Level\n"); Console.SetCursorPosition((Console.WindowWidth / 2) - 12, Console.CursorTop + 2); Console.Write("press any key to get back ......"); Console.ReadKey(); ChangeConsoleColors.to_Console_Default_BackgroundColor(); ChangeConsoleColors.to_Console_Default_ForegroundColor(); }
private void showCredits() { Console.Clear(); ChangeConsoleColors.to_info_BackgroundColor(); ChangeConsoleColors.to_info_ForegroundColor(); Console.SetCursorPosition(10, 5); Console.Write("Mohaimin Morsalin"); Console.SetCursorPosition(10, Console.CursorTop + 1); Console.Write("United International University (CSE 121)"); Console.SetCursorPosition(10, Console.CursorTop + 1); Console.Write("Dhaka, Bangladesh."); Console.SetCursorPosition(10, Console.CursorTop + 1); Console.Write("Email: [email protected]"); Console.SetCursorPosition((Console.WindowWidth / 2) - 12, Console.CursorTop + 2); Console.Write("press any key to get back ......"); Console.ReadKey(); ChangeConsoleColors.to_Console_Default_BackgroundColor(); ChangeConsoleColors.to_Console_Default_ForegroundColor(); }
/// <summary> /// invalidInputMessage(int, int) a function to show/display the warning after invalid input in console screen. /// /// parameters: /// left: indicating the left posotion of the console window. /// top: indicating the top posotion of the console window. /// </summary> private void invalidInputMessage(int left, int top) { Console.Clear(); ChangeConsoleColors.to_error_ForegroundColor(); Console.SetCursorPosition(left, top); Console.WriteLine("{0} is not a valid input!!!", input.KeyChar); ChangeConsoleColors.to_Console_Default_ForegroundColor(); }
/// <summary> /// showNavigator(int, int) a function to show/display the navigator in console screen. /// /// parameters: /// left: indicating the left posotion of the console window. /// top: indicating the top posotion of the console window. /// </summary> private void showNavigator(int left, int top) { ChangeConsoleColors.to_Navigator_ForegroundColor(); Console.SetCursorPosition(left, top); Console.Write("->"); Console.SetCursorPosition(left - 1, top); ChangeConsoleColors.to_Console_Default_ForegroundColor(); }
/// <summary> /// adjustConsole() function will adjust and manage the console screen /// such as foreground background color, window size, cursor visibility /// </summary> private static void adjustConsole() { Console.Title = "Tetris Game"; ChangeConsoleColors.to_Console_Default_BackgroundColor(); ChangeConsoleColors.to_Console_Default_ForegroundColor(); Console.SetWindowSize(80, 45); Console.CursorVisible = false; }
/// <summary> /// startGame() a function that will build bucket and sidebar, /// change the console foreground background color by calling the respective function. /// Then let user play the game by calling play() function. /// After playing it changes the score, level and console color to their initial value. /// </summary> public void startGame() { Bucket.buildBucket(); score = 0; level = 1; buildSidebar(); ChangeConsoleColors.to_Bucket_BackgroundColor(); ChangeConsoleColors.to_Bucket_ForegroundColor(); playGame(); ChangeConsoleColors.to_Console_Default_BackgroundColor(); ChangeConsoleColors.to_Console_Default_ForegroundColor(); }