Example #1
0
        /// <summary>
        /// Get the GumpElement with the specified ID.  Searches all pages/elements.
        /// </summary>
        /// <returns>True on success.</returns>
        public bool GetElementByID(int ID, out GumpElement element)
        {
            if (this.GumpElements != null)
            {
                foreach (GumpElement ge in this.GumpElements)
                {
                    if (ge.ElementID == ID)
                    {
                        element = ge;
                        return(true);
                    }
                }
            }

            if (this.Pages != null)
            {
                foreach (GumpPage p in this.Pages)
                {
                    foreach (GumpElement ge in p.GumpElements)
                    {
                        if (ge.ElementID == ID)
                        {
                            element = ge;
                            return(true);
                        }
                    }
                }
            }

            element = null;
            return(false);
        }
Example #2
0
        /// <summary>
        /// Get nearest GumpElement from source.
        /// </summary>
        /// <returns>True on success.</returns>
        public bool GetNearestElement(GumpElement source, out GumpElement element)
        {
            GumpElement nearest = null;
            double      closest = 0, distance;

            foreach (GumpElement ge in myGumpElements)
            {
                if (ge == source)
                {
                    continue;
                }
                distance = UOMath.Distance(source.X, source.Y, ge.X, ge.Y);
                if (nearest == null)
                {
                    closest = distance;
                    nearest = ge;
                }
                else
                {
                    if (distance < closest)
                    {
                        closest = distance;
                        nearest = ge;
                    }
                }
            }
            element = nearest;
            return(nearest != null);
        }
Example #3
0
        public void AddItemProperty(int serial)
        {
            GumpElement ge = new GumpElement();

            ge.Type   = ElementType.itemproperty;
            ge.Serial = serial;
            Add(ge);
        }
Example #4
0
        public void AddTooltip(int number)
        {
            GumpElement ge = new GumpElement();

            ge.Type   = ElementType.tooltip;
            ge.Cliloc = number;
            Add(ge);
        }
Example #5
0
        public void AddGroup(int group)
        {
            GumpElement ge = new GumpElement();

            ge.Type  = ElementType.group;
            ge.Group = group;
            Add(ge);
        }
Example #6
0
        public void AddPage(int page)
        {
            GumpElement ge = new GumpElement();

            ge.Type       = ElementType.page;
            ge.PageNumber = page;
            Add(ge);
        }
Example #7
0
 /// <summary>
 /// Get nearest GumpElement, but only if it's ElementType is contained in the include list.
 /// </summary>
 /// <param name="includeTypes">Array of ElementTypes which specifies valid GumpElements to search.</param>
 /// <returns>True on success.</returns>
 public bool GetNearestElement(ElementType[] includeTypes, out GumpElement element)
 {
     if (myParentPage != null)
     {
         return(myParentPage.GetNearestElement(this, includeTypes, out element));
     }
     element = null;
     return(false);
 }
Example #8
0
        public void AddItem(int x, int y, int itemID)
        {
            GumpElement ge = new GumpElement();

            ge.Type   = ElementType.tilepic;
            ge.X      = x;
            ge.Y      = y;
            ge.ItemID = itemID;
            Add(ge);
        }
Example #9
0
        public void AddImage(int x, int y, int gumpID, int hue)
        {
            GumpElement ge = new GumpElement();

            ge.Type      = ElementType.gumppic;
            ge.X         = x;
            ge.Y         = y;
            ge.ElementID = gumpID;
            ge.Hue       = hue;
            Add(ge);
        }
Example #10
0
        public void AddAlphaRegion(int x, int y, int width, int height)
        {
            GumpElement ge = new GumpElement();

            ge.Type   = ElementType.checkertrans;
            ge.X      = x;
            ge.Y      = y;
            ge.Width  = width;
            ge.Height = height;
            Add(ge);
        }
Example #11
0
        public void AddLabel(int x, int y, int hue, string text)
        {
            GumpElement ge = new GumpElement();

            ge.Type = ElementType.text;
            ge.X    = x;
            ge.Y    = y;
            ge.Hue  = hue;
            ge.Text = text;
            Add(ge);
        }
