public GItemList(int serial, int menuID, string question, AnswerEntry[] answers) : base(0x910, 0x19, 0x19) { this.m_xLast = -1234; this.m_yLast = -1234; this.m_Serial = serial; this.m_MenuID = menuID; this.m_EntryLabel = new GLabel("", Engine.GetFont(1), Hues.Load(0x75f), 0x27, 0x6a); base.m_Children.Add(this.m_EntryLabel); GLabel toAdd = new GLabel(question, Engine.GetFont(1), Hues.Load(0x75f), 0x27, 0x13); toAdd.Scissor(0, 0, 0xda, 11); base.m_Children.Add(toAdd); int x = 0x25; for (int i = 0; i < answers.Length; i++) { GItemListEntry entry = new GItemListEntry(x, answers[i], this); base.m_Children.Add(entry); x += entry.Width; } x -= 0x25; if (x >= 0xde) { this.m_xOffsetCap = -(x - 0xde); this.m_Left = new GItemListScroller(0x17, this, 150); this.m_Right = new GItemListScroller(0x105, this, -150); base.m_Children.Add(this.m_Left); base.m_Children.Add(this.m_Right); } }
public GItemListEntry(int x, AnswerEntry entry, GItemList owner) : base(x, 0x2d) { this.m_Entry = entry; this.m_Owner = owner; int hue = entry.Hue; if (hue > 0) { hue++; } this.m_Hue = Hues.GetItemHue(entry.ItemID, hue); this.m_Image = this.m_Hue.GetItem(entry.ItemID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Height = 0x2f; int num2 = (this.m_Image.xMax - this.m_Image.xMin) + 1; this.m_Width = 0x2f; if (num2 > this.m_Width) { this.m_Width = num2; } this.m_ImageOffsetX = ((this.m_Width - ((this.m_Image.xMax - this.m_Image.xMin) + 1)) / 2) - this.m_Image.xMin; this.m_ImageOffsetY = ((this.m_Height - ((this.m_Image.yMax - this.m_Image.yMin) + 1)) / 2) - this.m_Image.yMin; } }
private void Okay_Clicked(object sender, EventArgs e) { for (int i = 0; i < this.m_Entries.Length; i++) { if (this.m_Entries[i].Radio.State) { AnswerEntry answer = this.m_Entries[i].Answer; Network.Send(new PQuestionMenuResponse(this.m_Serial, this.m_MenuID, answer.Index, answer.ItemID, 0)); Gumps.Destroy(this); break; } } }
public GQuestionMenuEntry(int x, int y, int xWidth, AnswerEntry a) : base(x, y) { this.m_yBase = y; this.m_Answer = a; this.m_Radio = new GRadioButton(210, 0xd3, false, 0, 0); this.m_Label = new GWrappedLabel(a.Text, Engine.GetFont(1), Hues.Load(0x455), this.m_Radio.Width + 4, 5, (xWidth - this.m_Radio.Width) - 4); this.m_Width = xWidth; this.m_Height = this.m_Radio.Height; if ((this.m_Label.Y + this.m_Label.Height) > this.m_Height) { this.m_Height = this.m_Label.Y + this.m_Label.Height; } base.m_Children.Add(this.m_Radio); base.m_Children.Add(this.m_Label); }
private static void DisplayQuestionMenu(PacketReader pvSrc) { int serial = pvSrc.ReadInt32(); int menuID = pvSrc.ReadInt16(); string question = pvSrc.ReadString(pvSrc.ReadByte()); AnswerEntry[] answers = new AnswerEntry[pvSrc.ReadByte()]; for (int i = 0; i < answers.Length; i++) { answers[i] = new AnswerEntry(i, pvSrc.ReadInt16(), pvSrc.ReadUInt16(), pvSrc.ReadString(pvSrc.ReadByte())); } if ((answers.Length > 0) && (answers[0].ItemID != 0)) { Gumps.Desktop.Children.Add(new GItemList(serial, menuID, question, answers)); } else { Gumps.Desktop.Children.Add(new GQuestionMenu(serial, menuID, question, answers)); } }
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(); }