/// <summary> /// The main father entrance for the application. /// We can define in the beginning of the application the Strategy(asc, desc, ascMt, descMt), Database type and GUI or TUI. /// Checks whether the user passed arguments to the console and initialize the application with the wanted data. /// </summary> /// <param name="args">The arguements that are being passed to the executeable through the console. </param> static void Main(string[] args) { ValidateConfigurationFile(); Log.Info($"##### Application started with Session ID => {SessionId} #####"); // Uncomment me if you want debugging console arguments, you can also use the project configurations. // NOTE: You'll also need to change output type in project configuration to console so debugging will work. //args = new[] { "/c", "/s-mt:1", "/db:mongo" }; if (args.Length > 0) { if (!ParseArgs(args)) { CloseCallback(CtrlType.CLOSE); return; } } BasePresenter.SetStrategyAndDatabaseType(_businessLogicType, _dbType, _sortType); if (_startGui) { Log.Info("Starting GUI..."); Gui.Show(); CloseCallback(CtrlType.CLOSE); } else { Log.Info("Starting TUI..."); Tui.Show(); } }
static void Main(string[] args) { Tui window = new Tui(); window.Title = " Chuck UI "; window.Body = "This is a dullscreen window"; window.DrawOk(); }
/// <summary> /// Entry point. /// </summary> public static void Main() { // Start MusicSharp. IPlayer player = new WinPlayer(); Tui gui = new Tui(player); gui.Start(); }
static void Main(string[] args) { Console.Title = "WinInfo"; var info = new Tui(); Console.Title = Console.Title + ": " + info.SystemName; Console.WriteLine(info.GetInfo()); Console.Write("Press any key to continue..."); Console.ReadKey(); }
private static void VictoryCondition() { // * This is opposite, because we check the last player move string charPlayer = player1 ? "O" : "X"; bool flagNewGame = false; Tui victory = new Tui(50, 10) { Title = "Game Over" }; if ( // * Top left Corner (Board[0, 0] == charPlayer && Board[0, 1] == charPlayer && Board[0, 2] == charPlayer) || //Horizontal top (Board[0, 0] == charPlayer && Board[1, 1] == charPlayer && Board[2, 2] == charPlayer) || //Diagonal top left ~ bottom right (Board[0, 0] == charPlayer && Board[1, 0] == charPlayer && Board[2, 0] == charPlayer) || //Vertical Left // * Middle left (Board[1, 0] == charPlayer && Board[1, 1] == charPlayer && Board[1, 2] == charPlayer) || //Horizontal middle // * Bottom left (Board[2, 0] == charPlayer && Board[2, 1] == charPlayer && Board[2, 2] == charPlayer) || //horizontal bottom (Board[2, 0] == charPlayer && Board[2, 1] == charPlayer && Board[2, 2] == charPlayer) || //Vertical Left (Board[2, 0] == charPlayer && Board[1, 1] == charPlayer && Board[0, 2] == charPlayer) || //Diagonal bottom left ~ top right // * Top middle (Board[0, 1] == charPlayer && Board[1, 1] == charPlayer && Board[2, 1] == charPlayer) || //Vertical middle // * Top right (Board[0, 2] == charPlayer && Board[1, 2] == charPlayer && Board[2, 2] == charPlayer) // Vertical right ) { flagNewGame = true; victory.Body = $"'{charPlayer}' Won! \n \n "; } else if ( // * Board Full, no winners Board[0, 0] != " " && Board[0, 1] != " " && Board[0, 2] != " " && Board[1, 0] != " " && Board[1, 1] != " " && Board[1, 2] != " " && Board[2, 0] != " " && Board[2, 1] != " " && Board[2, 2] != " ") { flagNewGame = true; victory.Body = "No winners! \n \n "; } if (flagNewGame) { victory.Body += $"Play Again?"; if (victory.DrawYesNo(Tui.ColorSchema.System, "Yes", "No", true)) { Board = BoardEmpty; numPlayer = 1; player1 = true; } else { Quit(); } } }
static void Main(string[] args) { Tui.Start(controllerConfig()); }
static void Main(string[] args) { // * Settings Tui.ColorSchema inputColor = Tui.ColorSchema.Info; Board = (string[, ])BoardEmpty.Clone(); Console.CursorVisible = false; Tui UserInput = new Tui(50, 10) { Title = "Player 1", Body = "Choose a Row:" }; Tui t = new Tui(50, 25) { Title = "Tic Tac Toe", Body = "Welcome to Tic Tac Toe! \n This is a game for 2 Players. \n Enjoy" }; t.DrawOk(); // * while (true) { VictoryCondition(); int numPlayer = (player1?1:2); UserInput.Title = $"Player {numPlayer}"; t.Body = BoardDraw; t.Draw(); int rowTmp = RowsToGoDown; for (int i = 0; i < 3; i++) { Console.SetCursorPosition(colsToGoRight, rowTmp); Console.Write($" {Board[i, 0]} | {Board[i, 1]} | {Board[i, 2]}"); rowTmp += 2; } int userRow = 0; string rowChar = UserInput.DrawList(new List <string> { "A", "B", "C" }, inputColor); //! This can be done in a more performatic way. But i find this more readable if (rowChar == "A") { userRow = 0; } if (rowChar == "B") { userRow = 1; } if (rowChar == "C") { userRow = 2; } UserInput.Body = "Choose a column:"; int userCol = Convert.ToInt32(UserInput.DrawList(new List <string> { "1", "2", "3" }, inputColor)) - 1; if (Board[userRow, userCol] == " ") { Board[userRow, userCol] = (player1) ? "X" : "O"; player1 = !player1; } } }