Example #12
0
        public void AddImageTiled(int x, int y, int width, int height, int gumpID)
        {
            GumpElement ge = new GumpElement();

            ge.Type      = ElementType.gumppictiled;
            ge.X         = x;
            ge.Y         = y;
            ge.Width     = width;
            ge.Height    = height;
            ge.ElementID = gumpID;
            Add(ge);
        }
Example #13
0
        public void AddBackground(int x, int y, int width, int height, int gumpID)
        {
            GumpElement ge = new GumpElement();

            ge.Type      = ElementType.resizepic;
            ge.X         = x;
            ge.Y         = y;
            ge.Width     = width;
            ge.Height    = height;
            ge.ElementID = gumpID;
            Add(ge);
        }
Example #14
0
        public void AddRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
        {
            GumpElement ge = new GumpElement();

            ge.Type         = ElementType.radio;
            ge.X            = x;
            ge.Y            = y;
            ge.InactiveID   = inactiveID;
            ge.ActiveID     = activeID;
            ge.InitialState = initialState;
            ge.ElementID    = switchID;
            Add(ge);
        }
Example #15
0
        public void AddLabelCropped(int x, int y, int width, int height, int hue, string text)
        {
            GumpElement ge = new GumpElement();

            ge.Type   = ElementType.croppedtext;
            ge.X      = x;
            ge.Y      = y;
            ge.Width  = width;
            ge.Height = height;
            ge.Hue    = hue;
            ge.Text   = text;
            Add(ge);
        }
Example #16
0
        public void AddButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param)
        {
            GumpElement ge = new GumpElement();

            ge.Type       = ElementType.button;
            ge.X          = x;
            ge.Y          = y;
            ge.InactiveID = normalID;
            ge.ActiveID   = pressedID;
            ge.ButtonType = (int)type;
            ge.ElementID  = buttonID;
            ge.Param      = param;
            Add(ge);
        }
Example #17
0
        public void AddHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
        {
            GumpElement ge = new GumpElement();

            ge.Type       = ElementType.htmlgump;
            ge.X          = x;
            ge.Y          = y;
            ge.Width      = width;
            ge.Height     = height;
            ge.Text       = text;
            ge.ScrollBar  = scrollbar;
            ge.Background = background;
            Add(ge);
        }
Example #18
0
        public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
        {
            GumpElement ge = new GumpElement();

            ge.Type      = ElementType.textentry;
            ge.X         = x;
            ge.Y         = y;
            ge.Width     = width;
            ge.Height    = height;
            ge.Hue       = hue;
            ge.ElementID = entryID;
            ge.Text      = initialText;
            Add(ge);
        }
Example #19
0
        public void AddHtmlLocalized(int x, int y, int width, int height, int number, bool background, bool scrollbar)
        {
            GumpElement ge = new GumpElement();

            ge.Type       = ElementType.xmfhtmlgump;
            ge.X          = x;
            ge.Y          = y;
            ge.Width      = width;
            ge.Height     = height;
            ge.Cliloc     = number;
            ge.Background = background;
            ge.ScrollBar  = scrollbar;
            Add(ge);
        }
Example #20
0
        /// <summary>
        /// Get nearest GumpElement to source, but only if it's ElementType is contained in the include list.
        /// </summary>
        /// <param name="source">Source GumpElement</param>
        /// <param name="includeTypes">Array of ElementTypes which specifies valid GumpElements to search.</param>
        /// <param name="element">GumpElement (out).</param>
        /// <returns>True on success.</returns>
        public bool GetNearestElement(GumpElement source, ElementType[] includeTypes, out GumpElement element)
        {
            GumpElement nearest = null;
            double      closest = 0, distance;

            if (source.ParentPage != null)
            {
                return(source.ParentPage.GetNearestElement(source, includeTypes, out element));
            }
            bool found;

            foreach (GumpElement ge in this.GumpElements)
            {
                if (ge == source)
                {
                    continue;
                }
                found = false;
                foreach (ElementType et in includeTypes)
                {
                    if (ge.Type == et)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    continue;
                }
                distance = UOMath.Distance(source.X, source.Y, ge.X, ge.Y);
                if (nearest == null)
                {
                    closest = distance;
                    nearest = ge;
                }
                else
                {
                    if (distance < closest)
                    {
                        closest = distance;
                        nearest = ge;
                    }
                }
            }
            element = nearest;
            return(nearest != null);
        }
