Exemple #1
0
        public ProfileGump(Serial serial, string header, string footer, string body, bool canEdit) : base(serial, serial)
        {
            CanMove = true;

            AcceptKeyboardInput = true;

            Add(_background = new ExpandableScroll(0, 0, 300));
            _scrollBar = new ScrollFlag( 0, 0, Height, true);
            Add(_scrollBar);
            AddHorizontalBar(92, 40, 40, 220);
            Add(new Label(header, true, 0, font: 1, maxwidth: 140)
            {
                X = 90,
                Y = 32,
            });

            Add(_textBox = new MultiLineBox(new MultiLineEntry(1, width: 220, maxWidth: 220, hue: 0), canEdit)
            {
                X = 40,
                Y = 82,
                Width = 220,
                ScissorsEnabled = true,
                Text = body
            });

            /*
			AddHorizontalBar(95, 40, _textBox.Y + _textBox.Height, 220);
			AddChildren(new Label(footer, true, 0, font: 1, maxwidth: 220)
			{
				X = 40, Y = _textBox.Y + _textBox.Height + 20,
			});
			*/
        }
Exemple #2
0
        public ProfileGump(Serial serial, string header, string footer, string body, bool canEdit) : base(serial, serial)
        {
            Height              = 300;
            CanMove             = true;
            AcceptKeyboardInput = true;
            Add(_scrollExp      = new ExpandableScroll(0, 0, Height, 0x0820));
            _scrollArea         = new ScrollArea(0, 32, 272, Height - 96, false);

            Control c = new Label(header, true, 0, font: 1, maxwidth: 140)
            {
                X = 85,
                Y = 0
            };

            _scrollArea.Add(c);
            AddHorizontalBar(_scrollArea, 92, 35, 220);

            _textBox = new MultiLineBox(new MultiLineEntry(1, -1, 0, 220, true, hue: 0), canEdit)
            {
                Height = FileManager.Fonts.GetHeightUnicode(1, body, 220, TEXT_ALIGN_TYPE.TS_LEFT, 0x0),
                X      = 35,
                Y      = 0,
                Text   = _originalText = body
            };
            _scrollArea.Add(_textBox);
            AddHorizontalBar(_scrollArea, 95, 35, 220);

            _scrollArea.Add(new Label(footer, true, 0, font: 1, maxwidth: 220)
            {
                X = 35,
                Y = 0
            });
            Add(_scrollArea);
        }
        public TipNoticeGump(byte type, string page) : base(0, 0)
        {
            Height     = 300;
            CanMove    = true;
            CanBeSaved = true;

            _scrollArea = new ScrollArea(0, 32, 272, Height - 96, false);

            _textBox = new MultiLineBox(new MultiLineEntry(1, -1, 0, 220, true, hue: 0), false)
            {
                Height = 20,
                X      = 35,
                Y      = 0,
                Text   = page
            };
            Add(_background = new ExpandableScroll(0, 0, Height, 0x0820));
            _scrollArea.Add(_textBox);
            Add(_scrollArea);

            if (type == 0)
            {
                _pages = new OrderedDictionary <uint, string>();
                _tips  = this;
                _background.TitleGumpID = 0x9CA;
                _idx = 0;
                Button b;
                Add(_prev = new Button(0, 0x9cc, 0x9cc)
                {
                    X = 35, ContainsByBounds = true
                });

                _prev.MouseUp += (o, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        SetPage(_idx - 1);
                    }
                };
                Add(_next = new Button(0, 0x9cd, 0x9cd)
                {
                    X = 240, ContainsByBounds = true
                });

                _next.MouseUp += (o, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        SetPage(_idx + 1);
                    }
                };
            }
            else
            {
                _background.TitleGumpID = 0x9D2;
            }
        }
