예제 #1
0
        private void ShopItem_MouseDoubleClick(object sender, MouseDoubleClickEventArgs e)
        {
            ShopItem shopItem = (ShopItem)sender;

            if (shopItem.Amount <= 0)
            {
                return;
            }


            int total = _shiftPressed ? shopItem.Amount : 1;

            if (_transactionItems.TryGetValue(shopItem.LocalSerial, out TransactionItem transactionItem))
            {
                transactionItem.Amount += total;
            }
            else
            {
                transactionItem = new TransactionItem
                                  (
                    shopItem.LocalSerial, shopItem.Graphic, shopItem.Hue, total, (ushort)shopItem.Price,
                    shopItem.ShopItemName
                                  );

                transactionItem.OnIncreaseButtomClicked += TransactionItem_OnIncreaseButtomClicked;
                transactionItem.OnDecreaseButtomClicked += TransactionItem_OnDecreaseButtomClicked;
                _transactionDataBox.Add(transactionItem);
                _transactionItems.Add(shopItem.LocalSerial, transactionItem);
                _transactionDataBox.WantUpdateSize = true;
                _transactionDataBox.ReArrangeChildren();
            }

            shopItem.Amount -= total;
            _updateTotal     = true;
        }
예제 #2
0
        public void RemoveBulletinObject(uint serial)
        {
            foreach (Control child in _databox.Children)
            {
                if (child.LocalSerial == serial)
                {
                    child.Dispose();
                    _databox.WantUpdateSize = true;
                    _databox.ReArrangeChildren();

                    return;
                }
            }
        }
예제 #3
0
        private void BuildGump()
        {
            _totalReal  = 0;
            _totalValue = 0;
            _databox.Clear();

            foreach (SkillListEntry entry in _skillListEntries)
            {
                entry.Clear();
                entry.Dispose();
            }

            _skillListEntries.Clear();

            PropertyInfo pi         = typeof(Skill).GetProperty(_sortField);
            List <Skill> sortSkills = new List <Skill>(World.Player.Skills.OrderBy(x => pi.GetValue(x, null)));

            if (_sortAsc)
            {
                sortSkills.Reverse();
            }

            foreach (Skill skill in sortSkills)
            {
                _totalReal  += skill.Base;
                _totalValue += skill.Value;

                Label skillName      = new Label(skill.Name, true, 1153, font: 3);
                Label skillValueBase = new Label(skill.Base.ToString(), true, 1153, font: 3);
                Label skillValue     = new Label(skill.Value.ToString(), true, 1153, font: 3);
                Label skillCap       = new Label(skill.Cap.ToString(), true, 1153, font: 3);

                _skillListEntries.Add(new SkillListEntry(skillName, skillValueBase, skillValue, skillCap, skill));
            }

            foreach (SkillListEntry t in _skillListEntries)
            {
                _databox.Add(t);
            }

            _databox.WantUpdateSize = true;
            _databox.ReArrangeChildren();

            Add(new Label(ResGumps.Total, true, 1153)
            {
                X = 40, Y = 320
            });
            Add(new Label(_totalReal.ToString("F1"), true, 1153)
            {
                X = 220, Y = 320
            });
            Add(new Label(_totalValue.ToString("F1"), true, 1153)
            {
                X = 300, Y = 320
            });
        }
