Exemple #1
0
        public PlayerItemEditor(IReadOnlyList <Item> array, int width, int height)
        {
            InitializeComponent();
            Items = array;

            var items = GameInfo.Strings.itemlist.ToArray();

            var set = new HashSet <string>();

            for (int i = 0; i < items.Length; i++)
            {
                var item = items[i];
                if (string.IsNullOrEmpty(item))
                {
                    items[i] = $"(Item #{i:000})";
                }
                else if (set.Contains(item))
                {
                    items[i] += $" (#{i:000})";
                }
                else
                {
                    set.Add(item);
                }
            }

            var Editor = new ItemGridEditor(ItemEditor, Items, items)
            {
                Dock = DockStyle.Fill
            };

            Editor.InitializeGrid(width, height);
            PAN_Items.Controls.Add(Editor);

            ItemEditor.Initialize(items);
            Editor.LoadItems();
            DialogResult = DialogResult.Cancel;
            LoadItems    = () => Editor.LoadItems();
        }
        public PlayerItemEditor(IReadOnlyList <Item> array, int width, int height, bool sysbot = false)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            ItemArray = new ItemArrayEditor <Item>(array);

            var Editor = ItemGrid = new ItemGridEditor(ItemEditor, array)
            {
                Dock = DockStyle.Fill
            };

            Editor.InitializeGrid(width, height, 64, 64);
            PAN_Items.Controls.Add(Editor);

            ItemEditor.Initialize(GameInfo.Strings.ItemDataSource);
            Editor.LoadItems();
            DialogResult     = DialogResult.Cancel;
            LoadItems        = () => Editor.LoadItems();
            B_Inject.Visible = sysbot;

            EnableDragDrop(this, ItemEditor_DragEnter, PlayerItemEditor_DragDrop);
            EnableDragDrop(PAN_Items, ItemEditor_DragEnter, PlayerItemEditor_DragDrop);
            EnableDragDrop(ItemEditor, ItemEditor_DragEnter, PlayerItemEditor_DragDrop);
        }
 private void B_Save_Click(object sender, EventArgs e)
 {
     ItemEditor.SetItem(Item);
     DialogResult = DialogResult.OK;
     Close();
 }