示例#1
0
        public TextBlock(string t, int tab = 0, int width = 118)
        {
            // int tab is how far forward the first line will be relative to body.  If negative, then the tabe will start at zero and the rest of the body will be indented
            int upper = 0;
            int lower = 0;

            if (tab > 0)
            {
                upper = tab;
            }
            if (tab < 0)
            {
                lower = -tab;
            }
            if (upper > Display.MaxWidth - 1)
            {
                upper = Display.MaxWidth - 1;
            }
            if (lower > Display.MaxWidth - 1)
            {
                upper = Display.MaxWidth - 1;
            }
            List <string> output;

            Choke.Wrap(t, out output, width, upper, lower);
            text = output;
        }
示例#2
0
        static public void DisplayFull()
        {
            Console.Clear();
            DisplayTitle();
            Location room = Location.CurrentRoom;

            brightness = Player.lightsOn.Count + room.lightSources.Count;
            ConsoleColor fg;
            ConsoleColor bg = ConsoleColor.Black;

            if (brightness <= 0)
            {
                fg = (ConsoleColor)0;
            }
            else if (brightness == 1)
            {
                fg = (ConsoleColor)6;
            }
            else
            {
                fg = (ConsoleColor)14;
            }
            TextBlock roomDescription = new TextBlock(roomText, -3);
            TextBlock itemsText       = new TextBlock(Choke.ListItems("The Room", room.obviousItems, true, true, false), -3);
            TextBlock inventoryText   = new TextBlock(Choke.ListItems("Your Inventory", Player.inventory, true, true, false), -3);
            TextBlock exitsText       = new TextBlock(Choke.ListItems("The Room", room.knownExits, true, false, true), -3);
            int       height          = itemsText.Count + inventoryText.Count + exitsText.Count + 4;

            Console.WriteLine("");
            roomDescription.Output(fg, ConsoleColor.Black);
            Console.WriteLine("\n");
            if (brightness <= 0)
            {
                fg = (ConsoleColor)0;
            }
            else if (brightness == 1)
            {
                fg = (ConsoleColor)8;
            }
            else
            {
                fg = (ConsoleColor)7;
            }
            itemsText.Output(fg, ConsoleColor.Black);
            Console.WriteLine("\n");
            inventoryText.Output(fg, ConsoleColor.Black);
            Console.WriteLine(new String('\n', roomHeight - height));
            if (brightness <= 0)
            {
                fg = (ConsoleColor)8;
            }
            exitsText.Output(fg, ConsoleColor.Black);
            Console.WriteLine("");
        }
 public static void Inventory() // example of method
 {
     Console.WriteLine(Choke.ListItems("Your inventory", Player.inventory));
     if (Player.inventory.Count == 0)
     {
         Console.WriteLine("You aren't carrying anything.");
     }
     else
     {
         Console.WriteLine("You are carrying the following items:");
         foreach (string s in Player.inventory)
         {
             Console.WriteLine(Item.byName[s].commonDescription);
         }
     }
     Console.WriteLine($"Captacity {Player.carryCapacity}");
 }