예제 #4
0
        public BulletinBoardItem
        (
            uint serial,
            uint msgSerial,
            string poster,
            string subject,
            string datatime,
            string data,
            byte variant
        ) : base(serial, 0)
        {
            _msgSerial             = msgSerial;
            AcceptKeyboardInput    = true;
            CanMove                = true;
            CanCloseWithRightClick = true;
            _datatime              = datatime;

            _articleContainer = new ExpandableScroll(0, 0, 408, 0x0820)
            {
                TitleGumpID      = 0x0820,
                AcceptMouseInput = true
            };

            Add(_articleContainer);

            ScrollArea area = new ScrollArea(0, 120, 272, 224, false);

            Add(area);

            _databox = new DataBox(0, 0, 1, 1);
            area.Add(_databox);

            bool useUnicode              = Client.Version >= ClientVersion.CV_305D;
            byte unicodeFontIndex        = 1;
            int  unicodeFontHeightOffset = 0;

            ushort textColor = 0x0386;

            if (useUnicode)
            {
                unicodeFontHeightOffset = -6;
                textColor = 0;
            }

            Label text = new Label
                             (ResGumps.Author, useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)6)
            {
                X = 30,
                Y = 40
            };

            Add(text);

            text = new Label(poster, useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)9)
            {
                X = 30 + text.Width,
                Y = 46 + unicodeFontHeightOffset
            };

            Add(text);


            text = new Label(ResGumps.Date, useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)6)
            {
                X = 30,
                Y = 58
            };

            Add(text);

            text = new Label(datatime, useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)9)
            {
                X = 32 + text.Width,
                Y = 64 + unicodeFontHeightOffset
            };

            Add(text);

            text = new Label(ResGumps.Title, useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)6)
            {
                X = 30,
                Y = 77
            };

            Add(text);

            ushort subjectColor = textColor;

            if (variant == 0)
            {
                subjectColor = 0x0008;
            }

            Add
            (
                _subjectTextbox = new StbTextBox
                                      (useUnicode ? unicodeFontIndex : (byte)9, maxWidth: 150, isunicode: useUnicode, hue: subjectColor)
            {
                X          = 30 + text.Width,
                Y          = 83 + unicodeFontHeightOffset,
                Width      = 150,
                IsEditable = variant == 0
            }
            );

            _subjectTextbox.SetText(subject);

            Add(new GumpPicTiled(30, 106, 235, 4, 0x0835));

            _databox.Add
            (
                _textBox = new StbTextBox
                               (useUnicode ? unicodeFontIndex : (byte)9, -1, 220, hue: textColor, isunicode: useUnicode)
            {
                X          = 40,
                Y          = 0,
                Width      = 220,
                Height     = 300,
                IsEditable = variant == 0,
                Multiline  = true
            }
            );

            _textBox.SetText(data);
            _textBox.TextChanged += _textBox_TextChanged;

            switch (variant)
            {
            case 0:
                Add(new GumpPic(97, 12, 0x0883, 0));

                Add
                (
                    _buttonPost = new Button((int)ButtonType.Post, 0x0886, 0x0886)
                {
                    X                = 37,
                    Y                = Height - 50,
                    ButtonAction     = ButtonAction.Activate,
                    ContainsByBounds = true
                }
                );

                break;

            case 1:

                Add
                (
                    _buttonReply = new Button((int)ButtonType.Reply, 0x0884, 0x0884)
                {
                    X                = 37,
                    Y                = Height - 50,
                    ButtonAction     = ButtonAction.Activate,
                    ContainsByBounds = true
                }
                );

                break;

            case 2:

                Add
                (
                    _buttonRemove = new Button((int)ButtonType.Remove, 0x0885, 0x0885)      //DISABLED
                {
                    X                = 235,
                    Y                = Height - 50,
                    ButtonAction     = ButtonAction.Activate,
                    ContainsByBounds = true
                }
                );

                break;
            }

            _databox.WantUpdateSize = true;
            _databox.ReArrangeChildren();
        }
