Пример #1
0
        public Editor(Engine e)
        {
            engine = e;
            graph = e.graph;

            tileset = new Tileset(
                new System.Drawing.Bitmap("mantiles.png"),
                16, 16, 19, 42 * 18
            );

            tilesetmode = new TileSetMode(this);
            copypastemode = new CopyPasteMode(this);
            obstructionmode = new ObstructionMode(this);
            entityeditmode = new EntityEditMode(this);

            tabs.Dock = DockStyle.Fill;
            form.Controls.Add(tabs);
            form.Size = new System.Drawing.Size(800, 400);

            statbar = new StatusBar();
            statbar.Panels.Add(new StatusBarPanel());
            statbar.Panels.Add(new StatusBarPanel());

            statbar.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring;
            statbar.Panels[1].AutoSize = StatusBarPanelAutoSize.Contents;
            statbar.ShowPanels = true;

            menu = new MainMenu(new MenuItem[] {
                new MenuItem("&File", new MenuItem[] {
                    new MenuItem("&New",               new EventHandler(NewMap   ), Shortcut.CtrlN),
                    new MenuItem("&Open...",           new EventHandler(OpenMap  ), Shortcut.CtrlO),
                    new MenuItem("-"),
                    new MenuItem("&Save",              new EventHandler(SaveMap  ), Shortcut.CtrlS),
                    new MenuItem("Save &As...",        new EventHandler(SaveMapAs), Shortcut.F12  ),
                }),
                new MenuItem("&Edit", new MenuItem[] {
                    new MenuItem("&Map Properties...", new EventHandler(ShowMapProperties   )),
                    new MenuItem("&Tileset...",        new EventHandler(ShowTileSet         )),
                    new MenuItem("Map &Entities...",   new EventHandler(ShowMapEntProperties)),
                    new MenuItem("&Auto Selection Thing...",	new EventHandler(ShowAutoSelectionThing)),
                }),
                new MenuItem("&Mode", new MenuItem[] {
                    new MenuItem("&Tiles",             new EventHandler(SetTileSetMode        )),
                    new MenuItem("&Copy/paste",        new EventHandler(SetCopyPasteMode      )),
                    new MenuItem("&Obstructions",      new EventHandler(SetObstructionEditMode)),
                    new MenuItem("Map &Entities",      new EventHandler(SetMapEntEditMode     ))
                })
            });

            tilesetpreview = new TileSetPreview(tileset);
            tilesetpreview.ChangeTile += new ChangeTileHandler(OnTileChange);
            mapinfoview = new MapInfoView(this);
            mapentpropertiesview = new MapEntPropertiesView(this);
            autoselectionthing = new AutoSelectionThing(this);

            form.Text = "Mannux Editor";
            form.Menu = menu;
            form.Controls.Add(statbar);
            AddTab("Layers", mapinfoview);
            AddTab("Entities", mapentpropertiesview);
            AddTab("Tiles", tilesetpreview);
            AddTab("Selection", autoselectionthing);

            var m = engine.input.Mouse;
            m.MouseDown += MouseClick;
            m.MouseUp += MouseUp;
            m.Moved += MouseDown;
        }
Пример #2
0
 /// <summary>
 /// Gets the tileset.
 /// </summary>
 /// <returns>The <see cref="Tileset"/>.</returns>
 public Tileset GetTileset()
 {
     return(cachedTileset ?? (cachedTileset = new Tileset("tileset.png", Configuration.TileSize)));
 }