protected override bool ProcessKeyPressed(AsciiKey key) { switch (key.Key) { case Keys.R: RemoveSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.E: EditSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.Up: case Keys.W: MoveSelectionUp(); return(true); case Keys.Down: case Keys.S: MoveSelectionDown(); return(true); case Keys.Escape: OnExit(); return(true); } return(base.ProcessKeyPressed(key)); }
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(); }
protected override bool ProcessKeyPressed(AsciiKey key) { switch (key.Key) { case Keys.Escape: Exit?.Invoke(this, EventArgs.Empty); return(true); case Keys.E: EditSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.R: RemoveSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.C: CastSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.G: ScribeSpell?.Invoke(this, EventArgs.Empty); return(true); case Keys.T: SaveToLibrary?.Invoke(this, EventArgs.Empty); return(true); case Keys.L: LoadFromLibrary?.Invoke(this, EventArgs.Empty); return(true); case Keys.Up: case Keys.W: MoveSelectionUp(); return(true); case Keys.Down: case Keys.S: MoveSelectionDown(); return(true); default: return(false); } }
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(); }