예제 #5
0
        public ChatGump() : base(0, 0)
        {
            CanMove                = true;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = true;
            WantUpdateSize         = false;
            Width  = 345;
            Height = 390;

            Add
            (
                new ResizePic(0x0A28)
            {
                Width  = Width,
                Height = Height
            }
            );

            int startY = 25;

            Label text = new Label
                         (
                ResGumps.Channels,
                false,
                0x0386,
                345,
                2,
                FontStyle.None,
                TEXT_ALIGN_TYPE.TS_CENTER
                         )
            {
                Y = startY
            };

            Add(text);

            startY += 40;

            Add
            (
                new BorderControl
                (
                    61,
                    startY - 3,
                    220 + 8,
                    200 + 6,
                    3
                )
            );

            Add(new AlphaBlendControl(0)
            {
                X = 64, Y = startY, Width = 220, Height = 200
            });

            ScrollArea area = new ScrollArea
                              (
                64,
                startY,
                220,
                200,
                true
                              )
            {
                ScrollbarBehaviour = ScrollbarBehaviour.ShowAlways
            };

            Add(area);

            _databox = new DataBox(0, 0, 1, 1);
            _databox.WantUpdateSize = true;
            area.Add(_databox);

            foreach (KeyValuePair <string, ChatChannel> k in ChatManager.Channels)
            {
                ChannelListItemControl chan = new ChannelListItemControl(k.Key, 195);
                _databox.Add(chan);
                _channelList.Add(chan);
            }

            _databox.ReArrangeChildren();

            startY = 275;

            text = new Label
                   (
                ResGumps.YourCurrentChannel,
                false,
                0x0386,
                345,
                2,
                FontStyle.None,
                TEXT_ALIGN_TYPE.TS_CENTER
                   )
            {
                Y = startY
            };

            Add(text);

            startY += 25;

            _currentChannelLabel = new Label
                                   (
                ChatManager.CurrentChannelName,
                false,
                0x0386,
                345,
                2,
                FontStyle.None,
                TEXT_ALIGN_TYPE.TS_CENTER
                                   )
            {
                Y = startY
            };

            Add(_currentChannelLabel);


            startY = 337;

            Button button = new Button(0, 0x0845, 0x0846, 0x0845)
            {
                X            = 48,
                Y            = startY + 5,
                ButtonAction = ButtonAction.Activate
            };

            Add(button);

            button = new Button(1, 0x0845, 0x0846, 0x0845)
            {
                X            = 123,
                Y            = startY + 5,
                ButtonAction = ButtonAction.Activate
            };

            Add(button);

            button = new Button(2, 0x0845, 0x0846, 0x0845)
            {
                X            = 216,
                Y            = startY + 5,
                ButtonAction = ButtonAction.Activate
            };

            Add(button);

            text = new Label
                   (
                ResGumps.Join,
                false,
                0x0386,
                0,
                2
                   )
            {
                X = 65,
                Y = startY
            };

            Add(text);

            text = new Label
                   (
                ResGumps.Leave,
                false,
                0x0386,
                0,
                2
                   )
            {
                X = 140,
                Y = startY
            };

            Add(text);

            text = new Label
                   (
                ResGumps.Create,
                false,
                0x0386,
                0,
                2
                   )
            {
                X = 233,
                Y = startY
            };

            Add(text);
        }
