private void onClickClosedList(AControl control, int x, int y, MouseButton button) { if (Items.Count > 0) { m_IsListOpen = true; m_openResizePic = new ResizePic(Parent, X, Y, 3000, m_Width, m_Font.Height * m_visibleItems + 8); m_openResizePic.GumpLocalID = GumpLocalID; m_openResizePic.MouseClickEvent += onClickOpenList; m_openResizePic.MouseOverEvent += onMouseOverOpenList; m_openResizePic.MouseOutEvent += onMouseOutOpenList; ((Gump)Parent).AddControl(m_openResizePic, Page); if (m_visibleItems > Items.Count) { m_visibleItems = Items.Count; } // only show the scrollbar if we need to scroll if (m_visibleItems < Items.Count) { m_openScrollBar = new ScrollBar(Parent, X + m_Width - 20, Y + 4, m_Font.Height * m_visibleItems, (m_CanBeNull ? -1 : 0), Items.Count - m_visibleItems, Index); ((Gump)Parent).AddControl(m_openScrollBar, Page); } m_openLabels = new TextLabelAscii[m_visibleItems]; for (int i = 0; i < m_visibleItems; i++) { m_openLabels[i] = new TextLabelAscii(Parent, X + 4, Y + 5 + m_Font.Height * i, 1, 1106, string.Empty); ((Gump)Parent).AddControl(m_openLabels[i], Page); } } }
public override void Update(double totalMS, double frameMS) { if (IsInitialized && m_text == null) { ResizePic resize; m_text = new HtmlGumpling(this, 10, 10, 200, 200, 0, 0, m_msg); int width = m_text.Width + 20; AddControl(resize = new ResizePic(this, 0, 0, 9200, width, m_text.Height + 45)); AddControl(m_text); // Add buttons switch (m_type) { case MsgBoxTypes.OkOnly: AddControl(new Button(this, (m_text.Width + 20) / 2 - 23, m_text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0)); ((Button)LastControl).GumpOverID = 2076; break; case MsgBoxTypes.OkCancel: AddControl(new Button(this, (width / 2) - 46 - 10, m_text.Height + 15, 0x817, 0x818, ButtonTypes.Activate, 0, 1)); ((Button)LastControl).GumpOverID = 0x819; AddControl(new Button(this, (width / 2) + 10, m_text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0)); ((Button)LastControl).GumpOverID = 2076; break; } base.Update(totalMS, frameMS); CenterThisControlOnScreen(); } base.Update(totalMS, frameMS); }
void buildGumpling(int x, int y, int width, string[] items, int itemsVisible, int index, bool canBeNull) { Position = new Point(x, y); m_items = new List <string>(items); m_width = width; Index = index; m_visibleItems = itemsVisible; m_canBeNull = canBeNull; m_resize = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_width, m_Font.Height + 8), 0); m_resize.MouseClickEvent += onClickClosedList; m_resize.MouseOverEvent += onMouseOverClosedList; m_resize.MouseOutEvent += onMouseOutClosedList; m_label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0); AddControl(new GumpPic(this, width - 22, 5, 2086, 0), 0); }
void buildGumpling(int x, int y, int width, string[] items, int itemsVisible, int index, bool canBeNull) { Position = new Point(x, y); m_items = new List<string>(items); m_width = width; Index = index; m_visibleItems = itemsVisible; m_canBeNull = canBeNull; m_resize = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_width, m_Font.Height + 8), 0); m_resize.MouseClickEvent += onClickClosedList; m_resize.MouseOverEvent += onMouseOverClosedList; m_resize.MouseOutEvent += onMouseOutClosedList; m_label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0); AddControl(new GumpPic(this, width - 22, 5, 2086, 0), 0); }
public void CreateVisual() { if (m_ResizePic != null || m_label != null || ScrollButton != null) return; m_ResizePic = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_Width, m_Font.Height + 8), 0); m_ResizePic.GumpLocalID = GumpLocalID; m_ResizePic.MouseClickEvent += onClickClosedList; m_ResizePic.MouseOverEvent += onMouseOverClosedList; m_ResizePic.MouseOutEvent += onMouseOutClosedList; m_ResizePic.IsEnabled = false; m_label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0); m_label.GumpLocalID = GumpLocalID; ScrollButton = (GumpPic)AddControl(new GumpPic(this, m_Width - 22, 5, 2086, 0), 0); IsFirstvisible = true;//for invisible create control }
public ContextMenuGump(ContextMenuData data) : base(0, 0) { m_Data = data; IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>(); AFont font = (AFont)provider.GetUnicodeFont(1); m_Background = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x0A3C, 50, font.Height * m_Data.Count + 20)); StringBuilder htmlContextItems = new StringBuilder(); for (int i = 0; i < m_Data.Count; i++) { htmlContextItems.Append(string.Format("<a href='{0}' color='#DDD' hovercolor='#FFF' activecolor='#BBB' style='text-decoration:none;'>{1}</a><br/>", m_Data[i].ResponseCode, m_Data[i].Caption)); } m_MenuItems = (HtmlGumpling)AddControl(new HtmlGumpling(this, 10, 10, 200, font.Height * m_Data.Count, 0, 0, htmlContextItems.ToString())); }
void buildGumpling(int x, int y, int width, int index, int itemsVisible, string[] items, bool canBeNull) { Position = new Point(x, y); m_items = new List <string>(items); m_width = width; Index = index; m_visibleItems = itemsVisible; m_canBeNull = canBeNull; m_resize = new ResizePic(m_owner, Page, X, Y, 3000, m_width, IO.FontsOld.ASCIIText.Fonts[1].Height + 8); m_resize.OnMouseClick = onClickClosedList; m_resize.OnMouseOver = onMouseOverClosedList; m_resize.OnMouseOut = onMouseOutClosedList; ((Gump)m_owner).AddControl(m_resize); m_label = new TextLabelAscii(m_owner, Page, X + 4, Y + 5, hue_Text, 1, string.Empty); ((Gump)m_owner).AddControl(m_label); ((Gump)m_owner).AddControl(new GumpPic(m_owner, Page, X + width - 22, Y + 5, 2086, 0)); }
public void CreateVisual() { if (m_ResizePic != null || m_label != null || ScrollButton != null) { return; } m_ResizePic = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_Width, m_Font.Height + 8), 0); m_ResizePic.GumpLocalID = GumpLocalID; m_ResizePic.MouseClickEvent += onClickClosedList; m_ResizePic.MouseOverEvent += onMouseOverClosedList; m_ResizePic.MouseOutEvent += onMouseOutClosedList; m_ResizePic.IsEnabled = false; m_label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0); m_label.GumpLocalID = GumpLocalID; ScrollButton = (GumpPic)AddControl(new GumpPic(this, m_Width - 22, 5, 2086, 0), 0); IsFirstvisible = true;//for invisible create control }
private void closeOpenList() { m_IsListOpen = false; if (m_openResizePic != null) { m_openResizePic.MouseClickEvent -= onClickOpenList; m_openResizePic.MouseOverEvent -= onMouseOverOpenList; m_openResizePic.MouseOutEvent -= onMouseOutOpenList; m_openResizePic.Dispose(); m_openResizePic = null; } if (m_openScrollBar != null) { m_openScrollBar.Dispose(); } for (int i = 0; i < m_visibleItems; i++) { m_openLabels[i].Dispose(); } }
void onClickClosedList(int x, int y, MouseButton button) { m_listOpen = true; m_openResizePic = new ResizePic(m_owner, Page, X, Y, 3000, m_width, ASCIIText.Fonts[1].Height * m_visibleItems + 8); m_openResizePic.OnMouseClick = onClickOpenList; m_openResizePic.OnMouseOver = onMouseOverOpenList; m_openResizePic.OnMouseOut = onMouseOutOpenList; ((Gump)m_owner).AddControl(m_openResizePic); // only show the scrollbar if we need to scroll if (m_visibleItems < m_items.Count) { m_openScrollBar = new ScrollBar(m_owner, Page, X + m_width - 20, Y + 4, ASCIIText.Fonts[1].Height * m_visibleItems, (m_canBeNull ? -1 : 0), m_items.Count - m_visibleItems, Index); ((Gump)m_owner).AddControl(m_openScrollBar); } m_openLabels = new TextLabelAscii[m_visibleItems]; for (int i = 0; i < m_visibleItems; i++) { m_openLabels[i] = new TextLabelAscii(m_owner, Page, X + 4, Y + 5 + ASCIIText.Fonts[1].Height * i, 1107, 1, string.Empty); ((Gump)m_owner).AddControl(m_openLabels[i]); } }
private void OnResize() { if (ServiceRegistry.ServiceExists<ChatControl>()) ServiceRegistry.Unregister<ChatControl>(); ClearControls(); Size = new Point(m_WorldWidth + BorderWidth * 2, m_WorldHeight + BorderHeight * 2); AddControl(m_Border = new ResizePic(this, 0, 0, 0xa3c, Width, Height)); AddControl(m_Viewport = new WorldViewport(this, BorderWidth, BorderHeight, m_WorldWidth, m_WorldHeight)); AddControl(m_ChatWindow = new ChatControl(this, BorderWidth, BorderHeight, m_WorldWidth, m_WorldHeight)); ServiceRegistry.Register<ChatControl>(m_ChatWindow); }
void onClickClosedList(AControl control, int x, int y, MouseButton button) { m_listOpen = true; m_openResizePic = new ResizePic(Owner, X, Y, 3000, m_width, m_Font.Height * m_visibleItems + 8); m_openResizePic.MouseClickEvent += onClickOpenList; m_openResizePic.MouseOverEvent += onMouseOverOpenList; m_openResizePic.MouseOutEvent += onMouseOutOpenList; ((Gump)Owner).AddControl(m_openResizePic, this.Page); // only show the scrollbar if we need to scroll if (m_visibleItems < m_items.Count) { m_openScrollBar = new ScrollBar(Owner, X + m_width - 20, Y + 4, m_Font.Height * m_visibleItems, (m_canBeNull ? -1 : 0), m_items.Count - m_visibleItems, Index); ((Gump)Owner).AddControl(m_openScrollBar, this.Page); } m_openLabels = new TextLabelAscii[m_visibleItems]; for (int i = 0; i < m_visibleItems; i++) { m_openLabels[i] = new TextLabelAscii(Owner, X + 4, Y + 5 + m_Font.Height * i, 1106, 1, string.Empty); ((Gump)Owner).AddControl(m_openLabels[i], this.Page); } }
void buildGumpling(int x, int y, int width, int index, int itemsVisible, string[] items, bool canBeNull) { Position = new Point(x, y); m_items = new List<string>(items); m_width = width; Index = index; m_visibleItems = itemsVisible; m_canBeNull = canBeNull; m_resize = new ResizePic(Owner, X, Y, 3000, m_width, m_Font.Height + 8); m_resize.MouseClickEvent += onClickClosedList; m_resize.MouseOverEvent += onMouseOverClosedList; m_resize.MouseOutEvent += onMouseOutClosedList; ((Gump)Owner).AddControl(m_resize, this.Page); m_label = new TextLabelAscii(Owner, X + 4, Y + 5, hue_Text, 1, string.Empty); ((Gump)Owner).AddControl(m_label, this.Page); ((Gump)Owner).AddControl(new GumpPic(Owner, X + width - 22, Y + 5, 2086, 0), this.Page); }
private void closeOpenList() { m_IsListOpen = false; if (m_openResizePic != null) { m_openResizePic.MouseClickEvent -= onClickOpenList; m_openResizePic.MouseOverEvent -= onMouseOverOpenList; m_openResizePic.MouseOutEvent -= onMouseOutOpenList; m_openResizePic.Dispose(); m_openResizePic = null; } if (m_openScrollBar != null) m_openScrollBar.Dispose(); for (int i = 0; i < m_visibleItems; i++) m_openLabels[i].Dispose(); }