public Pages CreateNewData() { Console.Clear(); FreeStringBundle fSB = new FreeStringBundle(21); fSB.AddFreeString("Hello Advanturer"); fSB.AddFreeString("What is your name?"); BoundaryBox box = new BoundaryBox(20, new XYPair(24, 7)); box.Print(); fSB.Print(); Console.SetCursorPosition(Console.WindowWidth / 2 - 5, Console.CursorTop + 2); string playerName = Console.ReadLine(); Console.Clear(); fSB.ClearContent(); fSB.AddFreeString($"Ok, {playerName}"); fSB.AddFreeString("What is your gender?"); XYPair bgSize = new XYPair(24, 7); Menu menu = new Menu(24); menu.AddItem(new MenuItem("Male", Alignment.Centered)); menu.AddItem(new MenuItem("Female", Alignment.Centered)); menu.SetEntryPoint(0); box.Print(); fSB.Print(); Gender playerGender = menu.EnterMenuLoop() == 0 ? Gender.Male : Gender.Female; box.Print(); fSB.Print(); Console.SetCursorPosition(Console.WindowWidth / 2 - 5, Console.CursorTop + 1); string gender = playerGender.ToString(); objH.player = new Player(playerName, playerGender, ref objH); objH.player.money = 50000; Console.Clear(); bgSize = new XYPair(35, 5); box.SetSize(bgSize); fSB.ClearContent(); fSB.AddFreeString($"Your Name is {playerName}"); fSB.AddFreeString($"Your Gender is {gender}"); fSB.AddFreeString($"Press Enter to find your home"); box.Print(); fSB.Print(); Console.ReadLine(); objH.GenerateNewData(); return(Pages.Ship); }
public Pages Shop() { Console.Clear(); TitleBox titleBox = new TitleBox("SHOP"); titleBox.Print(); BoundaryBox welcomeBox = new BoundaryBox(25, new XYPair(50, 10), Alignment.Centered); FreeStringBundle welcomeMessage = new FreeStringBundle(26, edge + 40, 200); welcomeMessage.AddFreeString("Welcome, Dear Customer!", alignment: Alignment.LeftAligned); welcomeMessage.AddFreeString("What would you like to do today!", alignment: Alignment.LeftAligned); Menu buyOrSale = new Menu(29, menuStyle: BoxStyle.Limited, _alignment: Alignment.Centered, width: 5); buyOrSale.AddItem(new MenuItem("Buy", Alignment.Centered)); buyOrSale.AddItem(new MenuItem("Sale", Alignment.Centered)); buyOrSale.AddItem(new MenuItem("Exit", Alignment.Centered)); welcomeBox.Print(); welcomeMessage.Print(); buyOrSale.SetEntryPoint(0); int choice = buyOrSale.EnterMenuLoop(); switch (choice) { case 0: return(Pages.Buy); case 1: return(Pages.Sale); case 2: return(Pages.Ship); default: break; } return(Pages.Ship); }