예제 #6
0
        public ServerSelectionGump() : base(0, 0)
        {
            //AddChildren(new LoginBackground(true));

            Add
            (
                new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2)
            {
                X = 586, Y = 445, ButtonAction = ButtonAction.Activate
            }
            );

            Add
            (
                new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5)
            {
                X = 610, Y = 445, ButtonAction = ButtonAction.Activate
            }
            );

            if (Client.Version >= ClientVersion.CV_500A)
            {
                ushort textColor = 0xFFFF;

                Add
                (
                    new Label(ClilocLoader.Instance.GetString(1044579), true, textColor, font: 1)
                {
                    X = 155, Y = 70
                }
                ); // "Select which shard to play on:"

                Add
                (
                    new Label(ClilocLoader.Instance.GetString(1044577), true, textColor, font: 1)
                {
                    X = 400, Y = 70
                }
                ); // "Latency:"

                Add
                (
                    new Label(ClilocLoader.Instance.GetString(1044578), true, textColor, font: 1)
                {
                    X = 470, Y = 70
                }
                ); // "Packet Loss:"

                Add
                (
                    new Label(ClilocLoader.Instance.GetString(1044580), true, textColor, font: 1)
                {
                    X = 153, Y = 368
                }
                ); // "Sort by:"
            }
            else
            {
                ushort textColor = 0x0481;

                Add
                (
                    new Label(ResGumps.SelectWhichShardToPlayOn, false, textColor, font: 9)
                {
                    X = 155, Y = 70
                }
                );

                Add
                (
                    new Label(ResGumps.Latency, false, textColor, font: 9)
                {
                    X = 400, Y = 70
                }
                );

                Add
                (
                    new Label(ResGumps.PacketLoss, false, textColor, font: 9)
                {
                    X = 470, Y = 70
                }
                );

                Add
                (
                    new Label(ResGumps.SortBy, false, textColor, font: 9)
                {
                    X = 153, Y = 368
                }
                );
            }

            Add
            (
                new Button((int)Buttons.SortTimeZone, 0x093B, 0x093C, 0x093D)
            {
                X = 230, Y = 366
            }
            );

            Add
            (
                new Button((int)Buttons.SortFull, 0x093E, 0x093F, 0x0940)
            {
                X = 338, Y = 366
            }
            );

            Add
            (
                new Button((int)Buttons.SortConnection, 0x0941, 0x0942, 0x0943)
            {
                X = 446, Y = 366
            }
            );

            // World Pic Bg
            Add(new GumpPic(150, 390, 0x0589, 0));

            // Earth
            Add
            (
                new Button((int)Buttons.Earth, 0x15E8, 0x15EA, 0x15E9)
            {
                X = 160, Y = 400, ButtonAction = ButtonAction.Activate
            }
            );

            // Sever Scroll Area Bg
            Add
            (
                new ResizePic(0x0DAC)
            {
                X = 150, Y = 90, Width = 393 - 14, Height = 271
            }
            );

            // Sever Scroll Area
            ScrollArea scrollArea = new ScrollArea
                                    (
                150,
                90,
                393,
                271,
                true
                                    );

            DataBox databox = new DataBox(0, 0, 1, 1);

            databox.WantUpdateSize = true;
            LoginScene loginScene = Client.Game.GetScene <LoginScene>();

            scrollArea.ScissorRectangle.Y      = 16;
            scrollArea.ScissorRectangle.Height = -32;

            foreach (ServerListEntry server in loginScene.Servers)
            {
                databox.Add(new ServerEntryGump(server, 5, NORMAL_COLOR, SELECTED_COLOR));
            }

            databox.ReArrangeChildren();

            Add(scrollArea);
            scrollArea.Add(databox);

            if (loginScene.Servers.Length != 0)
            {
                int index = Settings.GlobalSettings.LastServerNum - 1;

                if (index < 0 || index >= loginScene.Servers.Length)
                {
                    index = 0;
                }

                Add
                (
                    new Label(loginScene.Servers[index].Name, false, 0x0481, font: 9)
                {
                    X = 243,
                    Y = 420
                }
                );
            }

            AcceptKeyboardInput    = true;
            CanCloseWithRightClick = false;
        }
