Beispiel #1
0
        public void RemoveBuff(Graphic graphic)
        {
            BuffControlEntry entry = Children.OfType <BuffControlEntry>().FirstOrDefault(s => s.Icon.Graphic == graphic);

            if (entry != null)
            {
                if (Height > _background.Texture.Height)
                {
                    int delta = Height - _background.Texture.Height;

                    if (_direction == GumpDirection.RIGHT_VERTICAL)
                    {
                        Y             += delta;
                        Height        -= delta;
                        _background.Y -= delta;
                        _button.Y     -= delta;
                    }
                    else if (_direction == GumpDirection.LEFT_VERTICAL)
                    {
                        Height -= delta;
                    }
                }

                if (Width > _background.Texture.Width)
                {
                    int delta = Width - _background.Texture.Width;

                    if (_direction == GumpDirection.RIGHT_HORIZONTAL)
                    {
                        X             += delta;
                        Width         -= delta;
                        _background.X -= delta;
                        _button.X     -= delta;
                    }
                    else if (_direction == GumpDirection.LEFT_HORIZONTAL)
                    {
                        Width -= delta;
                    }
                }

                entry.Dispose();
            }

            UpdateElements();
        }
Beispiel #2
0
        private void UpdateElements()
        {
            BuffControlEntry[] list = GetControls <BuffControlEntry>();
            int offset = 0;

            for (int i = 0; i < list.Length; i++)
            {
                BuffControlEntry e = list[i];

                switch (_direction)
                {
                case GumpDirection.LEFT_VERTICAL:
                    e.X     = 26;
                    e.Y     = 25 + offset;
                    offset += 31;

                    break;

                case GumpDirection.LEFT_HORIZONTAL:
                    e.X     = 26 + offset;
                    e.Y     = 5;
                    offset += 31;

                    break;

                case GumpDirection.RIGHT_VERTICAL:
                    e.X     = 5;
                    e.Y     = 48 + offset;
                    offset -= 31;

                    break;

                case GumpDirection.RIGHT_HORIZONTAL:
                    e.X     = 48 + offset;
                    e.Y     = 5;
                    offset -= 31;

                    break;
                }
            }
        }
Beispiel #3
0
        private void UpdateElements()
        {
            BuffControlEntry[] list = GetControls <BuffControlEntry>();
            int offset = 0;

            int maxWidth  = 0;
            int maxHeight = 0;

            for (int i = 0; i < list.Length; i++)
            {
                BuffControlEntry e = list[i];

                maxWidth  += e.Width;
                maxHeight += e.Height;

                switch (_direction)
                {
                case GumpDirection.LEFT_VERTICAL:
                    e.X     = 26;
                    e.Y     = 25 + offset;
                    offset += 31;

                    if (Height < 25 + offset)
                    {
                        Height = 25 + offset;
                    }

                    break;

                case GumpDirection.LEFT_HORIZONTAL:
                    e.X     = 26 + offset;
                    e.Y     = 5;
                    offset += 31;

                    if (Width < 26 + offset)
                    {
                        Width = 26 + offset;
                    }

                    break;

                case GumpDirection.RIGHT_VERTICAL:
                    e.X = 5;
                    e.Y = (Height - 48) - offset;

                    if (e.Y < 0)
                    {
                        Y             += e.Y;
                        Height        -= e.Y;
                        _background.Y -= e.Y;
                        _button.Y     -= e.Y;

                        for (int j = 0; j < i; j++)
                        {
                            list[j].Y -= e.Y;
                        }

                        e.Y = (Height - 48) - offset;
                    }

                    offset += 31;

                    break;

                case GumpDirection.RIGHT_HORIZONTAL:
                    e.X = (Width - 48) - offset;
                    e.Y = 5;

                    if (e.X < 0)
                    {
                        X             += e.X;
                        Width         -= e.X;
                        _background.X -= e.X;
                        _button.X     -= e.X;

                        for (int j = 0; j < i; j++)
                        {
                            list[j].X -= e.X;
                        }

                        e.X = (Width - 48) - offset;
                    }

                    offset += 31;

                    break;
                }
            }
        }