Exemple #4
0
        public ProfileGump(uint serial, string header, string footer, string body, bool canEdit) : base(serial == World.Player.Serial ? serial = Constants.PROFILE_LOCALSERIAL : serial, serial)
        {
            Height                 = 300 + _diffY;
            CanMove                = true;
            AcceptKeyboardInput    = true;
            CanCloseWithRightClick = true;

            Add(_gumpPic = new GumpPic(143, 0, 0x82D, 0));
            _gumpPic.MouseDoubleClick += _picBase_MouseDoubleClick;
            Add(_scrollExp             = new ExpandableScroll(0, _diffY, Height - _diffY, 0x0820));
            _scrollArea = new ScrollArea(0, 32 + _diffY, 272, Height - (96 + _diffY), false);

            Control c = new Label(header, true, 0, font: 1, maxwidth: 140)
            {
                X = 85,
                Y = 0
            };

            _scrollArea.Add(c);
            AddHorizontalBar(_scrollArea, 92, 35, 220);

            _textBox = new MultiLineBox(new MultiLineEntry(1, -1, 0, 220, true, hue: 0), canEdit)
            {
                Height = FontsLoader.Instance.GetHeightUnicode(1, body, 220, TEXT_ALIGN_TYPE.TS_LEFT, 0x0),
                Width  = 220,
                X      = 35,
                Y      = 0,
                Text   = _originalText = body
            };
            _scrollArea.Add(_textBox);
            AddHorizontalBar(_scrollArea, 95, 35, 220);

            _scrollArea.Add(new Label(footer, true, 0, font: 1, maxwidth: 220)
            {
                X = 35,
                Y = 0
            });
            Add(_scrollArea);

            Add(_hitBox      = new HitBox(143, 0, 23, 24));
            _hitBox.MouseUp += _hitBox_MouseUp;
        }
Exemple #5
0
 private void RefreshShowCaretPos(int pos, MultiLineBox box)
 {
     box.SetKeyboardFocus();
     box.TxEntry.SetCaretPosition(pos);
     box.TxEntry.UpdateCaretPosition();
 }