예제 #7
0
        public StandardSkillsGump() : base(0, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = true;
            CanCloseWithRightClick = true;

            Height = 200 + _diffY;

            Add(_gumpPic = new GumpPic(160, 0, 0x82D, 0));
            _gumpPic.MouseDoubleClick += _picBase_MouseDoubleClick;

            _scrollArea = new ExpandableScroll(0, _diffY, Height, 0x1F40)
            {
                TitleGumpID      = 0x0834,
                AcceptMouseInput = true
            };

            Add(_scrollArea);

            Add(new GumpPic(50, 35 + _diffY, 0x082B, 0));
            Add(_bottomLine    = new GumpPic(50, Height - 98, 0x082B, 0));
            Add(_bottomComment = new GumpPic(25, Height - 85, 0x0836, 0));

            _area = new ScrollArea
                    (
                22, 45 + _diffY + _bottomLine.Height - 10, _scrollArea.Width - 14, _scrollArea.Height - (83 + _diffY),
                false
                    )
            {
                AcceptMouseInput = true, CanMove = true
            };

            Add(_area);

            _container = new DataBox(0, 0, 1, 1);
            _container.WantUpdateSize   = true;
            _container.AcceptMouseInput = true;
            _container.CanMove          = true;

            _area.Add(_container);

            Add
            (
                _skillsLabelSum = new Label(World.Player.Skills.Sum(s => s.Value).ToString("F1"), false, 600, 0, 3)
            {
                X = _bottomComment.X + _bottomComment.Width + 5, Y = _bottomComment.Y - 5
            }
            );

            //new group
            Add
            (
                _newGroupButton = new Button(0, 0x083A, 0x083A, 0x083A)
            {
                X = 60,
                Y = Height,
                ContainsByBounds = true,
                ButtonAction     = ButtonAction.Activate
            }
            );

            Add
            (
                _checkReal = new Checkbox(0x938, 0x939, ResGumps.ShowReal, 1, 0x0386, false)
            {
                X = _newGroupButton.X + _newGroupButton.Width + 30, Y = _newGroupButton.Y - 6
            }
            );

            Add
            (
                _checkCaps = new Checkbox(0x938, 0x939, ResGumps.ShowCaps, 1, 0x0386, false)
            {
                X = _newGroupButton.X + _newGroupButton.Width + 30, Y = _newGroupButton.Y + 7
            }
            );

            _checkReal.ValueChanged += UpdateSkillsValues;
            _checkCaps.ValueChanged += UpdateSkillsValues;


            if (World.Player != null)
            {
                foreach (SkillsGroup g in SkillsGroupManager.Groups)
                {
                    SkillsGroupControl control = new SkillsGroupControl(g, 3, 3);
                    _skillsControl.Add(control);
                    _container.Add(control);

                    control.IsMinimized = true;

                    int count = g.Count;

                    for (int i = 0; i < count; i++)
                    {
                        byte index = g.GetSkill(i);

                        if (index < SkillsLoader.Instance.SkillsCount)
                        {
                            control.AddSkill(index, 0, 17 + i * 17);
                        }
                    }
                }
            }

            _hitBox = new HitBox(160, 0, 23, 24);
            Add(_hitBox);
            _hitBox.MouseUp += _hitBox_MouseUp;

            _container.ReArrangeChildren();
        }
예제 #8
0
        public InspectorGump(GameObject obj) : base(0, 0)
        {
            X                      = 200;
            Y                      = 100;
            _obj                   = obj;
            CanMove                = true;
            AcceptMouseInput       = false;
            CanCloseWithRightClick = true;
            Add(new BorderControl(0, 0, WIDTH, HEIGHT, 4));

            Add
            (
                new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            }
            );

            Add
            (
                new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            }
            );

            Add(new Label(ResGumps.ObjectInformation, true, 1153, font: 3)
            {
                X = 20, Y = 10
            });
            Add(new Line(20, 30, WIDTH - 50, 1, 0xFFFFFFFF));

            Add
            (
                new NiceButton(WIDTH - 115, 5, 100, 25, ButtonAction.Activate, ResGumps.Dump)
            {
                ButtonParameter = 0
            }
            );

            ScrollArea scrollArea = new ScrollArea(20, 35, WIDTH - 40, HEIGHT - 45, true)
            {
                AcceptMouseInput = true
            };

            Add(scrollArea);

            DataBox databox = new DataBox(0, 0, 1, 1);

            databox.WantUpdateSize = true;
            scrollArea.Add(databox);

            Dictionary <string, string> dict = ReflectionHolder.GetGameObjectProperties(obj);

            if (dict != null)
            {
                int startX = 5;
                int startY = 5;

                foreach (KeyValuePair <string, string> item in dict.OrderBy(s => s.Key))
                {
                    Label label = new Label(item.Key + ":", true, 33, font: 1, style: FontStyle.BlackBorder)
                    {
                        X = startX,
                        Y = startY
                    };

                    databox.Add(label);

                    int height = label.Height;

                    label = new Label
                                (item.Value, true, 1153, font: 1, style: FontStyle.BlackBorder, maxwidth: WIDTH - 65 - 200)
                    {
                        X = startX + 200,
                        Y = startY,
                        AcceptMouseInput = true
                    };

                    label.MouseUp += OnLabelClick;

                    if (label.Height > 0)
                    {
                        height = label.Height;
                    }

                    databox.Add(label);
                    databox.Add(new Line(startX, startY + height + 2, WIDTH - 65, 1, Color.Gray.PackedValue));

                    startY += height + 4;
                }
            }

            databox.ReArrangeChildren();
        }
