public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { if (IsInitialized && _text == null) { ResizePic resize; _text = new HtmlGump(this, 0, 10, 10, 200, 200, 0, 0, _msg); int width = _text.Width + 20; AddControl(resize = new ResizePic(this, 0, 0, 0, 9200, width, _text.Height + 45)); AddControl(_text); // Add buttons switch (_type) { case MsgBoxTypes.OkOnly: AddControl(new Button(this, 0, (_text.Width + 20) / 2 - 23, _text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0)); ((Button)LastControl).GumpOverID = 2076; break; case MsgBoxTypes.OkCancel: AddControl(new Button(this, 0, (width / 2) - 46 - 10, _text.Height + 15, 0x817, 0x818, ButtonTypes.Activate, 0, 1)); ((Button)LastControl).GumpOverID = 0x819; AddControl(new Button(this, 0, (width / 2) + 10, _text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0)); ((Button)LastControl).GumpOverID = 2076; break; } base.Update(gameTime); Center(); } base.Update(gameTime); }
void buildGumpling(int x, int y, int width, int index, int itemsVisible, string[] items, bool canBeNull) { Position = new Point2D(x, y); _items = new List<string>(items); _width = width; Index = index; _visibleItems = itemsVisible; _canBeNull = canBeNull; _resize = new ResizePic(_owner, Page, X, Y, 3000, _width, Data.ASCIIText.Fonts[1].Height + 8); _resize.OnMouseClick = onClickClosedList; _resize.OnMouseOver = onMouseOverClosedList; _resize.OnMouseOut = onMouseOutClosedList; ((Gump)_owner).AddControl(_resize); _label = new TextLabelAscii(_owner, Page, X + 4, Y + 5, hue_Text, 1, string.Empty); ((Gump)_owner).AddControl(_label); ((Gump)_owner).AddControl(new GumpPic(_owner, Page, X + width - 22, Y + 5, 2086, 0)); }
void onClickClosedList(int x, int y, MouseButton button) { _listOpen = true; _openResizePic = new ResizePic(_owner, Page, X, Y, 3000, _width, Data.ASCIIText.Fonts[1].Height * _visibleItems + 8); _openResizePic.OnMouseClick = onClickOpenList; _openResizePic.OnMouseOver = onMouseOverOpenList; _openResizePic.OnMouseOut = onMouseOutOpenList; ((Gump)_owner).AddControl(_openResizePic); // only show the scrollbar if we need to scroll if (_visibleItems < _items.Count) { _openScrollBar = new ScrollBar(_owner, Page, X + _width - 20, Y + 4, Data.ASCIIText.Fonts[1].Height * _visibleItems, (_canBeNull ? -1 : 0), _items.Count - _visibleItems, Index); ((Gump)_owner).AddControl(_openScrollBar); } _openLabels = new TextLabelAscii[_visibleItems]; for (int i = 0; i < _visibleItems; i++) { _openLabels[i] = new TextLabelAscii(_owner, Page, X + 4, Y + 5 + Data.ASCIIText.Fonts[1].Height * i, 1107, 1, string.Empty); ((Gump)_owner).AddControl(_openLabels[i]); } }