Exemple #6
0
        private void BuildGump(string[] pages)
        {
            CanCloseWithRightClick = true;
            Add(new GumpPic(0, 0, 0x1FE, 0)
            {
                CanMove = true
            });

            Add(m_Backward = new GumpPic(0, 0, 0x1FF, 0));

            Add(m_Forward = new GumpPic(356, 0, 0x200, 0));

            m_Forward.MouseUp += (sender, e) =>
            {
                if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                {
                    SetActivePage(ActivePage + 1);
                }
            };

            m_Forward.MouseDoubleClick += (sender, e) =>
            {
                if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                {
                    SetActivePage(MaxPage);
                }
            };

            m_Backward.MouseUp += (sender, e) =>
            {
                if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                {
                    SetActivePage(ActivePage - 1);
                }
            };

            m_Backward.MouseDoubleClick += (sender, e) =>
            {
                if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                {
                    SetActivePage(1);
                }
            };

            PageChanged = new bool[BookPageCount + 1];
            Add(BookTitle, 1);
            Add(new Label("by", true, 1)
            {
                X = BookAuthor.X, Y = BookAuthor.Y - 30
            }, 1);
            Add(BookAuthor, 1);

            for (int k = 1; k <= BookPageCount; k++)
            {
                int x = 38;
                int y = 30;

                if (k % 2 == 1)
                {
                    x = 223;
                    //right hand page
                }

                int page = k + 1;

                if (page % 2 == 1)
                {
                    page += 1;
                }
                page >>= 1;

                string       text = k <= pages.Length ? pages[k - 1] : "";
                MultiLineBox tbox = new MultiLineBox(new MultiLineEntry(DefaultFont, MaxBookChars * MaxBookLines, 0, 155, IsNewBook, FontStyle.ExtraHeight, 2), IsEditable)
                {
                    X          = x,
                    Y          = y,
                    Height     = 170,
                    Width      = 155,
                    IsEditable = IsEditable,
                    Text       = text,
                    MaxLines   = MaxBookLines
                };
                Add(tbox, page);
                m_Pages.Add(tbox);

                tbox.MouseUp += (sender, e) =>
                {
                    if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                    {
                        OnLeftClick();
                    }
                };

                tbox.MouseDoubleClick += (sender, e) =>
                {
                    if (e.Button == MouseButtonType.Left && sender is Control ctrl)
                    {
                        OnLeftClick();
                    }
                };
                Add(new Label(k.ToString(), true, 1)
                {
                    X = x + 80, Y = 200
                }, page);
            }

            _activated = 1;
            ActivePage = 1;
            UpdatePageButtonVisibility();

            Client.Game.Scene.Audio.PlaySound(0x0055);
        }
        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 = new ScrollArea(0, 120, 272, 224, false);

            AddHorizontalBar(_scrollArea, 92, 35, 220);

            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("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("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("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 TextBox(useUnicode ? unicodeFontIndex : (byte)9, maxWidth: 150, width: 150,
                                              isunicode: useUnicode, hue: subjectColor)
            {
                X          = 30 + text.Width,
                Y          = 83 + unicodeFontHeightOffset,
                Width      = 150,
                IsEditable = variant == 0 ? true : false
            });
            _subjectTextbox.SetText(subject);

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

            _scrollArea.Add(_textBox =
                                new MultiLineBox(
                                    new MultiLineEntry(useUnicode ? unicodeFontIndex : (byte)9, -1, 0, 220, hue: textColor,
                                                       unicode: useUnicode), true)
            {
                X               = 40,
                Y               = 0,
                Width           = 220,
                ScissorsEnabled = true,
                Text            = data,
                IsEditable      = variant == 0 ? true : false
            });
            Add(_scrollArea);
            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;
            }
        }
        public BulletinBoardItem(Serial serial, Serial msgSerial, string poster, string subject, string datatime, string data, byte variant) : base(serial, 0)
        {
            _msgSerial             = msgSerial;
            AcceptKeyboardInput    = true;
            CanMove                = true;
            CanCloseWithRightClick = true;

            Add(new ExpandableScroll(0, 0, 250, 0x0820)
            {
                TitleGumpID = 0x0820
            });
            _scrollBar = new ScrollFlag(0, 0, Height, true);
            Add(_scrollBar);
            bool useUnicode              = FileManager.ClientVersion >= ClientVersions.CV_305D;
            byte unicodeFontIndex        = 1;
            int  unicodeFontHeightOffset = 0;

            ushort textColor = 0x0386;

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

            Label text = new Label("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("Time:", useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)6)
            {
                X = 30,
                Y = 56
            };
            Add(text);

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


            text = new Label("Subject:", useUnicode, textColor, font: useUnicode ? unicodeFontIndex : (byte)6)
            {
                X = 30,
                Y = 72
            };
            Add(text);


            ushort subjectColor = textColor;

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

            //HitBox hitBox = new HitBox(30 + text.Width, 78, 160, 16)
            //{
            //    IsTransparent = true,
            //    Alpha = 1
            //};
            //AddChildren(hitBox);


            Add(_subjectTextbox = new TextBox(useUnicode ? unicodeFontIndex : (byte)9, maxWidth: 150, width: 150, isunicode: useUnicode, hue: subjectColor)
            {
                X     = 30 + text.Width,
                Y     = 78 + unicodeFontHeightOffset,
                Width = 150
            });
            _subjectTextbox.SetText(subject);


            Add(new GumpPicTiled(30, 100, 204, 4, 0x0835));

            Add(_textBox = new MultiLineBox(new MultiLineEntry(useUnicode ? unicodeFontIndex : (byte)9, width: 220, maxWidth: 220, hue: textColor, unicode: useUnicode), true)
            {
                X               = 40,
                Y               = 120,
                Width           = 220,
                ScissorsEnabled = true,
                Text            = data
            });

            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)
                {
                    X                = 235,
                    Y                = Height - 50,
                    ButtonAction     = ButtonAction.Activate,
                    ContainsByBounds = true
                });

                break;
            }
        }