Пример #1
0
        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));
        }
Пример #2
0
        public static RemoveSpell read(BinaryReader binaryReader)
        {
            RemoveSpell newObj = new RemoveSpell();

            newObj.i_spell_id = (SpellID)binaryReader.ReadUInt32();
            return(newObj);
        }
Пример #3
0
        public static RemoveSpell read(BinaryReader binaryReader)
        {
            RemoveSpell newObj = new RemoveSpell();

            newObj.isClientToServer = (binaryReader.BaseStream.Position == 12);
            newObj.i_spell_id       = binaryReader.ReadUInt32();
            return(newObj);
        }
Пример #4
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();
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
    public override bool acceptMessageData(BinaryReader messageDataReader, TreeView outputTreeView)
    {
        bool handled = true;

        PacketOpcode opcode = Util.readOpcode(messageDataReader);

        switch (opcode)
        {
        case PacketOpcode.Evt_Magic__PurgeEnchantments_ID:
        case PacketOpcode.Evt_Magic__PurgeBadEnchantments_ID: {
            EmptyMessage message = new EmptyMessage(opcode);
            message.contributeToTreeView(outputTreeView);
            ContextInfo.AddToList(new ContextInfo {
                    DataType = DataType.ServerToClientHeader
                });
            break;
        }

        case PacketOpcode.Evt_Magic__CastUntargetedSpell_ID: {
            CastUntargetedSpell message = CastUntargetedSpell.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__CastTargetedSpell_ID: {
            CastTargetedSpell message = CastTargetedSpell.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        // TODO: Evt_Magic__ResearchSpell_ID
        //case PacketOpcode.UPDATE_SPELL_EVENT: {
        //        UpdateSpell message = UpdateSpell.read(messageDataReader);
        //        message.contributeToTreeView(outputTreeView);
        //        break;
        //    }
        //case PacketOpcode.REMOVE_SPELL_EVENT: {
        //        RemoveSpell message = RemoveSpell.read(messageDataReader);
        //        message.contributeToTreeView(outputTreeView);
        //        break;
        //    }
        //case PacketOpcode.UPDATE_ENCHANTMENT_EVENT: {
        //        UpdateEnchantment message = UpdateEnchantment.read(messageDataReader);
        //        message.contributeToTreeView(outputTreeView);
        //        break;
        //    }
        //case PacketOpcode.REMOVE_ENCHANTMENT_EVENT: {
        //        RemoveEnchantment message = RemoveEnchantment.read(messageDataReader);
        //        message.contributeToTreeView(outputTreeView);
        //        break;
        //    }
        case PacketOpcode.Evt_Magic__RemoveSpell_ID:
        {
            RemoveSpell message = RemoveSpell.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__UpdateMultipleEnchantments_ID: {
            UpdateMultipleEnchantments message = UpdateMultipleEnchantments.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__RemoveMultipleEnchantments_ID: {
            RemoveMultipleEnchantments message = RemoveMultipleEnchantments.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__DispelEnchantment_ID: {
            DispelEnchantment message = DispelEnchantment.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__DispelMultipleEnchantments_ID: {
            DispelMultipleEnchantments message = DispelMultipleEnchantments.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__UpdateSpell_ID:
        {
            UpdateSpell message = UpdateSpell.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__UpdateEnchantment_ID:
        {
            UpdateEnchantment message = UpdateEnchantment.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Magic__RemoveEnchantment_ID:
        {
            RemoveEnchantment message = RemoveEnchantment.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        default: {
            handled = false;
            break;
        }
        }

        return(handled);
    }
Пример #7
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();
        }
Пример #8
0
 public void Remove()
 {
     RemoveSpell?.Invoke(this, EventArgs.Empty);
 }
 public static void OnRemoveSpell(int fairyPosition, int spellPosition, string name)
 {
     RemoveSpell?.Invoke(fairyPosition, spellPosition, name);
 }