Ejemplo n.º 1
0
        public TilesetPickerMap(Map Map)
        {
            SetTitle("Change Tilesets");
            MinimumSize = MaximumSize = new Size(506, 498);
            SetSize(MaximumSize);
            Center();

            OldIDs = new List <int>(Map.AutotileIDs);

            ColoredBox box1 = new ColoredBox(this);

            box1.SetOuterColor(59, 91, 124);
            box1.SetInnerColor(17, 27, 38);
            box1.SetPosition(200, 44);
            box1.SetSize(280, 409);

            ColoredBox box2 = new ColoredBox(this);

            box2.SetOuterColor(24, 38, 53);
            box2.SetPosition(201, 45);
            box2.SetSize(278, 407);

            TilesetContainer = new Container(this);
            TilesetContainer.SetPosition(203, 47);
            TilesetContainer.SetSize(274, 403);
            TilesetContainer.VAutoScroll = true;
            VScrollBar vs = new VScrollBar(this);

            vs.SetPosition(469, 47);
            vs.SetSize(10, 403);
            TilesetContainer.SetVScrollBar(vs);

            TilesetBox = new PictureBox(TilesetContainer);

            Font f = Font.Get("Fonts/Ubuntu-B", 14);

            Label labelavail = new Label(this);

            labelavail.SetText("Available");
            labelavail.SetPosition(16, 24);
            labelavail.SetFont(f);

            Label labelinuse = new Label(this);

            labelinuse.SetText("In-use");
            labelinuse.SetPosition(16, 250);
            labelinuse.SetFont(f);

            Label labelprev = new Label(this);

            labelprev.SetText("Preview");
            labelprev.SetPosition(192, 24);
            labelprev.SetFont(f);

            ActionButton = new Button(this);
            ActionButton.SetPosition(52, 225);
            ActionButton.SetSize(85, 30);
            ActionButton.OnClicked += ActionButtonClicked;

            Available = new ListBox(this);
            Available.SetPosition(25, 44);
            Available.SetSize(151, 179);
            Available.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                if (Available.SelectedIndex != -1)
                {
                    InUse.SetSelectedIndex(-1);
                    SelectionChanged(e);
                }
            };
            Available.ListDrawer.SetContextMenuList(new List <IMenuItem>()
            {
                new MenuItem("Add Tileset")
                {
                    IsClickable = delegate(BoolEventArgs e)
                    {
                        e.Value = !(SelectedTileset is null);
                    },
                    OnLeftClick = ActionButtonClicked
                }
            });