Esempio n. 1
0
        private void InitializeControls()
        {
            removeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 16),
                Text     = "[R] Remove from Library"
            };
            removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty);
            Add(removeSpellButton);

            editSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 13),
                Text     = "[E] Edit Spell"
            };
            editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty);
            Add(editSpellButton);

            spellDetails = new SpellDetailsControl(57, Height - 10)
            {
                Position = new Point(Width - 58, 3)
            };
            Add(spellDetails);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var scrollBar = new ScrollBar(Orientation.Vertical, Height - 6)
            {
                Position = new Point(Width - 60, 5),
                Theme    = scrollBarTheme
            };

            Add(scrollBar);
            spellsList = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 6, scrollBar)
            {
                Position = new Point(1, 5)
            };
            spellsList.SelectionChanged += spellsListBox_SelectedItemChanged;
            Add(spellsList);

            var textBoxTheme = new TextBoxTheme
            {
                Normal  = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)),
                Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255))
            };

            filterTextBox = new TextBox(Width - 69)
            {
                Position  = new Point(10, 3),
                Theme     = textBoxTheme,
                MaxLength = Width - 70
            };
            Add(filterTextBox);

            UpdateSpellDetails();
        }
Esempio n. 2
0
        public void Initialize()
        {
            closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            editSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 13),
                Text     = "[E] Edit Spell"
            };
            editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty);
            Add(editSpellButton);

            castSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 16),
                Text     = "[C] Cast Spell"
            };
            castSpellButton.Click += (sender, args) => CastSpell?.Invoke(this, EventArgs.Empty);
            Add(castSpellButton);

            removeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 19),
                Text     = "[R] Remove Spell"
            };
            removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty);
            Add(removeSpellButton);

            scribeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 22),
                Text     = "[G] Write Scroll"
            };
            scribeSpellButton.Click += (sender, args) => ScribeSpell?.Invoke(this, EventArgs.Empty);
            Add(scribeSpellButton);

            saveToLibraryButton = new StandardButton(25)
            {
                Position = new Point(Width - 30, 16),
                Text     = "[T] Save to Library"
            };
            saveToLibraryButton.Click += (sender, args) => SaveToLibrary?.Invoke(this, EventArgs.Empty);
            Add(saveToLibraryButton);

            loadFromLibraryButton = new StandardButton(25)
            {
                Position = new Point(Width - 30, 13),
                Text     = "[L] Load from Library"
            };
            loadFromLibraryButton.Click += (sender, args) => LoadFromLibrary?.Invoke(this, EventArgs.Empty);
            Add(loadFromLibraryButton);

            spellDetails = new SpellDetailsControl(57, Height - 10, PlayerMana)
            {
                Position = new Point(Width - 58, 3)
            };
            Add(spellDetails);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var scrollBar = new ScrollBar(Orientation.Vertical, Height - 4)
            {
                Position = new Point(Width - 60, 3),
                Theme    = scrollBarTheme
            };

            Add(scrollBar);
            spellsListBox = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 4, scrollBar)
            {
                Position = new Point(1, 3)
            };
            spellsListBox.SelectionChanged += spellsListBox_SelectedItemChanged;
            Add(spellsListBox);

            RefreshSpells();

            UpdateSpellDetails();
        }
Esempio n. 3
0
        private void InitializeControls()
        {
            closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            itemDetails = new ItemDetailsControl(52, Height - 10, Player)
            {
                Position = new Point(Width - 53, 3)
            };
            Add(itemDetails);

            filterAllButton = new StandardButton(5)
            {
                Position      = new Point(2, 3),
                DisabledColor = Color.Blue,
                Text          = "All"
            };
            filterAllButton.Click += (sender, args) => ChangeFilter(FilterType.All);
            Add(filterAllButton);

            filterWeaponButton = new StandardButton(5)
            {
                Position      = new Point(7, 3),
                DisabledColor = Color.Blue,
                Text          = "─┼ ".ConvertGlyphs()
            };
            filterWeaponButton.Click += (sender, args) => ChangeFilter(FilterType.Weapon);
            Add(filterWeaponButton);

            filterArmorButton = new StandardButton(5)
            {
                Position      = new Point(12, 3),
                DisabledColor = Color.Blue,
                Text          = "╭█╮".ConvertGlyphs()
            };
            filterArmorButton.Click += (sender, args) => ChangeFilter(FilterType.Armor);
            Add(filterArmorButton);

            filterUsableButton = new StandardButton(5)
            {
                Position      = new Point(17, 3),
                DisabledColor = Color.Blue,
                Text          = " ▲ ".ConvertGlyphs()
            };
            filterUsableButton.Click += (sender, args) => ChangeFilter(FilterType.Usable);
            Add(filterUsableButton);

            filterOtherButton = new StandardButton(5)
            {
                Position      = new Point(22, 3),
                DisabledColor = Color.Blue,
                Text          = " ? ".ConvertGlyphs()
            };
            filterOtherButton.Click += (sender, args) => ChangeFilter(FilterType.Other);
            Add(filterOtherButton);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var itemListScroll = new ScrollBar(Orientation.Vertical, Height - 4)
            {
                Position = new Point(Width - 55, 6),
                Theme    = scrollBarTheme,
                CanFocus = false
            };

            Add(itemListScroll);
            itemsList = new CustomListBox <InventoryStackItem>(Width - 56, Height - 4, itemListScroll)
            {
                Position = new Point(1, 6)
            };
            itemsList.SelectionChanged += itemsListBox_SelectedItemChanged;
            Add(itemsList);

            RefreshFilterButtonsState();
        }