Ejemplo n.º 1
0
        public MouseEvent(Wait Wait, MouseMove Move, ButtonScroll ButtonScroll, ButtonDown ButtonDown, ButtonUp ButtonUp, ButtonClick ButtonClick, ButtonClickHold ButtonClickHold, ButtonDoubleClick ButtonDoubleClick, IReadOnlyCollection <DragStart> DragStarted, IReadOnlyCollection <DragDrop> DragFinished)
        {
            this.Wait              = Wait;
            this.Move              = Move;
            this.ButtonScroll      = ButtonScroll;
            this.ButtonDown        = ButtonDown;
            this.ButtonUp          = ButtonUp;
            this.ButtonClick       = ButtonClick;
            this.ButtonClickHold   = ButtonClickHold;
            this.ButtonDoubleClick = ButtonDoubleClick;

            this.DragStart = DragStarted;
            this.DragStop  = DragFinished;

            {
                var PotentialEvents = new List <IEvent>();
                PotentialEvents.Add(Wait);
                PotentialEvents.Add(Move);
                PotentialEvents.Add(ButtonScroll);
                PotentialEvents.Add(ButtonDown);
                PotentialEvents.Add(ButtonUp);
                PotentialEvents.Add(ButtonClick);
                PotentialEvents.Add(ButtonClickHold);
                PotentialEvents.Add(ButtonDoubleClick);
                if (DragStart is { })
Ejemplo n.º 2
0
        private void Button_MouseLeave(object sender, MouseEventArgs args)
        {
            Button myButton = sender as Button;

            if (myButton.IsEnabled && myButton.Effect != null)
            {
                ButtonScroll fx = myButton.Effect as ButtonScroll;
                fx.bIsMouseOver = 0;
            }
        }
Ejemplo n.º 3
0
            public LayoutHorizontal(HipsterEngine.Core.HipsterEngine engine, float x, int section)
            {
                _engine = engine;

                X = x;

                var radius = 50.0f;
                var bX     = 150;
                var y      = _engine.Surface.Height / section;

                ButtonRight = new ButtonScroll(_engine, _engine.Surface.Width - bX + X, y, radius);
                ButtonLeft  = new ButtonScroll(_engine, bX + X, y, radius, 180);
            }
Ejemplo n.º 4
0
        private void Button_MouseEnter(object sender, MouseEventArgs args)
        {
            Button myButton = sender as Button;

            if (myButton.IsEnabled)
            {
                if (myButton.Effect == null)
                {
                    myButton.Effect = new ButtonScroll();
                }
                ButtonScroll fx = myButton.Effect as ButtonScroll;
                fx.bIsMouseOver = 1;
            }
        }
Ejemplo n.º 5
0
        public ShopGump(uint serial, bool isBuyGump, int x, int y) : base(serial, 0) //60 is the base height, original size
        {
            int height = ProfileManager.CurrentProfile.VendorGumpHeight;

            X = x;
            Y = y;
            AcceptMouseInput       = false;
            AcceptKeyboardInput    = true;
            CanMove                = true;
            CanCloseWithRightClick = true;
            IsBuyGump              = isBuyGump;

            _transactionItems = new Dictionary <uint, TransactionItem>();
            _shopItems        = new Dictionary <uint, ShopItem>();
            _updateTotal      = false;

            WantUpdateSize = true;

            const ushort BUY_GRAPHIC_LEFT   = 0x0870;
            const ushort BUY_GRAPHIC_RIGHT  = 0x0871;
            const ushort SELL_GRAPHIC_LEFT  = 0x0872;
            const ushort SELL_GRAPHIC_RIGHT = 0x0873;


            ushort graphicLeft  = isBuyGump ? BUY_GRAPHIC_LEFT : SELL_GRAPHIC_LEFT;
            ushort graphicRight = isBuyGump ? BUY_GRAPHIC_RIGHT : SELL_GRAPHIC_RIGHT;

            _ = GumpsLoader.Instance.GetGumpTexture(graphicLeft, out var boundsLeft);
            _ = GumpsLoader.Instance.GetGumpTexture(graphicRight, out var boundsRight);



            const int LEFT_TOP_HEIGHT    = 64;
            const int LEFT_BOTTOM_HEIGHT = 116;

            Rectangle      offset  = new Rectangle(0, 0, boundsLeft.Width, LEFT_TOP_HEIGHT);
            GumpPicTexture leftTop = new GumpPicTexture(graphicLeft, 0, 0, offset, false);

            Add(leftTop);



            offset.Y     += LEFT_TOP_HEIGHT;
            offset.Height = boundsLeft.Height - (LEFT_BOTTOM_HEIGHT + LEFT_TOP_HEIGHT);
            GumpPicTexture leftmiddle = new GumpPicTexture(graphicLeft, 0, LEFT_TOP_HEIGHT, offset, true);
            int            diff       = height - leftmiddle.Height;

            leftmiddle.Height = height;
            Add(leftmiddle);


            offset.Y     += offset.Height;
            offset.Height = LEFT_BOTTOM_HEIGHT;
            GumpPicTexture leftBottom = new GumpPicTexture(graphicLeft, 0, leftmiddle.Y + leftmiddle.Height, offset, false);

            Add(leftBottom);



            const int RIGHT_OFFSET        = 32;
            const int RIGHT_BOTTOM_HEIGHT = 93;

            int rightX = boundsLeft.Width - RIGHT_OFFSET;
            int rightY = boundsLeft.Height / 2 - RIGHT_OFFSET;

            offset = new Rectangle(0, 0, boundsRight.Width, LEFT_TOP_HEIGHT);
            GumpPicTexture rightTop = new GumpPicTexture(graphicRight, rightX, rightY, offset, false);

            Add(rightTop);


            offset.Y     += LEFT_TOP_HEIGHT;
            offset.Height = boundsRight.Height - (RIGHT_BOTTOM_HEIGHT + LEFT_TOP_HEIGHT);
            GumpPicTexture rightMiddle = new GumpPicTexture(graphicRight, rightX, rightY + LEFT_TOP_HEIGHT, offset, true);

            rightMiddle.Height += diff;
            Add(rightMiddle);


            offset.Y     += offset.Height;
            offset.Height = RIGHT_BOTTOM_HEIGHT;
            GumpPicTexture rightBottom = new GumpPicTexture(graphicRight, rightX, rightMiddle.Y + rightMiddle.Height, offset, false);

            Add(rightBottom);



            _shopScrollArea = new ScrollArea
                              (
                RIGHT_OFFSET,
                leftmiddle.Y,
                boundsLeft.Width - RIGHT_OFFSET * 2 + 5,
                leftmiddle.Height + 50,
                false,
                leftmiddle.Height
                              );

            Add(_shopScrollArea);


            _transactionScrollArea = new ScrollArea
                                     (
                RIGHT_OFFSET / 2 + rightTop.X,
                LEFT_TOP_HEIGHT + rightTop.Y,
                boundsRight.Width - RIGHT_OFFSET * 2 + RIGHT_OFFSET / 2 + 5,
                rightMiddle.Height,
                false
                                     );

            Add(_transactionScrollArea);

            _transactionDataBox = new DataBox(0, 0, 1, 1);
            _transactionDataBox.WantUpdateSize = true;
            _transactionScrollArea.Add(_transactionDataBox);


            _totalLabel = new Label("0", true, 0x0386, 0, 1)
            {
                X = RIGHT_OFFSET + rightTop.X + 32 + 4,
                Y = rightBottom.Y + rightBottom.Height - 32 * 3 + 15,
            };

            Add(_totalLabel);

            if (isBuyGump)
            {
                _playerGoldLabel = new Label
                                   (
                    World.Player.Gold.ToString(),
                    true,
                    0x0386,
                    0,
                    1
                                   )
                {
                    X = _totalLabel.X + 120,
                    Y = _totalLabel.Y
                };

                Add(_playerGoldLabel);
            }
            else
            {
                _totalLabel.X = (rightTop.X + rightTop.Width) - RIGHT_OFFSET * 3;
            }



            Button expander = new Button(2, 0x082E, 0x82F)
            {
                ButtonAction = ButtonAction.Activate,
                X            = boundsLeft.Width / 2 - 10,
                Y            = leftBottom.Y + leftBottom.Height - 5
            };

            Add(expander);


            const float ALPHA_HIT_BUTTON = 0f;

            HitBox accept = new HitBox(RIGHT_OFFSET + rightTop.X, (rightBottom.Y + rightBottom.Height) - 50, 34, 30, "Accept", ALPHA_HIT_BUTTON);
            HitBox clear  = new HitBox(accept.X + 175, accept.Y, 20, 20, "Clear", ALPHA_HIT_BUTTON);

            accept.MouseUp += (sender, e) => { OnButtonClick((int)Buttons.Accept); };
            clear.MouseUp  += (sender, e) => { OnButtonClick((int)Buttons.Clear); };
            Add(accept);
            Add(clear);



            HitBox leftUp   = new HitBox((leftTop.X + leftTop.Width) - 50, (leftTop.Y + leftTop.Height) - 18, 18, 16, "Scroll Up", ALPHA_HIT_BUTTON);
            HitBox leftDown = new HitBox(leftUp.X, leftBottom.Y, 18, 16, "Scroll Down", ALPHA_HIT_BUTTON);

            HitBox rightUp   = new HitBox((rightTop.X + rightTop.Width - 50), (rightTop.Y + rightTop.Height) - 18, 18, 16, "Scroll Up", ALPHA_HIT_BUTTON);
            HitBox rightDown = new HitBox(rightUp.X, rightBottom.Y, 18, 16, "Scroll Down", ALPHA_HIT_BUTTON);

            leftUp.MouseUp      += ButtonMouseUp;
            leftDown.MouseUp    += ButtonMouseUp;
            rightUp.MouseUp     += ButtonMouseUp;
            rightDown.MouseUp   += ButtonMouseUp;
            leftUp.MouseDown    += (sender, e) => { _buttonScroll = ButtonScroll.LeftScrollUp; };
            leftDown.MouseDown  += (sender, e) => { _buttonScroll = ButtonScroll.LeftScrollDown; };
            rightUp.MouseDown   += (sender, e) => { _buttonScroll = ButtonScroll.RightScrollUp; };
            rightDown.MouseDown += (sender, e) => { _buttonScroll = ButtonScroll.RightScrollUp; };
            Add(leftUp);
            Add(leftDown);
            Add(rightUp);
            Add(rightDown);



            bool is_pressing = false;
            int  initial_height = 0, initialHeightRight = 0;
            int  minHeight      = boundsLeft.Height - (LEFT_BOTTOM_HEIGHT + LEFT_TOP_HEIGHT);
            int  minHeightRight = boundsRight.Height - (RIGHT_BOTTOM_HEIGHT + LEFT_TOP_HEIGHT);

            expander.MouseDown += (sender, args) =>
            {
                is_pressing        = true;
                initial_height     = leftmiddle.Height;
                initialHeightRight = rightMiddle.Height;
            };

            expander.MouseUp += (sender, args) => { is_pressing = false; };

            expander.MouseOver += (sender, args) =>
            {
                int steps = Mouse.LDragOffset.Y;

                if (is_pressing && steps != 0)
                {
                    leftmiddle.Height = initial_height + steps;

                    if (leftmiddle.Height < minHeight)
                    {
                        leftmiddle.Height = minHeight;
                    }
                    else if (leftmiddle.Height > 640)
                    {
                        leftmiddle.Height = 640;
                    }

                    rightMiddle.Height = initialHeightRight + steps;

                    if (rightMiddle.Height < minHeightRight)
                    {
                        rightMiddle.Height = minHeightRight;
                    }
                    else if (rightMiddle.Height > 640 - LEFT_TOP_HEIGHT)
                    {
                        rightMiddle.Height = 640 - LEFT_TOP_HEIGHT;
                    }

                    ProfileManager.CurrentProfile.VendorGumpHeight = leftmiddle.Height;

                    leftBottom.Y  = leftmiddle.Y + leftmiddle.Height;
                    expander.Y    = leftBottom.Y + leftBottom.Height - 5;
                    rightBottom.Y = rightMiddle.Y + rightMiddle.Height;

                    _shopScrollArea.Height          = leftmiddle.Height + 50;
                    _shopScrollArea.ScrollMaxHeight = leftmiddle.Height;

                    _transactionDataBox.Height = _transactionScrollArea.Height = rightMiddle.Height;
                    _totalLabel.Y = rightBottom.Y + rightBottom.Height - RIGHT_OFFSET * 3 + 15;
                    accept.Y      = clear.Y = (rightBottom.Y + rightBottom.Height) - 50;
                    leftDown.Y    = leftBottom.Y;
                    rightDown.Y   = rightBottom.Y;

                    if (_playerGoldLabel != null)
                    {
                        _playerGoldLabel.Y = _totalLabel.Y;
                    }

                    _transactionDataBox.ReArrangeChildren();
                    WantUpdateSize = true;
                }
            };


            //Label name = new Label(World.Player.Name, false, 0x0386, font: 5)
            //{
            //    X = 322,
            //    Y = 308 + _middleGumpRight.Height
            //};

            //Add(name);
        }
Ejemplo n.º 6
0
        //public void SetIfNameIsFromCliloc(Item it, bool fromcliloc)
        //{
        //    if (_shopItems.TryGetValue(it, out var shopItem))
        //    {
        //        shopItem.NameFromCliloc = fromcliloc;

        //        if (fromcliloc)
        //        {
        //            shopItem.SetName(ClilocLoader.Instance.Translate(it.Name, $"\t{it.Amount}\t{it.ItemData.Name}", true));
        //        }
        //    }
        //}

        private void ButtonMouseUp(object sender, MouseEventArgs e)
        {
            _buttonScroll = ButtonScroll.None;
        }
 public bool ShouldHandleHotkeyEvent(ButtonScroll buttonScroll)
 {
     return(ShouldHandleHotkeyEvent());
 }
Ejemplo n.º 8
0
 protected EventSourceEventArgs InvokeEvent(EventSourceEventArgs args, ButtonScroll Data, object RawData, DateTimeOffset Timestamp) => InvokeEvent(args, ButtonScroll, Data, RawData, Timestamp);