예제 #9
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);
        }
예제 #10
0
        public StandardSkillsGump() : base(0, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = true;
            CanCloseWithRightClick = true;

            Height = 200 + _diffY;

            Add(_gumpPic = new GumpPic(160, 0, 0x82D, 0));
            _gumpPic.MouseDoubleClick += _picBase_MouseDoubleClick;

            _scrollArea = new ExpandableScroll(0, _diffY, Height, 0x1F40)
            {
                TitleGumpID      = 0x0834,
                AcceptMouseInput = true
            };

            Add(_scrollArea);

            Add(new GumpPic(50, 35 + _diffY, 0x082B, 0));
            Add(_bottomLine    = new GumpPic(50, Height - 98, 0x082B, 0));
            Add(_bottomComment = new GumpPic(25, Height - 85, 0x0836, 0));

            _area = new ScrollArea
                    (
                22,
                45 + _diffY + _bottomLine.Height - 10,
                _scrollArea.Width - 14,
                _scrollArea.Height - (83 + _diffY),
                false
                    )
            {
                AcceptMouseInput = true, CanMove = true
            };

            Add(_area);

            _container = new DataBox(0, 0, 1, 1);
            _container.WantUpdateSize   = true;
            _container.AcceptMouseInput = true;
            _container.CanMove          = true;

            _area.Add(_container);

            Add
            (
                _skillsLabelSum = new Label
                                  (
                    World.Player.Skills.Sum(s => s.Value).ToString("F1"),
                    false,
                    600,
                    0,
                    3
                                  )
            {
                X = _bottomComment.X + _bottomComment.Width + 5, Y = _bottomComment.Y - 5
            }
            );

            //new group
            int x = 60;

            Add
            (
                _newGroupButton = new Button(0, 0x083A, 0x083A, 0x083A)
            {
                X = x,
                Y = Height,
                ContainsByBounds = true,
                ButtonAction     = ButtonAction.Activate
            }
            );

            Add
            (
                _checkReal = new Checkbox
                             (
                    0x938,
                    0x939,
                    ResGumps.ShowReal,
                    1,
                    0x0386,
                    false
                             )
            {
                X = _newGroupButton.X + _newGroupButton.Width + 30, Y = _newGroupButton.Y - 6
            }
            );

            Add
            (
                _checkCaps = new Checkbox
                             (
                    0x938,
                    0x939,
                    ResGumps.ShowCaps,
                    1,
                    0x0386,
                    false
                             )
            {
                X = _newGroupButton.X + _newGroupButton.Width + 30, Y = _newGroupButton.Y + 7
            }
            );

            _checkReal.ValueChanged += UpdateSkillsValues;
            _checkCaps.ValueChanged += UpdateSkillsValues;


            LoadSkills();

            Add(_resetGroups = new NiceButton(_scrollArea.X + 25, _scrollArea.Y + 7, 100, 18,
                                              ButtonAction.Activate, ResGumps.ResetGroups,
                                              unicode: false,
                                              font: 6)
            {
                ButtonParameter = 1,
                IsSelectable    = false,
                //Alpha = 1f
            });

            _hitBox = new HitBox(160, 0, 23, 24);
            Add(_hitBox);
            _hitBox.MouseUp += _hitBox_MouseUp;

            _container.ReArrangeChildren();
        }
