private GContextMenu(object owner, PopupEntry[] list) : base(100, 100) { this.m_VertexPool = VertexConstructor.Create(); this.m_Owner = owner; base.m_GUID = "MobilePopup"; int num = 0; int num2 = 0; int length = list.Length; IFont uniFont = Engine.GetUniFont(3); IHue bright = Hues.Bright; IHue focusHue = Hues.Load(0x35); IHue hue = Hues.Default; OnClick onClick = new OnClick(this.Entry_OnClick); for (int i = 0; i < length; i++) { PopupEntry entry = list[i]; GLabel toAdd = null; if (entry.Flags == 1) { toAdd = new GLabel(entry.Text, uniFont, hue, 7, 7 + num2); } else { toAdd = new GTextButton(entry.Text, uniFont, bright, focusHue, 7, 7 + num2, onClick); toAdd.SetTag("EntryID", entry.EntryID); } toAdd.X -= toAdd.Image.xMin; toAdd.Y -= toAdd.Image.yMin; num2 += (toAdd.Image.yMax - toAdd.Image.yMin) + 4; if (((toAdd.Image.xMax - toAdd.Image.xMin) + 1) > num) { num = (toAdd.Image.xMax - toAdd.Image.xMin) + 1; } base.m_Children.Add(toAdd); } num2 -= 3; this.m_Width = num + 14; this.m_Height = num2 + 14; }
public static void Display(object owner, PopupEntry[] list) { Gumps.Destroy(m_Instance); m_Instance = new GContextMenu(owner, list); Gumps.Desktop.Children.Add(m_Instance); }
private static void Command_Popup(PacketReader pvSrc) { if (pvSrc.ReadInt16() != 1) { pvSrc.Trace(); } int serial = pvSrc.ReadInt32(); int num2 = pvSrc.ReadByte(); PopupEntry[] list = new PopupEntry[num2]; object o = World.FindMobile(serial); if (o == null) { o = World.FindItem(serial); } for (int i = 0; i < num2; i++) { int entryID = pvSrc.ReadInt16(); int stringID = pvSrc.ReadInt16(); int flags = pvSrc.ReadInt16(); list[i] = new PopupEntry(entryID, stringID, flags); if (((flags & 0x20) != 0) && (pvSrc.ReadInt16() != -1)) { } if ((stringID == Engine.m_ContextQueue) && (o != null)) { Network.Send(new PPopupResponse(o, entryID)); Engine.m_ContextQueue = -1; return; } } if (o != null) { GContextMenu.Display(o, list); } }