Esempio n. 1
0
        private void tileSet_CB_SelectedIndexChanged(object sender, EventArgs e)
        {
            TileSet selectedTileSet = (TileSet)tileSet_CB.SelectedItem;

            if (IsRawSelected())
            {
                ClearListView();
                ItemListView.BeginUpdate();
                TilesetCategory tsc = selectedTileSet.getCategory2(TilesetCategoryType.TILESET_RAW);
                foreach (Brush brush in tsc.brushlist)
                {
                    ItemListView.Items.Add(CreateListViewItem(brush));
                }
                ItemListView.EndUpdate();
            }
            else if (IsDoodadSelected())
            {
                brushListItems.Controls.Clear();
                brushListItems.Visible = false;
                TilesetCategory tsc = selectedTileSet.getCategory2(TilesetCategoryType.TILESET_DOODAD);
                foreach (Brush brush in tsc.brushlist)
                {
                    CreateBrushPanel(brush);
                }
                brushListItems.Visible = true;
            }
            else if (IsItemSelected())
            {
                ClearListView();
                ItemListView.BeginUpdate();
                TilesetCategory tsc = selectedTileSet.getCategory2(TilesetCategoryType.TILESET_ITEM);
                foreach (Brush brush in tsc.brushlist)
                {
                    ItemListView.Items.Add(CreateListViewItem(brush));
                }
                ItemListView.EndUpdate();
            }
            else if (IsCreatureSelected())
            {
                ClearListView();
                ItemListView.BeginUpdate();
                TilesetCategory tsc = selectedTileSet.getCategory2(TilesetCategoryType.TILESET_CREATURE);
                foreach (Brush brush in tsc.brushlist)
                {
                    ItemListView.Items.Add(CreateListViewItem(brush));
                }
                ItemListView.EndUpdate();
            }
            else if (IsTerrainSelected())
            {
                brushListItems.Controls.Clear();
                brushListItems.Visible = false;
                TilesetCategory tsc = selectedTileSet.getCategory2(TilesetCategoryType.TILESET_TERRAIN);
                foreach (Brush brush in tsc.brushlist)
                {
                    CreateBrushPanel(brush);
                }
                brushListItems.Visible = true;
            }
        }
Esempio n. 2
0
        public static void JumpToBrush()
        {
            FindItemForm form = new FindItemForm();

            form.Text = "Jump to Brush";
            List <Brush> listBrush = new List <Brush>();

            foreach (TileSet tileSet in Materials.getInstance().getTileSetList())
            {
                TilesetCategory terrainTC = tileSet.getCategory2(TilesetCategoryType.TILESET_TERRAIN);
                if (terrainTC != null)
                {
                    listBrush.AddRange(terrainTC.brushlist);
                }
                TilesetCategory doodadTC = tileSet.getCategory2(TilesetCategoryType.TILESET_DOODAD);
                if (doodadTC != null)
                {
                    listBrush.AddRange(doodadTC.brushlist);
                }

                TilesetCategory itemTc = tileSet.getCategory2(TilesetCategoryType.TILESET_ITEM);
                if (itemTc != null)
                {
                    listBrush.AddRange(itemTc.brushlist);
                }

                TilesetCategory creatureTc = tileSet.getCategory2(TilesetCategoryType.TILESET_CREATURE);
                if (creatureTc != null)
                {
                    listBrush.AddRange(creatureTc.brushlist);
                }
            }
            form.setBrushList(listBrush);
            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                Global.mapCanvas.SelectBrush(form.getSelectedBrush());
            }
        }
Esempio n. 3
0
        public static void JumpToItem()
        {
            FindItemForm form = new FindItemForm();

            form.Text = "Jump to Item";
            List <Brush> listBrush = new List <Brush>();

            foreach (TileSet tileSet in Materials.getInstance().getTileSetList())
            {
                TilesetCategory rawTc = tileSet.getCategory2(TilesetCategoryType.TILESET_RAW);
                if (rawTc != null)
                {
                    listBrush.AddRange(rawTc.brushlist);
                }
            }
            form.setBrushList(listBrush);
            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                EditorPalette.SelectBrush(form.getSelectedBrush(), PaletteType.RAW);
            }
        }
Esempio n. 4
0
        private bool SelectBrushInternal(Brush brush, PaletteType palette)
        {
            paletteType_CB.SelectedIndex = getPaletteType_CBIndex(palette);
            foreach (var item in tileSet_CB.Items)
            {
                TileSet tileset = (TileSet)item;

                TilesetCategory category = null;

                switch (palette)
                {
                case PaletteType.TERRAIN:
                    category = tileset.getCategory(TilesetCategoryType.TILESET_TERRAIN);
                    break;

                case PaletteType.DOODAD:
                    category = tileset.getCategory(TilesetCategoryType.TILESET_DOODAD);
                    break;

                case PaletteType.RAW:
                    category = tileset.getCategory(TilesetCategoryType.TILESET_RAW);
                    break;

                case PaletteType.ITEM:
                    category = tileset.getCategory(TilesetCategoryType.TILESET_ITEM);
                    break;

                case PaletteType.CREATURE:
                    category = tileset.getCategory(TilesetCategoryType.TILESET_CREATURE);
                    break;
                }

                foreach (Brush ibrush in category.brushlist)
                {
                    if (ibrush.Equals(brush))
                    {
                        tileSet_CB.SelectedItem = item;
                        if (panelEditor.Controls.Contains(brushListItems))
                        {
                            foreach (Control control in brushListItems.Controls)
                            {
                                if (control.Tag.Equals(brush))
                                {
                                    Panel panel = (Panel)control;
                                    brushClick(panel, null);
                                    return(true);
                                }
                            }
                        }
                        else if (panelEditor.Controls.Contains(ItemListView))
                        {
                            foreach (ListViewItem lvitem in ItemListView.Items)
                            {
                                if (lvitem.Tag.Equals(brush))
                                {
                                    lvitem.Selected = true;
                                    lvitem.Focused  = true;
                                    ItemListView.Select();
                                    ItemListView.EnsureVisible(lvitem.Index);
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }