Exemple #1
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}");
 }