Inheritance: IDisposable
Ejemplo n.º 1
0
        public MapEditor(MapFile file)
            : base(file)
        {
            map = file;
            this.tileset = map.TilesetFile[map.TilesetID];

            mapPanel = new MapPanel(map.Layers, tileset);
            mapPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(mapPanel);
            this.KeyPreview = true;
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(MapEditor_KeyDown);

            this.mapPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(mapPanel_MouseDown);
            this.mapPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(mapPanel_MouseMove);

            tilePanel = new TilePanel(tileset);
            tilePanel.TileSelected += new EventHandler<TilePanel.TileSelectedArgs>(tilePanel_TileSelected);
            tilePanel.Dock = System.Windows.Forms.DockStyle.Fill;

            toolstrip = new System.Windows.Forms.ToolStrip();
            toolstrip.Dock = System.Windows.Forms.DockStyle.Top;
            toolstrip.Stretch = true;
            toolstrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;

            buttonSelected = new System.Windows.Forms.ToolStripButton();
            buttonSelected.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.SizeToFit;
            buttonSelected.AutoSize = true;
            buttonSelected.Image = tileset[0];
            buttonSelected.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

            toolstrip.Items.Add(buttonSelected);
            toolstrip.Items.Add(new System.Windows.Forms.ToolStripSeparator());

            buttonLayers = new List<System.Windows.Forms.ToolStripButton>();
            for (int i = 0; i < this.map.Layers.Count; i++)
            {
                var laybtn = new System.Windows.Forms.ToolStripButton();
                laybtn.Text = string.Format("{0}", i + 1);
                laybtn.Tag = i;
                laybtn.Click += new EventHandler(laybtn_Click);
                if (this.map.Layers[i].Type == MapLayerType.HalfBlockShadow)
                {
                    laybtn.Text = "阴影";
                }
                toolstrip.Items.Add(laybtn);
                buttonLayers.Add(laybtn);
            }

            toolboxPanel = new System.Windows.Forms.Panel();
            this.toolboxPanel.Controls.Add(tilePanel);
            this.toolboxPanel.Controls.Add(toolstrip);
        }
Ejemplo n.º 2
0
        public MapEditor(MapFile file)
            : base(file)
        {
            map          = file;
            this.tileset = map.TilesetFile[map.TilesetID];

            mapPanel      = new MapPanel(map.Layers, tileset);
            mapPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(mapPanel);
            this.KeyPreview = true;
            this.KeyDown   += new System.Windows.Forms.KeyEventHandler(MapEditor_KeyDown);

            this.mapPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(mapPanel_MouseDown);
            this.mapPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(mapPanel_MouseMove);

            tilePanel = new TilePanel(tileset);
            tilePanel.TileSelected += new EventHandler <TilePanel.TileSelectedArgs>(tilePanel_TileSelected);
            tilePanel.Dock          = System.Windows.Forms.DockStyle.Fill;

            toolstrip           = new System.Windows.Forms.ToolStrip();
            toolstrip.Dock      = System.Windows.Forms.DockStyle.Top;
            toolstrip.Stretch   = true;
            toolstrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;

            buttonSelected = new System.Windows.Forms.ToolStripButton();
            buttonSelected.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.SizeToFit;
            buttonSelected.AutoSize     = true;
            buttonSelected.Image        = tileset[0];
            buttonSelected.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

            toolstrip.Items.Add(buttonSelected);
            toolstrip.Items.Add(new System.Windows.Forms.ToolStripSeparator());

            buttonLayers = new List <System.Windows.Forms.ToolStripButton>();
            for (int i = 0; i < this.map.Layers.Count; i++)
            {
                var laybtn = new System.Windows.Forms.ToolStripButton();
                laybtn.Text   = string.Format("{0}", i + 1);
                laybtn.Tag    = i;
                laybtn.Click += new EventHandler(laybtn_Click);
                if (this.map.Layers[i].Type == MapLayerType.HalfBlockShadow)
                {
                    laybtn.Text = "阴影";
                }
                toolstrip.Items.Add(laybtn);
                buttonLayers.Add(laybtn);
            }

            toolboxPanel = new System.Windows.Forms.Panel();
            this.toolboxPanel.Controls.Add(tilePanel);
            this.toolboxPanel.Controls.Add(toolstrip);
        }
Ejemplo n.º 3
0
        public MapPanelBase(List <MapLayer> layers, TilesetInfo tileset)
        {
            this.layers        = layers;
            this.layersVisible = new List <bool>();
            foreach (var item in this.layers)
            {
                this.layersVisible.Add(true);
            }

            this.tileset = tileset;
            this.mapSize = new System.Drawing.Size(layers[0].Data.GetLength(0), layers[0].Data.GetLength(1));
            this.Zoom    = 1.0f;
            this.Paint  += new System.Windows.Forms.PaintEventHandler(this_Paint);
        }
Ejemplo n.º 4
0
        public MapPanelBase(List<MapLayer> layers, TilesetInfo tileset)
        {
            this.layers = layers;
            this.layersVisible = new List<bool>();
            foreach (var item in this.layers)
            {
                this.layersVisible.Add(true);
            }

            this.tileset = tileset;
            this.mapSize = new System.Drawing.Size(layers[0].Data.GetLength(0), layers[0].Data.GetLength(1));
            this.Zoom = 1.0f;
            this.Paint += new System.Windows.Forms.PaintEventHandler(this_Paint);
        }
Ejemplo n.º 5
0
 public MapPanel(List <MapLayer> layers, TilesetInfo tileset)
     : base(layers, tileset)
 {
 }
Ejemplo n.º 6
0
 public TilePanel(TilesetInfo tileset)
     : base(tileset.TilePanelData, tileset)
 {
     this.MouseDown += new System.Windows.Forms.MouseEventHandler(TilePanel_MouseDown);
 }
Ejemplo n.º 7
0
 public TilePanel(TilesetInfo tileset)
     : base(tileset.TilePanelData, tileset)
 {
     this.MouseDown += new System.Windows.Forms.MouseEventHandler(TilePanel_MouseDown);
 }
Ejemplo n.º 8
0
 public MapPanel(List<MapLayer> layers, TilesetInfo tileset)
     : base(layers, tileset)
 {
 }