Example #21
0
 public Gump( int client, int x, int y, int ID, int serial, string layout, string[] strings, GumpElement[] elements, GumpPage[] pages )
 {
     this.Client = client;
     this.X = x;
     this.Y = y;
     this.ID = ID;
     this.Serial = serial;
     this.Layout = layout;
     this.Strings = strings;
     this.GumpElements = elements;
     this.Pages = pages;
     foreach (GumpPage gp in pages)
     {
         gp.ParentGump = this;
     }
 }
Example #22
0
        public void AddImageTiledButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height, int localizedTooltip)
        {
            GumpElement ge = new GumpElement();

            ge.Type       = ElementType.buttontileart;
            ge.X          = x;
            ge.Y          = y;
            ge.InactiveID = normalID;
            ge.ActiveID   = pressedID;
            ge.ElementID  = buttonID;
            ge.ButtonType = (int)type;
            ge.Param      = param;
            ge.ItemID     = itemID;
            ge.Hue        = hue;
            ge.Height     = height;
            ge.Width      = width;
            ge.Cliloc     = localizedTooltip;
            Add(ge);
        }
Example #23
0
 /// <summary>
 /// Get nearest GumpElement to source, but only if it's ElementType is contained in the include list.
 /// </summary>
 /// <param name="source">Source element.</param>
 /// <param name="includeTypes">Array of ElementTypes which specifies valid GumpElements to search.</param>
 /// <param name="element">GumpElement (out).</param>
 /// <returns>True on success.</returns>
 public bool GetNearestElement(GumpElement source, ElementType[] includeTypes, out GumpElement element)
 {
     GumpElement nearest = null;
     double closest = 0, distance;
     bool found;
     foreach (GumpElement ge in myGumpElements)
     {
         if (ge == source) continue;
         found = false;
         foreach (ElementType et in includeTypes)
         {
             if (ge.Type == et)
             {
                 found = true;
                 break;
             }
         }
         if (!found) continue;
         distance = UOMath.Distance(source.X, source.Y, ge.X, ge.Y);
         if (nearest == null)
         {
             closest = distance;
             nearest = ge;
         }
         else
         {
             if (distance < closest)
             {
                 closest = distance;
                 nearest = ge;
             }
         }
     }
     element = nearest;
     return nearest != null;
 }
Example #24
0
 public void AddLabel( int x, int y, int hue, string text )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.text;
     ge.X = x;
     ge.Y = y;
     ge.Hue = hue;
     ge.Text = text;
     Add( ge );
 }
Example #25
0
 public void AddItemProperty( int serial )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.itemproperty;
     ge.Serial = serial;
     Add( ge );
 }
Example #26
0
 public void AddItem( int x, int y, int itemID, int hue )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.tilepic;
     ge.X = x;
     ge.Y = y;
     ge.ItemID = itemID;
     ge.Hue = hue;
     Add( ge );
 }
Example #27
0
        /// <summary>
        /// Get the GumpElement nearest to the specified GumpElement.
        /// </summary>
        /// <returns>True on success.</returns>
        public bool GetNearestElement( GumpElement source, out GumpElement element )
        {
            GumpElement nearest = null;
            double closest = 0, distance;
            if (source.ParentPage != null)
            {
                return source.ParentPage.GetNearestElement( source, out element );
            }

            foreach (GumpElement ge in this.GumpElements)
            {
                if (ge == source) continue;
                distance = UOMath.Distance( source.X, source.Y, ge.X, ge.Y );
                if (nearest == null)
                {
                    closest = distance;
                    nearest = ge;
                }
                else
                {
                    if (distance < closest)
                    {
                        closest = distance;
                        nearest = ge;
                    }
                }
            }
            element = nearest;
            return nearest != null;
        }
Example #28
0
 public void AddTooltip( int number )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.tooltip;
     ge.Cliloc = number;
     Add( ge );
 }
