private Gump CreateLabel(string text, bool scroll) { text = text.Replace('\r', '\n'); GBackground background = new GBackground(0xbbc, 200, 100, true); GWrappedLabel toAdd = new GWrappedLabel(text, Engine.GetFont(1), Hues.Load(0x455), background.OffsetX, background.OffsetY, background.UseWidth); background.Height = toAdd.Height + (background.Height - background.UseHeight); background.Children.Add(toAdd); toAdd.Center(); background.SetMouseOverride(this); return background; }
private Gump CreateLabel(string text, bool scroll) { text = text.Replace('\r', '\n'); GBackground background = new GBackground(0xbbc, 200, 100, true); GWrappedLabel toAdd = new GWrappedLabel(text, Engine.GetFont(1), Hues.Load(0x455), background.OffsetX, background.OffsetY, background.UseWidth); background.Height = toAdd.Height + (background.Height - background.UseHeight); background.Children.Add(toAdd); toAdd.Center(); background.SetMouseOverride(this); return(background); }
public GIdleWarning() : base(0xa2c, 100, 100, 0, 0, true) { base.m_CanDrag = true; base.m_QuickDrag = true; GWrappedLabel toAdd = new GWrappedLabel("You have been idle for too long. If you do not do anything in the next minute, you will be logged out.", Engine.GetFont(2), Hues.Load(0x455), base.OffsetX, base.OffsetY - 12, 0x113); base.m_Children.Add(toAdd); GButtonNew new2 = new GButtonNew(0x481, 0, (toAdd.Y + toAdd.Height) + 4); new2.Clicked += new EventHandler(this.Check_Clicked); base.m_Children.Add(new2); this.Width = (this.Width - base.UseWidth) + toAdd.Width; this.Height = ((this.Height - base.UseHeight) + toAdd.Height) - 12; new2.X = base.OffsetX + ((base.UseWidth - new2.Width) / 2); this.Center(); }
public GUpdateScroll(string text) : base(0x13c2, 100, 100, 40, 30, true) { GLabel toAdd = new GLabel("Updates", Engine.DefaultFont, Hues.Load(0x1f0), base.OffsetX, base.OffsetY); GBackground background = new GBackground(0xbbc, 100, 100, base.OffsetX, (toAdd.Y + toAdd.Height) + 4, true); GWrappedLabel label2 = new GWrappedLabel(text, Engine.GetFont(1), Hues.Load(0x455), background.OffsetX + 2, background.OffsetY + 2, 250); background.Width = ((background.Width - background.UseWidth) + label2.Width) + 6; background.Height = ((background.Height - background.UseHeight) + label2.Height) + 2; background.Children.Add(label2); this.Width = (this.Width - base.UseWidth) + background.Width; this.Height = (((this.Height - base.UseHeight) + toAdd.Height) + 4) + background.Height; toAdd.X += (base.UseWidth - toAdd.Width) / 2; base.m_CanDrag = true; base.m_QuickDrag = true; base.CanClose = true; background.SetMouseOverride(this); base.m_Children.Add(toAdd); base.m_Children.Add(background); }
public virtual Gump GetGump() { if (this.m_Gump == null) { GWrappedLabel label; if ((this.m_Text == null) || (this.m_Text.Length <= 0)) { return((Gump)(this.m_Gump = null)); } this.m_Gump = new GAlphaBackground(0, 0, 100, 100); label = new GWrappedLabel(this.m_Text, Engine.GetUniFont(1), Hues.Load(0x481), 4, 4, this.m_WrapWidth) { X = label.X - label.Image.xMin, Y = label.Y - label.Image.yMin }; this.m_Gump.Width = (label.Image.xMax - label.Image.xMin) + 9; this.m_Gump.Height = (label.Image.yMax - label.Image.yMin) + 9; this.m_Gump.Children.Add(label); } return(this.m_Gump); }
public virtual Gump GetGump() { if (this.m_Gump == null) { GWrappedLabel label; if ((this.m_Text == null) || (this.m_Text.Length <= 0)) { return (Gump) (this.m_Gump = null); } this.m_Gump = new GAlphaBackground(0, 0, 100, 100); label = new GWrappedLabel(this.m_Text, Engine.GetUniFont(1), Hues.Load(0x481), 4, 4, this.m_WrapWidth) { X = label.X - label.Image.xMin, Y = label.Y - label.Image.yMin }; this.m_Gump.Width = (label.Image.xMax - label.Image.xMin) + 9; this.m_Gump.Height = (label.Image.yMax - label.Image.yMin) + 9; this.m_Gump.Children.Add(label); } return this.m_Gump; }
public GQuestionMenu(int serial, int menuID, string question, AnswerEntry[] answers) : base(0x23f4, Engine.ScreenWidth / 2, 100, 50, 50, true) { base.m_CanDrag = true; base.m_QuickDrag = true; this.m_Serial = serial; this.m_MenuID = menuID; GWrappedLabel toAdd = new GWrappedLabel(question, Engine.GetFont(1), Hues.Load(0x455), base.OffsetX + 4, base.OffsetY + 4, base.UseWidth - 8); base.m_Children.Add(toAdd); this.m_Entries = new GQuestionMenuEntry[answers.Length]; GBackground background = new GQuestionBackground(this.m_Entries, base.UseWidth - 8, ((base.UseHeight - 8) - toAdd.Height) - 4, base.OffsetX + 4, (toAdd.Y + toAdd.Height) + 4); background.SetMouseOverride(this); int offsetX = background.OffsetX; int offsetY = background.OffsetY; int useWidth = background.UseWidth; for (int i = 0; i < answers.Length; i++) { GQuestionMenuEntry entry = new GQuestionMenuEntry(offsetX, offsetY, useWidth, answers[i]); background.Children.Add(entry); entry.Radio.ParentOverride = background; this.m_Entries[i] = entry; offsetY += entry.Height + 4; } background.Height = ((offsetY - 4) - background.OffsetY) + (background.Height - background.UseHeight); this.Height = (((((this.Height - base.UseHeight) + 4) + toAdd.Height) + 4) + background.Height) + 4; int num5 = (int)(Engine.ScreenHeight * 0.75); if (this.Height > num5) { this.Height = num5; background.Height = ((base.UseHeight - 8) - toAdd.Height) - 4; } offsetY -= 4; offsetY -= background.OffsetY; if (offsetY > background.UseHeight) { int num6 = offsetY; background.Width += 0x13; this.Width += 0x13; offsetX = (background.OffsetX + background.UseWidth) - 15; offsetY = background.OffsetY; background.Children.Add(new GImage(0x101, offsetX, offsetY)); background.Children.Add(new GImage(0xff, offsetX, (offsetY + background.UseHeight) - 0x20)); for (int j = offsetY + 30; (j + 0x20) < background.UseHeight; j += 30) { background.Children.Add(new GImage(0x100, offsetX, j)); } this.m_Slider = new GVSlider(0xfe, offsetX + 1, (offsetY + 1) + 12, 13, (background.UseHeight - 2) - 0x18, 0.0, 0.0, (double)(num6 - background.UseHeight), 1.0); this.m_Slider.OnValueChange = new OnValueChange(this.OnScroll); this.m_Slider.ScrollOffset = 20.0; background.Children.Add(this.m_Slider); background.Children.Add(new GHotspot(offsetX, offsetY, 15, background.UseHeight, this.m_Slider)); } GButtonNew new2 = new GButtonNew(0xf3, 0xf2, 0xf1, 0, (background.Y + background.Height) + 4); GButtonNew new3 = new GButtonNew(0xf9, 0xf7, 0xf8, 0, new2.Y); new2.Clicked += new EventHandler(this.Cancel_Clicked); new3.Clicked += new EventHandler(this.Okay_Clicked); new2.X = ((base.OffsetX + base.UseWidth) - 4) - new2.Width; new3.X = (new2.X - 4) - new3.Width; base.m_Children.Add(new2); base.m_Children.Add(new3); this.Height += 4 + new2.Height; base.m_Children.Add(background); this.Center(); }
private static void StringQuery(PacketReader pvSrc) { GDragable dragable; GWrappedLabel label2; int num = pvSrc.ReadInt32(); short num2 = pvSrc.ReadInt16(); int fixedLength = pvSrc.ReadInt16(); string text = pvSrc.ReadString(fixedLength); bool flag = pvSrc.ReadBoolean(); byte num4 = pvSrc.ReadByte(); int num5 = pvSrc.ReadInt32(); int num6 = pvSrc.ReadInt16(); string str2 = pvSrc.ReadString(num6); dragable = new GDragable(0x474, 0, 0) { CanClose = false, Modal = true, X = (Engine.ScreenWidth - dragable.Width) / 2, Y = (Engine.ScreenHeight - dragable.Height) / 2 }; GButton toAdd = new GButton(0x47b, 0x47d, 0x47c, 0x75, 190, new OnClick(Engine.StringQueryOkay_OnClick)); GButton button2 = new GButton(0x478, 0x47a, 0x479, 0xcc, 190, flag ? new OnClick(Engine.StringQueryCancel_OnClick) : null); if (!flag) { button2.Enabled = false; } GImage image = new GImage(0x477, 60, 0x91); GWrappedLabel label = new GWrappedLabel(text, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110); label2 = new GWrappedLabel(str2, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110) { Y = image.Y - label2.Height }; GTextBox box = new GTextBox(0, false, 0x44, 140, image.Width - 8, image.Height, "", Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455)); box.Focus(); if (num4 == 1) { box.MaxChars = num5; } toAdd.SetTag("Dialog", dragable); toAdd.SetTag("Serial", num); toAdd.SetTag("Type", num2); toAdd.SetTag("Text", box); button2.SetTag("Dialog", dragable); button2.SetTag("Serial", num); button2.SetTag("Type", num2); dragable.Children.Add(label); dragable.Children.Add(label2); dragable.Children.Add(image); dragable.Children.Add(box); dragable.Children.Add(button2); dragable.Children.Add(toAdd); dragable.m_CanDrag = true; Gumps.Desktop.Children.Add(dragable); }
public GQuestionMenu(int serial, int menuID, string question, AnswerEntry[] answers) : base(0x23f4, Engine.ScreenWidth / 2, 100, 50, 50, true) { base.m_CanDrag = true; base.m_QuickDrag = true; this.m_Serial = serial; this.m_MenuID = menuID; GWrappedLabel toAdd = new GWrappedLabel(question, Engine.GetFont(1), Hues.Load(0x455), base.OffsetX + 4, base.OffsetY + 4, base.UseWidth - 8); base.m_Children.Add(toAdd); this.m_Entries = new GQuestionMenuEntry[answers.Length]; GBackground background = new GQuestionBackground(this.m_Entries, base.UseWidth - 8, ((base.UseHeight - 8) - toAdd.Height) - 4, base.OffsetX + 4, (toAdd.Y + toAdd.Height) + 4); background.SetMouseOverride(this); int offsetX = background.OffsetX; int offsetY = background.OffsetY; int useWidth = background.UseWidth; for (int i = 0; i < answers.Length; i++) { GQuestionMenuEntry entry = new GQuestionMenuEntry(offsetX, offsetY, useWidth, answers[i]); background.Children.Add(entry); entry.Radio.ParentOverride = background; this.m_Entries[i] = entry; offsetY += entry.Height + 4; } background.Height = ((offsetY - 4) - background.OffsetY) + (background.Height - background.UseHeight); this.Height = (((((this.Height - base.UseHeight) + 4) + toAdd.Height) + 4) + background.Height) + 4; int num5 = (int) (Engine.ScreenHeight * 0.75); if (this.Height > num5) { this.Height = num5; background.Height = ((base.UseHeight - 8) - toAdd.Height) - 4; } offsetY -= 4; offsetY -= background.OffsetY; if (offsetY > background.UseHeight) { int num6 = offsetY; background.Width += 0x13; this.Width += 0x13; offsetX = (background.OffsetX + background.UseWidth) - 15; offsetY = background.OffsetY; background.Children.Add(new GImage(0x101, offsetX, offsetY)); background.Children.Add(new GImage(0xff, offsetX, (offsetY + background.UseHeight) - 0x20)); for (int j = offsetY + 30; (j + 0x20) < background.UseHeight; j += 30) { background.Children.Add(new GImage(0x100, offsetX, j)); } this.m_Slider = new GVSlider(0xfe, offsetX + 1, (offsetY + 1) + 12, 13, (background.UseHeight - 2) - 0x18, 0.0, 0.0, (double) (num6 - background.UseHeight), 1.0); this.m_Slider.OnValueChange = new OnValueChange(this.OnScroll); this.m_Slider.ScrollOffset = 20.0; background.Children.Add(this.m_Slider); background.Children.Add(new GHotspot(offsetX, offsetY, 15, background.UseHeight, this.m_Slider)); } GButtonNew new2 = new GButtonNew(0xf3, 0xf2, 0xf1, 0, (background.Y + background.Height) + 4); GButtonNew new3 = new GButtonNew(0xf9, 0xf7, 0xf8, 0, new2.Y); new2.Clicked += new EventHandler(this.Cancel_Clicked); new3.Clicked += new EventHandler(this.Okay_Clicked); new2.X = ((base.OffsetX + base.UseWidth) - 4) - new2.Width; new3.X = (new2.X - 4) - new3.Width; base.m_Children.Add(new2); base.m_Children.Add(new3); this.Height += 4 + new2.Height; base.m_Children.Add(background); this.Center(); }
public static void MessageBoxOk(string Prompt, bool Modal, OnClick ClickHandler) { GBackground background = new GBackground(0xa2c, 0x164, 0xd4, 0x8e, 0x86, true); GButton toAdd = new GButton(0x481, 0xa4, 170, new OnClick(Gumps.MessageBoxOk_OnClick)); toAdd.SetTag("Dialog", background); toAdd.SetTag("ClickHandler", ClickHandler); GWrappedLabel label = new GWrappedLabel(Prompt, Engine.GetFont(1), Hues.Load(0x76b), background.OffsetX, background.OffsetY, (Engine.ScreenWidth / 2) - (background.OffsetX * 2)); background.Width = label.Width + (background.OffsetX * 2); background.Height = (label.Height + 10) + (background.OffsetY * 2); if (background.Width < 150) { background.Width = 150; } background.Center(); toAdd.X = (background.Width - toAdd.Width) / 2; toAdd.Y = background.Height - background.OffsetY; background.Children.Add(label); background.Children.Add(toAdd); if (Modal) { background.Modal = true; } background.m_CanDrag = true; background.m_QuickDrag = true; m_Desktop.Children.Add(background); }
private static bool Parse_Label(XmlTextReader xml, Gump Parent, string Name) { string text = ""; IFont defaultFont = Engine.DefaultFont; IHue huei = Hues.Default; int x = 0; int y = 0; int width = 0; bool flag = false; bool isEmptyElement = xml.IsEmptyElement; while (xml.MoveToNextAttribute()) { switch (xml.Name) { case "Text": { text = GetString(xml.Value); continue; } case "Texts": { text = xml.Value; continue; } case "Font": { defaultFont = GetFont(xml.Value); continue; } case "Fonti": { defaultFont = GetFonti(xml.Value); continue; } case "Fonth": { defaultFont = GetFonth(xml.Value); continue; } case "Hue": { huei = GetHue(xml.Value); continue; } case "Huei": { huei = GetHuei(xml.Value); continue; } case "Hueh": { huei = GetHueh(xml.Value); continue; } case "X": { x = GetInt(xml.Value); continue; } case "Xi": { x = Convert.ToInt32(xml.Value); continue; } case "Xh": { x = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "Y": { y = GetInt(xml.Value); continue; } case "Yi": { y = Convert.ToInt32(xml.Value); continue; } case "Yh": { y = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "Width": { width = GetInt(xml.Value); flag = true; continue; } case "Widthi": { width = Convert.ToInt32(xml.Value); flag = true; continue; } case "Widthh": { width = Convert.ToInt32(xml.Value.Substring(2), 0x10); flag = true; continue; } } return false; } Gump toAdd = null; if (!flag) { toAdd = new GLabel(text, defaultFont, huei, x, y); } else { toAdd = new GWrappedLabel(text, defaultFont, huei, x, y, width); } Parent.Children.Add(toAdd); if (isEmptyElement) { return true; } while (xml.Read()) { XmlNodeType nodeType = xml.NodeType; if (nodeType != XmlNodeType.Element) { if (nodeType != XmlNodeType.Comment) { return (nodeType == XmlNodeType.EndElement); } } else if (!Parse_Element(xml, toAdd, Name)) { return false; } } return false; }