示例#1
0
 public static void PrintFreeString(FreeString fs)
 {
     Console.SetCursorPosition(fs.GetStartingPoint().x, fs.GetStartingPoint().y);
     Console.BackgroundColor = fs.backgroundColor;
     Console.ForegroundColor = fs.textColor;
     Console.Write(fs.text);
 }
示例#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 void PrintGenerationInfo(string info)
        {
            Console.Clear();
            FreeString content = new FreeString(25, info);

            content.Print();
        }
示例#4
0
        internal Pages GameOver()
        {
            Console.Clear();
            FreeString content = new FreeString(25, "GameOver");

            objH.Ini();
            content.Print();

            Console.ReadLine();
            return(Pages.MainMenu);
        }
示例#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 TitleBox(string title)
 {
     content = new FreeString(2, title);
 }