Example #29
0
 public void AddRadio( int x, int y, int inactiveID, int activeID, bool initialState, int switchID )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.radio;
     ge.X = x;
     ge.Y = y;
     ge.InactiveID = inactiveID;
     ge.ActiveID = activeID;
     ge.InitialState = initialState;
     ge.ElementID = switchID;
     Add( ge );
 }
Example #30
0
 public void AddHtml( int x, int y, int width, int height, string text, bool background, bool scrollbar )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.htmlgump;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.Text = text;
     ge.ScrollBar = scrollbar;
     ge.Background = background;
     Add( ge );
 }
Example #31
0
 public void AddGroup( int group )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.group;
     ge.Group = group;
     Add( ge );
 }
Example #32
0
 public void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.button;
     ge.X = x;
     ge.Y = y;
     ge.InactiveID = normalID;
     ge.ActiveID = pressedID;
     ge.ButtonType = (int) type;
     ge.ElementID = buttonID;
     ge.Param = param;
     Add( ge );
 }
Example #33
0
 public void AddBackground( int x, int y, int width, int height, int gumpID )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.resizepic;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.ElementID = gumpID;
     Add( ge );
 }
Example #34
0
 public void AddAlphaRegion( int x, int y, int width, int height )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.checkertrans;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     Add( ge );
 }
Example #35
0
 public void Add( GumpElement e )
 {
     e.ParentGump = this;
     myElements.Add( e );
 }
Example #36
0
 public void AddLabelCropped( int x, int y, int width, int height, int hue, string text )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.croppedtext;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.Hue = hue;
     ge.Text = text;
     Add( ge );
 }
Example #37
0
 public void AddPage( int page )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.page;
     ge.PageNumber = page;
     Add( ge );
 }
Example #38
0
 public void AddHtmlLocalized( int x, int y, int width, int height, int number, string args, int color, bool background, bool scrollbar )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.xmfhtmltok;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.Cliloc = number;
     ge.Args = args;
     ge.Hue = color;
     ge.Background = background;
     ge.ScrollBar = scrollbar;
     Add( ge );
 }
Example #39
0
 public void AddTextEntry( int x, int y, int width, int height, int hue, int entryID, string initialText, int size )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.textentrylimited;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.Hue = hue;
     ge.ElementID = entryID;
     ge.Text = initialText;
     ge.Size = size;
     Add( ge );
 }
Example #40
0
 public void AddImage( int x, int y, int gumpID, int hue )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.gumppic;
     ge.X = x;
     ge.Y = y;
     ge.ElementID = gumpID;
     ge.Hue = hue;
     Add( ge );
 }
Example #41
0
        /// <summary>
        /// Get the GumpElement with the specified ID.  Searches all pages/elements.
        /// </summary>
        /// <returns>True on success.</returns>
        public bool GetElementByID( int ID, out GumpElement element )
        {
            if (this.GumpElements != null)
            {
                foreach (GumpElement ge in this.GumpElements)
                {
                    if (ge.ElementID == ID)
                    {
                        element = ge;
                        return true;
                    }
                }
            }

            if (this.Pages != null)
            {
                foreach (GumpPage p in this.Pages)
                {
                    foreach (GumpElement ge in p.GumpElements)
                    {
                        if (ge.ElementID == ID)
                        {
                            element = ge;
                            return true;
                        }
                    }
                }
            }

            element = null;
            return false;
        }
Example #42
0
 public void AddImageTiled( int x, int y, int width, int height, int gumpID )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.gumppictiled;
     ge.X = x;
     ge.Y = y;
     ge.Width = width;
     ge.Height = height;
     ge.ElementID = gumpID;
     Add( ge );
 }
Example #43
0
 public void Add(GumpElement e)
 {
     e.ParentGump = this;
     myElements.Add(e);
 }
Example #44
0
 public void AddImageTiledButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height, int localizedTooltip )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.buttontileart;
     ge.X = x;
     ge.Y = y;
     ge.InactiveID = normalID;
     ge.ActiveID = pressedID;
     ge.ElementID = buttonID;
     ge.ButtonType = (int) type;
     ge.Param = param;
     ge.ItemID = itemID;
     ge.Hue = hue;
     ge.Height = height;
     ge.Width = width;
     ge.Cliloc = localizedTooltip;
     Add( ge );
 }