예제 #1
0
        public TilesPanel(IContainer Parent) : base(Parent)
        {
            Label Header = new Label(this);

            Header.SetText("Tiles");
            Header.SetFont(Font.Get("Fonts/Ubuntu-B", 16));
            Header.SetPosition(5, 5);

            Sprites["sep"]   = new Sprite(this.Viewport, new SolidBitmap(288, 2, new Color(10, 23, 37)));
            Sprites["sep"].Y = 50;

            Sprites["slider"]   = new Sprite(this.Viewport, new SolidBitmap(10, Size.Height - 34, new Color(10, 23, 37)));
            Sprites["slider"].Y = 53;

            this.OnWidgetSelected += WidgetSelected;

            CursorIM = new MouseInputManager(this);

            MainContainer = new Container(this);
            MainContainer.SetPosition(0, 53);
            MainContainer.VAutoScroll = true;

            VScrollBar vs = new VScrollBar(this);

            MainContainer.SetVScrollBar(vs);

            Cursor = new CursorWidget(MainContainer);
            Cursor.SetPosition(3, 8);
            Cursor.SetZIndex(1);

            MainStackPanel = new VStackPanel(MainContainer);
            MainStackPanel.SetWidth(264);
            MainStackPanel.SetPosition(8, 3);

            DrawToolsContainer = new Container(this);
            DrawToolsContainer.SetPosition(46, 22);
            DrawToolsContainer.SetSize(186, 28);
            DrawToolsContainer.Sprites["line1"]   = new Sprite(DrawToolsContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73)));
            DrawToolsContainer.Sprites["line1"].X = 144;
            DrawToolsContainer.Sprites["line2"]   = new Sprite(DrawToolsContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73)));
            DrawToolsContainer.Sprites["line2"].X = 185;

            PencilButton = new IconButton(DrawToolsContainer);
            PencilButton.SetIcon(15, 0);
            PencilButton.SetSelected(true);

            FillButton = new IconButton(DrawToolsContainer);
            FillButton.SetIcon(16, 0);
            FillButton.SetPosition(32, 0);

            EllipseButton = new IconButton(DrawToolsContainer);
            EllipseButton.SetIcon(17, 0);
            EllipseButton.SetPosition(64, 0);

            RectButton = new IconButton(DrawToolsContainer);
            RectButton.SetIcon(18, 0);
            RectButton.SetPosition(96, 0);

            SelectButton = new IconButton(DrawToolsContainer);
            SelectButton.SetIcon(19, 0);
            SelectButton.SetPosition(128, 0);
            SelectButton.OnSelection += delegate(BaseEventArgs e)
            {
                MapViewer.Cursor.SetVisible(false);
                Cursor.SetPosition(0, 0);
                Cursor.SetVisible(false);
            };
            SelectButton.OnDeselection += delegate(BaseEventArgs e)
            {
                UpdateCursor();
            };

            EraserButton = new IconButton(DrawToolsContainer);
            EraserButton.SetIcon(20, 0);
            EraserButton.SetPosition(160, 0);
            EraserButton.Toggleable   = true;
            EraserButton.OnSelection += delegate(BaseEventArgs e)
            {
                if (AutotileIndex != -1 || TilesetIndex != -1 || TileStartX != -1 || TileEndX != -1 || TileStartY != -1 || TileEndY != -1)
                {
                    SelectTile(null);
                }
            };
            EraserButton.OnDeselection += delegate(BaseEventArgs e)
            {
                if (AutotileIndex == -1 && TilesetIndex == -1 && TileStartX == -1 && TileEndX == -1 && TileStartY == -1 && TileEndY == -1 &&
                    !MapViewer.SelectionOnMap)
                {
                    SelectTile(0, 0, 0);
                }
                else
                {
                    UpdateCursor();
                }
            };

            SetSize(288, 200); // Dummy size so the sprites can be drawn properly
        }
예제 #2
0
        public ToolBar(IContainer Parent) : base(Parent)
        {
            MappingMode = new ModeButton(this, "Maps", 23);
            MappingMode.SetPosition(4, 0);
            MappingMode.SetSelected(true);
            MappingMode.OnSelection += delegate(BaseEventArgs e)
            {
                Editor.SetMode("MAPPING");
            };

            EventingMode = new ModeButton(this, "Events", 24);
            EventingMode.SetPosition(MappingMode.Position.X + MappingMode.Size.Width + 12, 0);
            EventingMode.OnSelection += delegate(BaseEventArgs e)
            {
                Editor.SetMode("EVENTING");
            };

            ScriptingMode = new ModeButton(this, "Scripts", 25);
            ScriptingMode.SetPosition(EventingMode.Position.X + EventingMode.Size.Width + 12, 0);
            ScriptingMode.OnSelection += delegate(BaseEventArgs e)
            {
                Editor.SetMode("SCRIPTING");
            };

            DatabaseMode = new ModeButton(this, "Database", 26);
            DatabaseMode.SetPosition(ScriptingMode.Position.X + ScriptingMode.Size.Width + 12, 0);
            DatabaseMode.OnSelection += delegate(BaseEventArgs e)
            {
                Editor.SetMode("DATABASE");
            };

            ActionContainer = new Container(this);
            ActionContainer.SetPosition(DatabaseMode.Position.X + DatabaseMode.Size.Width + 12, 3);
            ActionContainer.SetSize(83, 28);
            ActionContainer.Sprites["line"] = new Sprite(ActionContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73)));
            Delete = new IconButton(ActionContainer);
            Delete.SetPosition(6, 0);
            Delete.SetIcon(3, 0);
            Delete.Selectable = false;
            Undo = new IconButton(ActionContainer);
            Undo.SetPosition(30, 0);
            Undo.SetIcon(4, 0);
            Undo.Selectable   = false;
            Undo.OnLeftClick += delegate(MouseEventArgs e)
            {
                Editor.Undo();
            };
            Redo = new IconButton(ActionContainer);
            Redo.SetPosition(54, 0);
            Redo.SetIcon(5, 0);
            Redo.Selectable   = false;
            Redo.OnLeftClick += delegate(MouseEventArgs e)
            {
                Editor.Redo();
            };

            CopyContainer = new Container(this);
            CopyContainer.SetPosition(ActionContainer.Position.X + ActionContainer.Size.Width, 3);
            CopyContainer.SetSize(83, 28);
            CopyContainer.Sprites["line"] = new Sprite(CopyContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73)));
            Cut = new IconButton(CopyContainer);
            Cut.SetPosition(6, 0);
            Cut.SetIcon(0, 0);
            Cut.Selectable = false;
            Copy           = new IconButton(CopyContainer);
            Copy.SetPosition(30, 0);
            Copy.SetIcon(1, 0);
            Copy.Selectable = false;
            Paste           = new IconButton(CopyContainer);
            Paste.SetPosition(54, 0);
            Paste.SetIcon(2, 0);
            Paste.Selectable = false;

            PlayButton = new PlayButton(this);
            SaveButton = new SaveButton(this);
        }