예제 #1
0
        protected void Initialize(string Title, bool ShowIDs)
        {
            SetTitle(Title);
            MinimumSize = MaximumSize = new Size(600, 469);
            SetSize(MaximumSize);
            Center();

            Label pickerlabel = new Label(this);

            pickerlabel.SetText("Maps");
            pickerlabel.SetPosition(18, 24);
            pickerlabel.SetFont(Font.Get("Fonts/Ubuntu-B", 14));
            Maps = new ListBox(this);
            Maps.SetPosition(25, 44);
            Maps.SetSize(151, 380);
            List <ListItem> items = new List <ListItem>();

            foreach (Map Map in this.MapList)
            {
                string Name = ShowIDs ? $"{Utilities.Digits(Map.ID, 3)}: {Map.DevName}" : Map.DevName;
                items.Add(new ListItem(Name, Map));
            }
            Maps.SetItems(items);
            Maps.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                UpdatePreview();
            };

            Label previewlabel = new Label(this);

            previewlabel.SetText("Preview");
            previewlabel.SetPosition(192, 24);
            previewlabel.SetFont(Font.Get("Fonts/Ubuntu-B", 14));

            ColoredBox outline = new ColoredBox(this);

            outline.SetPosition(194, 44);
            outline.SetSize(380, 380);
            outline.SetOuterColor(59, 91, 124);
            outline.SetInnerColor(24, 38, 53);
            PreviewContainer = new Container(this);
            PreviewContainer.SetBackgroundColor(17, 27, 38);
            PreviewContainer.SetPosition(196, 46);
            PreviewContainer.SetSize(376, 376);

            MapBox           = new PictureBox(PreviewContainer);
            MapBox.ResizeBox = false;

            CreateButton("Cancel", Cancel);
            CreateButton("OK", OK);

            if (Maps.Items.Count > 0)
            {
                Maps.SetSelectedIndex(0);
            }
        }
예제 #2
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
                }
            });