Example #1
0
        protected override void Draw()
        {
            RectSprite box = Sprites["box"] as RectSprite;

            box.SetInnerColor(InnerColor);
            box.SetOuterColor(OuterColor);
            box.SetSize(this.Size, Thickness);
            base.Draw();
        }
Example #2
0
        public AutotilePickerMap()
        {
            SetTitle("Individual Tile Combinations");
            MinimumSize = MaximumSize = new Size(313, 285);
            SetSize(MaximumSize);
            Center();

            RectSprite bg1 = new RectSprite(this.Viewport);

            bg1.SetOuterColor(59, 91, 124);
            bg1.SetSize(278, 210);
            bg1.X          = 19;
            bg1.Y          = 34;
            Sprites["bg1"] = bg1;
            RectSprite bg2 = new RectSprite(this.Viewport);

            bg2.SetSize(276, 208);
            bg2.X = 20;
            bg2.Y = 35;
            bg2.SetOuterColor(17, 27, 38);
            bg2.SetInnerColor(24, 38, 53);
            Sprites["bg2"] = bg2;

            CreateButton("Cancel", delegate(BaseEventArgs e)
            {
                SelectedTileID = -1;
                Close();
            });

            CreateButton("OK", delegate(BaseEventArgs e)
            {
                Close();
            });

            Sprites["tiles"]   = new Sprite(this.Viewport);
            Sprites["tiles"].X = 23;
            Sprites["tiles"].Y = 38;

            Cursor = new CursorWidget(this);
            Cursor.SetPosition(Sprites["tiles"].X - 7, Sprites["tiles"].Y - 7);
            Cursor.SetSize(32 + 14, 32 + 14);
        }
Example #3
0
        public AutotilePicker(Map Map)
        {
            SetTitle("Change Autotiles");
            MinimumSize = MaximumSize = new Size(506, 498);
            SetSize(MaximumSize);
            Center();

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

            RectSprite bg1 = new RectSprite(this.Viewport);

            bg1.SetOuterColor(59, 91, 124);
            bg1.SetSize(280, 409);
            bg1.X          = 200;
            bg1.Y          = 44;
            Sprites["bg1"] = bg1;
            RectSprite bg2 = new RectSprite(this.Viewport);

            bg2.SetSize(278, 407);
            bg2.X = 201;
            bg2.Y = 45;
            bg2.SetOuterColor(17, 27, 38);
            bg2.SetInnerColor(24, 38, 53);
            Sprites["bg2"] = bg2;

            Sprites["preview"] = new Sprite(this.Viewport);

            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 Autotile")
                {
                    IsClickable = delegate(BoolEventArgs e)
                    {
                        e.Value = !(SelectedAutotile is null);
                    },
                    OnLeftClick = ActionButtonClicked
                }
            });