Пример #1
0
        private void DrawKeybindings()
        {
            this.DrawSeparator(0, "-", DefaultForeground);

            var locations = WorldManager.GetWorldAreaLocations <Overworld>(Game.GameSession.Player.CurrentArea);

            List <IIndexable> bindable = new List <IIndexable>();

            foreach (var location in locations)
            {
                if (location != null)
                {
                    bindable.Add((IIndexable)location);
                }
            }

            IndexedKeybindings = IndexedKeybindingsManager.CreateIndexedKeybindings <IIndexedKeybinding>(bindable);
            PrintContainerBase printable = new PrintContainerBase(IndexedKeybindings, PrintContainerBase.ListType.Locations);

            printable.SetPrintingOffsets(1, 1, Width - 10);

            printable.Print(this);

            this.DrawSeparator(Height - 1, "-", DefaultForeground);
        }
        private void DrawKeybindings()
        {
            this.DrawRectangle(0, 0, Width, Height - 1, "+", "-", "|");

            var equipped = InventoryManager.GetEquippedItems <PlayerInventory>();
            List <IIndexable> bindable = new List <IIndexable>();

            foreach (var item in equipped)
            {
                if (item is null)
                {
                    continue;
                }
                else
                {
                    bindable.Add((IIndexable)item);
                }
            }

            IndexedKeybindings = IndexedKeybindingsManager.CreateIndexedKeybindings <IIndexedKeybinding>(bindable);

            PrintContainerBase printable = new PrintContainerBase(IndexedKeybindings, PrintContainerBase.ListType.Equipped);

            printable.RawSetPrintingOffsets(2, 1, 0, 14, 4);

            printable.Print(this);
        }
Пример #3
0
        private void DrawAreas()
        {
            this.DrawHeader(0, $"  Explore the areas around you  ", Constants.Theme.HeaderForegroundColor, Constants.Theme.HeaderBackgroundColor);

            var areas = WorldManager.GetWorldAreas <IArea>(Game.GameSession.Player.CurrentWorld.Name);
            // Initialize keybindings.
            List <IIndexable> bindable = new List <IIndexable>();

            // Todo: add checks if player's level is high enough. (not here)
            // Todo: automate the foreach loop for initializing keybindings?
            foreach (var area in areas)
            {
                if (area != null)
                {
                    bindable.Add((IIndexable)area);
                }
            }
            // Todo: automate this too?
            IndexedKeybindings = IndexedKeybindingsManager.CreateIndexedKeybindings <IIndexedKeybinding>(bindable);
            PrintContainerBase printable = new PrintContainerBase(IndexedKeybindings, PrintContainerBase.ListType.Areas);

            printable.SetPrintingOffsets(0, 4, 15);

            printable.Print(this);

            /*
             * int _x = 0;
             * int _y = 3;
             *
             * foreach(var area in world.Areas)
             * {
             *  Print(_x, _y++, $"areaId_{area.Key} | {area.Value.ObjectId} Area name: {area.Value.Name}");
             *  foreach(var loc in area.Value.Locations)
             *  {
             *      Print(_x, _y++, $"{loc.Value.ObjectId} {loc.Value.Name}");
             *  }
             * }
             *
             * /*
             * foreach(var area in areas)
             * {
             *  foreach (var loc in area.Locations)
             *  {
             *      Print(_x, _y++, $"areaId_{loc.Key} | Area name: {area.Name} | locId_{loc.Value.ObjectId} | Loc name: {loc.Value.Name} | lvl: {loc.Value.Level}");
             *  }
             * }*/
        }
Пример #4
0
        private void DrawInventory()
        {
            this.DrawHeader(0, $"  {Game.GameSession.Player.Name}'s inventory overview ", Constants.Theme.HeaderForegroundColor, Constants.Theme.HeaderBackgroundColor);

            var inventory = InventoryManager.GetSlots <PlayerInventory>();
            List <IIndexable> bindable = new List <IIndexable>(); // to be used for instantiating indexes and objectid reference

            foreach (var slot in inventory)
            {
                if (!slot.Item.Any())
                {
                    continue;
                }
                else
                if (slot.Item != null)
                {
                    {
                        if (slot.Item.Any <IItem>(i => i.IsUnique))
                        {
                            bindable.Add((IIndexable)slot);
                        }
                        else
                        {
                            bindable.Add((IIndexable)slot);
                        }
                    }
                }
            }

            IndexedKeybindings = IndexedKeybindingsManager.CreateIndexedKeybindings <IIndexedKeybinding>(bindable);
            PrintContainerBase printable = new PrintContainerBase(IndexedKeybindings, PrintContainerBase.ListType.Inventory);

            printable.SetPrintingOffsets(X_OFFSET, Y_OFFSET, TYPE_OFFSET);

            printable.Print(this);
        }