Exemplo n.º 1
0
 private void ReportLoadSuccess()
 {
     Eraser.ClearConsole();
     Console.WriteLine("Player Loaded press enter to continue");
     Console.ReadLine();
     Eraser.ClearConsole();
 }
Exemplo n.º 2
0
        private void PrintRules()
        {
            Console.WriteLine("the year is 1647 and a scurvy endemic has broken out in your local pirate town. You, a new entrepreneur with a fresh idea, decide to combat this endemic with a new invention, Orangeade!\nThe people you sell to will have their own preferences to the flavor of your orangeade\nYou can adjust the recipie of your orangeade by adjusting the ingredients. \nYour orangeade is created from ingredients that you can purchase before the day begins, if you run out of ingredients during the day, you will not be able to sell more drinks. \nBe carefull when purchasing items however, as they have a shelf life and can expire. (more details can be found in the shop menu) \nWeather will impact the amount of customers and their desire to buy. (More info can be found in the day preparation menu)\nThe goal of the game is to make as much profit as possible during the time alotted.\n press enter to continue");
            Console.ReadLine();
            Eraser.ClearConsole();
            RunMenu();

            return;
        }
Exemplo n.º 3
0
 private void PlayGame()
 {
     while (dayCounter <= startGameMenu.NumberOfDays)
     {
         prediction = new Weather();
         foreach (Player player in players)
         {
             player.prediction = this.prediction;
             player.RunTurnMenu();
             Eraser.ClearConsole();
         }
         StartNextDay();
         foreach (Player player in players)
         {
             ResetDay(player);
             StartCustomers(player);
             LogDayResults(player);
         }
         Console.ReadLine();
         Eraser.ClearConsole();
     }
     EndGame();
 }
Exemplo n.º 4
0
        private Player LoadPlayer(int playerNumber)
        {
            Eraser.ClearConsole();

            string username = GetLoadInfo("Username");

            string password = GetLoadInfo("Password");

            using (sqlconn)
                try
                {
                    sqlconn.Open();
                    SqlCommand    cmd    = new SqlCommand($"SELECT * FROM SaveDATA WHERE UserName = '******' AND Pass = '******'", sqlconn);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        player = GenerateLoadedPlayer(reader, playerNumber);
                    }
                    sqlconn.Close();
                    if (player == null)
                    {
                        ReportLoadFailure();
                        player = new Player(playerNumber.ToString());
                        return(player);
                    }
                    ReportLoadSuccess();
                    return(player);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    sqlconn.Close();
                    ReportLoadFailure();
                    player = new Player(playerNumber.ToString());
                    return(player);
                }
        }
Exemplo n.º 5
0
 private void ReportLoadFailure()
 {
     Console.WriteLine("Player not Found. New player will be created press enter to continue");
     Console.ReadLine();
     Eraser.ClearConsole();
 }