예제 #1
0
파일: Gump.cs 프로젝트: markdwags/UOMachine
        /// <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);
        }
예제 #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);
        }
예제 #3
0
        public void AddItemProperty(int serial)
        {
            GumpElement ge = new GumpElement();

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

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

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

            ge.Type       = ElementType.page;
            ge.PageNumber = page;
            Add(ge);
        }
예제 #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);
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #20
0
파일: Gump.cs 프로젝트: markdwags/UOMachine
        /// <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);
        }
예제 #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;
     }
 }
예제 #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);
        }
예제 #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;
 }
예제 #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 );
 }
예제 #25
0
 public void AddItemProperty( int serial )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.itemproperty;
     ge.Serial = serial;
     Add( ge );
 }
예제 #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 );
 }
예제 #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;
        }
예제 #28
0
 public void AddTooltip( int number )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.tooltip;
     ge.Cliloc = number;
     Add( ge );
 }
예제 #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 );
 }
예제 #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 );
 }
예제 #31
0
 public void AddGroup( int group )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.group;
     ge.Group = group;
     Add( ge );
 }
예제 #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 );
 }
예제 #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 );
 }
예제 #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 );
 }
예제 #35
0
 public void Add( GumpElement e )
 {
     e.ParentGump = this;
     myElements.Add( e );
 }
예제 #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 );
 }
예제 #37
0
 public void AddPage( int page )
 {
     GumpElement ge = new GumpElement();
     ge.Type = ElementType.page;
     ge.PageNumber = page;
     Add( ge );
 }
예제 #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 );
 }
예제 #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 );
 }
예제 #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 );
 }
예제 #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;
        }
예제 #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 );
 }
예제 #43
0
 public void Add(GumpElement e)
 {
     e.ParentGump = this;
     myElements.Add(e);
 }
예제 #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 );
 }