示例#1
0
        public Pages TestPage()
        {
            Console.Clear();

            FreeStringList sh             = new FreeStringList();
            Menu           scrollableTest = new Menu(20, 20, 10, "Shop", width: 10, menuStyle: BoxStyle.Limited);
            BoundaryBox    box            = new BoundaryBox(new XYPair(19, 19), new XYPair(15, 12));

            for (int i = 0; i < 20; i++)
            {
                scrollableTest.AddItem(new MenuItem($"Shop Item {i}"));
            }


            objH.PrintImage(new XYPair(40, 5), "Pikachu");
            box.Print();
            int digits = scrollableTest.EnterMenuLoop();


            Numbers number = new Numbers(digits, new XYPair(40, 25));
            int     result = number.EnterMainLoop();


            StringRenderer.PrintFreeString(new FreeString(20, result.ToString()));
            Console.Read();

            return(Pages.TestPage);
        }
示例#2
0
        public Pages Buy()
        {
            Console.Clear();
            TitleBox titleBox = new TitleBox("Buy");

            titleBox.Print();

            BoundaryBox box = new BoundaryBox(25, edge, new XYPair(66, 20), Alignment.LeftAligned);

            box.Print();

            objH.PrintImage(new XYPair(edge + 68, 15), "ShopKeeper");

            Menu buyShop = new Menu(27, edge + 3, maxShown: 9, menuStyle: BoxStyle.Limited, width: 60);

            foreach (ShopItem item in objH.player.currentPlanet.supplyShop)
            {
                buyShop.AddItem(new MenuItem(Calc.GetShopDisplay(item)));
            }

            buyShop.SetEntryPoint(0);
            int selection = buyShop.EnterMenuLoop();

            FreeString wouldLiketoBuy = new FreeString(new XYPair(edge + 3, 38), "How many would you like to buy?");
            int        maxAmount      = objH.player.money / objH.player.currentPlanet.supplyShop[selection].GetPrice();
            Numbers    amount         = new Numbers(3, new XYPair(edge + 4, 40), maxAmount);

            wouldLiketoBuy.Print();
            int amountBought = amount.EnterMainLoop();

            objH.player.Buy(objH.player.currentPlanet.supplyShop[selection], amountBought);
            return(Pages.Shop);
        }
示例#3
0
        public Pages Inventory()
        {
            Console.Clear();
            TitleBox titleBox = new TitleBox("Inventory");

            titleBox.Print();

            BoundaryBox box = new BoundaryBox(10, edge, new XYPair(66, 35), Alignment.LeftAligned);

            box.Print();

            objH.PrintImage(new XYPair(edge + 68, 15), "Pikachu");

            Menu inventoryMenu = new Menu(27, edge + 3, maxShown: 20, menuStyle: BoxStyle.Limited, width: 60);

            foreach (InventoryItem item in objH.player.inventory)
            {
                inventoryMenu.AddItem(new MenuItem(Calc.GetInventoryDisplay(item)));
            }

            inventoryMenu.SetEntryPoint(0);
            int selection = inventoryMenu.EnterMenuLoop();

            return(Pages.Ship);
        }
示例#4
0
        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);
        }
示例#5
0
        public Pages Sale()
        {
            Console.Clear();
            TitleBox titleBox = new TitleBox("Sale");

            titleBox.Print();

            BoundaryBox box = new BoundaryBox(25, edge, new XYPair(66, 20), Alignment.LeftAligned);

            box.Print();

            objH.PrintImage(new XYPair(edge + 68, 15), "ShopKeeper");

            Menu            saleShop = new Menu(27, edge + 3, maxShown: 9, menuStyle: BoxStyle.Limited, width: 60);
            List <ShopItem> canSale  = new List <ShopItem>();

            foreach (ShopItem item in objH.player.currentPlanet.demandShop)
            {
                if (objH.player.inventory.Any(i => i.index == item.GetIndex()))
                {
                    canSale.Add(item);
                    saleShop.AddItem(new MenuItem(Calc.GetShopDisplay(item)));
                }
            }

            if (canSale.Count > 0)
            {
                saleShop.SetEntryPoint(0);
                int selection = saleShop.EnterMenuLoop();

                FreeString wouldLiketoSale = new FreeString(new XYPair(edge + 3, 38), "How many would you like to Sale?");
                int        maxAmount       = objH.player.inventory.FirstOrDefault(i => i.index == canSale[selection].GetIndex()).amount;
                Numbers    amount          = new Numbers(3, new XYPair(edge + 4, 40), maxAmount);
                wouldLiketoSale.Print();
                int amountSold = amount.EnterMainLoop();
                objH.player.Sale(canSale[selection], amountSold);
            }
            else
            {
                FreeString nothingToSale = new FreeString(new XYPair(edge + 10, 30), "You don't have anything to sale to this planet");
                nothingToSale.Print();
                Console.Read();
            }
            return(Pages.Shop);
        }
示例#6
0
        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);
        }
示例#7
0
        public Pages MainMenu()
        {
            Console.Clear();
            Menu menu = new Menu(36);

            menu.AddItem(new MenuItem("New Game", Alignment.Centered));
            menu.AddItem(new MenuItem("Load Data", Alignment.Centered));
            menu.AddItem(new MenuItem("Credit", Alignment.Centered));
            menu.AddItem(new MenuItem("Exit", Alignment.Centered));
            menu.SetEntryPoint(1);
            XYPair      bgSize = new XYPair(20, 6);
            BoundaryBox box    = new BoundaryBox(35, bgSize);

            box.Print();
            objH.PrintImage(new XYPair(35, 5), "Logo");

            int i = menu.EnterMenuLoop();

            switch (i)
            {
            case 0:
                return(Pages.NewCharacter);

            case 1:
                break;

            case 2:
                break;

            case 3:
                return(Pages.Exit);

            default:
                break;
            }

            return(Pages.MainMenu);
        }