예제 #11
0
        public StandardSkillsGump() : base(0, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = true;
            CanCloseWithRightClick = true;

            Height = 600;

            Add(_background    = new ExpandableScroll(0, _diffY - 65, Height - _diffY, 0x820));
            Add(_gumpPic       = new GumpPic(245, 0, 0x2C94, 0));
            Add(_bottomComment = new GumpPic(25, Height - 85, 0x0836, 0));

            _area = new ScrollArea
                    (
                22,
                _diffY + 10,
                _background.Width - 14,
                _background.Height - (83 + _diffY),
                false
                    )
            {
                AcceptMouseInput = true, CanMove = true
            };

            Add(_area);

            _container = new DataBox(0, 0, 1, 1);
            _container.WantUpdateSize   = true;
            _container.AcceptMouseInput = true;
            _container.CanMove          = true;

            _area.Add(_container);

            Add
            (
                _skillsLabelSum = new Label
                                  (
                    World.Player.Skills.Sum(s => s.Value).ToString("F1"),
                    true,
                    0x04EC,
                    200,
                    0
                                  )
            {
                X = _bottomComment.X - 20 + _bottomComment.Width + 5, Y = _bottomComment.Y - 5
            }
            );


            _databox = new DataBox(25, _background.Height + 3, 1, 1);
            _databox.WantUpdateSize = true;

            _databox.Add(new GumpPic(2, 22, 0x005F, 0));

            _databox.Add
            (
                new GumpPicTiled
                (
                    13,
                    31,
                    245,
                    0,
                    0x0060
                )
            );

            _databox.Add(new GumpPic(250, 22, 0x0061, 0));
            _background.Add(_databox);

            //new group
            int x = 50;

            Add
            (
                _newGroupButton = new Button(0, 0x8B, 0x8D, 0x8C)
            {
                X = x,
                Y = Height,
                ContainsByBounds = true,
                ButtonAction     = ButtonAction.Activate
            }
            );

            Add
            (
                _checkReal = new Checkbox
                             (
                    0x938,
                    0x939,
                    ResGumps.ShowReal,
                    1,
                    0x0386,
                    false
                             )
            {
                X = _newGroupButton.X - 5 + _newGroupButton.Width + 30, Y = _newGroupButton.Y - 4
            }
            );

            Add
            (
                _checkCaps = new Checkbox
                             (
                    0x938,
                    0x939,
                    ResGumps.ShowCaps,
                    1,
                    0x0386,
                    false
                             )
            {
                X = _newGroupButton.X - 5 + _newGroupButton.Width + 30, Y = _newGroupButton.Y + 9
            }
            );

            _checkReal.ValueChanged += UpdateSkillsValues;
            _checkCaps.ValueChanged += UpdateSkillsValues;

            LoadSkills();

            Add(_resetGroups = new NiceButton(57, _background.Height + 15, 82, 18,
                                              ButtonAction.Activate, ResGumps.ResetGroups,
                                              hue: 0x26,
                                              unicode: true,
                                              font: 1)
            {
                ButtonParameter = 1,
                IsSelectable    = false,
                //Alpha = 1f
            });

            Add(_hitBox                = new HitBox(245, 0, 15, 20));
            _hitBox.MouseUp           += _hitBox_MouseUp;
            _gumpPic.MouseDoubleClick += _gumpPic_MouseDoubleClick;

            _container.ReArrangeChildren();
        }