コード例 #1
0
        protected override void OnInitialize()
        {
            Add(_gumpTop    = new GumpPic(0, 0, 0x0820, 0));
            Add(_gumpMiddle = new GumpPicTiled(0, 0, 0, 0, 0x0822));
            Add(_gumpBottom = new GumpPic(0, 0, 0x0823, 0));

            if (_isResizable)
            {
                Add(_gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate, X = 0, Y = 0
                });
                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            WantUpdateSize = true;
        }
コード例 #2
0
        private MultiSelectionShrinkbox(int x, int y, int width, string indextext, ushort hue, bool unicode, byte font, int group, ushort button, bool userArrow2)
        {
            WantUpdateSize = false;
            X            = x;
            Y            = y;
            _buttonimg   = button;
            _buttongroup = group;
            Width        = width;
            _useArrow2   = userArrow2;


            //_label = new Label(indextext, unicode, hue, font: font, align: TEXT_ALIGN_TYPE.TS_LEFT)
            //{
            //    X = 18,
            //    Y = 0
            //};


            //_label = new TextBox(font, 32, maxWidth: width, width: width, isunicode: unicode, hue: hue)
            //{
            //    X = 18,
            //    Y = 0,
            //    Width = tw,
            //    Height = th,
            //    IsEditable = false,
            //    Text = indextext
            //};

            _label = new EditableLabel(indextext, font, hue, unicode, width, FontStyle.None)
            {
                X = 18
            };

            _label.MouseUp += (senderr, e) =>
            {
                if (!IsEditable)
                {
                    return;
                }

                EditStateStart.Raise(_label);

                _label.SetEditable(true);
            };

            int xx       = _label.X + _label.Width + 5;
            int hh       = GumpsLoader.Instance.GetTexture(0x0835)?.Height ?? 0;
            int decWidth = width - xx - 10;

            if (decWidth < 0)
            {
                decWidth = 0;
            }
            _decoration = new GumpPicTiled(xx, (_label.Height >> 1) - (hh >> 1), decWidth, hh, 0x0835);

            Add(_decoration);
            Add(_label);
            Height = _label.Height;


            Add(_arrow = new GumpPic(1, 1, (ushort)(userArrow2 ? 0x0827 : 0x15E1), 0)
            {
                ContainsByBounds = true
            });

            _arrow.MouseUp += (sender, state) =>
            {
                if (state.Button == MouseButtonType.Left)
                {
                    Opened = !_opened;
                }
            };
        }
コード例 #3
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            var textures = new SpriteTexture[4];

            for (int i = 0; i < 4; i++)
            {
                var t = FileManager.Gumps.GetTexture((ushort)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (t.Width > _maxWidth)
                {
                    _maxWidth = t.Width;
                }

                textures[i] = t;
            }


            Add(_gumpTop    = new GumpPic(0, 0, graphic, 0));
            Add(_gumpRight  = new GumpPicTiled(0, 0, 0, 0, (ushort)(graphic + 1)));
            Add(_gumpMiddle = new GumpPicTiled(0, 0, 0, 0, (ushort)(graphic + 2)));
            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add(_gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                });
                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = textures[0].Width - textures[3].Width;

            _maxWidth = textures[1].Width;

            _gumpRight.X              = _gumpMiddle.X = 17;
            _gumpRight.X              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Width          = _gumpMiddle.Width = _maxWidth;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }
コード例 #4
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            int width = 0;

            int w0 = 0, w1 = 0, w3 = 0;

            for (int i = 0; i < 4; i++)
            {
                var texture = GumpsLoader.Instance.GetGumpTexture((ushort)(graphic + i), out var bounds);

                if (texture == null)
                {
                    Dispose();

                    return;
                }

                if (bounds.Width > width)
                {
                    width = bounds.Width;
                }

                if (i == 0)
                {
                    w0 = bounds.Width;
                }
                else if (i == 1)
                {
                    w1 = bounds.Width;
                }
                else if (i == 3)
                {
                    w3 = bounds.Width;
                }
            }


            Add(_gumpTop = new GumpPic(0, 0, graphic, 0));

            Add
            (
                _gumpRight = new GumpPicTiled
                             (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 1)
                             )
            );

            Add
            (
                _gumpMiddle = new GumpPicTiled
                              (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 2)
                              )
            );

            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add
                (
                    _gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                }
                );

                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = w0 - w3;

            _gumpRight.X              = _gumpMiddle.X = (width - w1) / 2;
            _gumpRight.Y              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;
            _gumpBottom.X             = (off / 2) + (off / 4);

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }
コード例 #5
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            UOTexture[] textures = new UOTexture[4];
            int         width    = 0;

            for (int i = 0; i < 4; i++)
            {
                UOTexture t = GumpsLoader.Instance.GetTexture((ushort)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (t.Width > width)
                {
                    width = t.Width;
                }

                textures[i] = t;
            }


            Add(_gumpTop = new GumpPic(0, 0, graphic, 0));

            Add
            (
                _gumpRight = new GumpPicTiled
                             (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 1)
                             )
            );

            Add
            (
                _gumpMiddle = new GumpPicTiled
                              (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 2)
                              )
            );

            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add
                (
                    _gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x89, 0x8A)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                }
                );

                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = textures[0].Width - textures[3].Width;

            _gumpRight.X              = _gumpMiddle.X = (width - textures[1].Width) / 2;
            _gumpRight.Y              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;
            _gumpBottom.X             = (off / 2) + (off / 4);

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }