示例#1
0
        static GumpCursor()
        {
            var cursors = default(UOCursor).EnumerateValues <UOCursor>(false);

            _SizeCache = cursors.ToDictionary(c => c, c => ArtExtUtility.GetImageSize((int)c));

            _SizeCache[UOCursor.None] = Size.Empty;
        }
示例#2
0
 public virtual Size GetItemSize(int itemID)
 {
     return(ArtExtUtility.GetImageSize(itemID));
 }
示例#3
0
            protected virtual void CompileEntryLayout(SuperGumpLayout layout, int x, int y, int index)
            {
                layout.Add(
                    "heads/" + index,
                    () =>
                {
                    var n = Altar.Dungeon.Infos[index].Left;
                    var h = Altar.Dungeon.Infos[index].Right;

                    var o = ArtExtUtility.GetImageOffset(0x2DB4);
                    var s = ArtExtUtility.GetImageSize(0x2DB4);

                    var c = Color.White;

                    switch (index)
                    {
                    case 0:
                        c = Color.RosyBrown;
                        break;

                    case 1:
                        c = Color.OrangeRed;
                        break;

                    case 2:
                        c = Color.SkyBlue;
                        break;

                    case 3:
                        c = Color.GreenYellow;
                        break;

                    case 4:
                        c = Color.MediumPurple;
                        break;
                    }

                    if (Altar.Heads[index])
                    {
                        AddRectangle(x, y, 54, 54, Color.Empty, c, 2);
                        AddItem(x + 5 + o.X, y + (30 - (s.Height / 2)), 11700, h);
                    }
                    else
                    {
                        AddButton(
                            x,
                            y,
                            2183,
                            2183,
                            b =>
                        {
                            if (!Altar.Heads[index])
                            {
                                var head = User.Backpack.FindItemByType(ElementalAspectHead.Types[index]);

                                if (head == null && User.AccessLevel >= AccessLevel.Administrator)
                                {
                                    head = ElementalAspectHead.CreateInstance(index, n, h);

                                    User.GiveItem(head, GiveFlags.Pack, false);
                                }

                                if (head != null && !head.Deleted && head.Amount > 0)
                                {
                                    User.SendMessage(85, "You place {0} in to {1}.", head.ResolveName(User), Altar.ResolveName(User));

                                    Altar.Heads[index] = true;

                                    head.Consume();

                                    if (Altar.HeadCount >= Altar.HeadMax)
                                    {
                                        Altar.DoSummon();

                                        Close(true);
                                        return;
                                    }
                                }
                                else
                                {
                                    User.SendMessage(
                                        34,
                                        "This slot is engraved with '{0}' and it seems the head of a dragon would fit in it.",
                                        n);
                                }
                            }

                            Refresh(true);
                        });
                        AddRectangle(x, y, 54, 54, Color.Empty, c, 2);
                    }

                    var name = n.WrapUOHtmlCenter().WrapUOHtmlColor(c, false);

                    AddHtml(x, index % 2 == 0 ? y + 55 : y - 20, 54, 40, name, false, false);
                });
            }
示例#4
0
        protected override void CompileLayout(SuperGumpLayout layout)
        {
            base.CompileLayout(layout);

            var sup  = SupportsUltimaStore;
            var ec   = IsEnhancedClient;
            var pad  = ec || sup ? 15 : 10;
            var bgID = ec ? 83 : sup ? 40000 : 2620;

            var w = 44 + (44 * ScrollWidth);
            var h = 44 + (44 * ScrollHeight);

            w = Math.Max(176, w);
            h = Math.Max(176, h);

            w += pad * 2;
            h += pad * 2;

            /* Layout:
             *  ___________
             * [___________|<]
             * |  |O O O O |^|
             * |  |O O O O | |
             * |  |O O O O | |
             * |  |________|v|
             * |__|<______>|>]
             */

            var width  = 135 + w;
            var height = 70 + h;

            layout.Add(
                "bg",
                () =>
            {
                AddBackground(0, 0, width, height, bgID);
                AddBackground(0, 35, 100, height - 35, bgID);
                AddBackground(100, 35, width - 135, height - 70, bgID);
                AddImageTiled(100 + pad, 35 + pad, width - (135 + (pad * 2)), height - (70 + (pad * 2)), bgID + 4);
            });

            layout.Add(
                "title",
                () =>
            {
                var title = Title;

                title = title.WrapUOHtmlBig();
                title = title.WrapUOHtmlColor(Color.Gold, false);

                AddHtml(pad, pad, width - (pad * 2), 40, title, false, false);
            });

            layout.Add(
                "preview",
                () =>
            {
                var label = GetHueLabel(Selected);

                label = label.WrapUOHtmlBig();
                label = label.WrapUOHtmlCenter();
                label = label.WrapUOHtmlColor(Color.Gold, false);

                AddHtml(pad, 35 + pad, 100 - (pad * 2), 40, label, false, false);

                if (PreviewIcon >= 0)
                {
                    var s = ArtExtUtility.GetImageSize(PreviewIcon);

                    if (Selected > 0)
                    {
                        AddItem((100 - s.Width) / 2, 35 + pad + 40, PreviewIcon, Selected);
                    }
                    else
                    {
                        AddItem((100 - s.Width) / 2, 35 + pad + 40, PreviewIcon);
                    }
                }
            });

            CompileEntries(layout, 100 + pad, 35 + pad);

            layout.Add(
                "scrollY",
                () =>
            {
                var value = Math.Max(0, (_HueGrid.Height + 1) - ScrollHeight);

                AddScrollbarV(
                    width - (16 + pad),
                    35 + pad,
                    value,
                    ScrollY,
                    b => ScrollUp(),
                    b => ScrollDown(),
                    new Rectangle(0, 20, 16, height - (110 + (pad * 2))),
                    new Rectangle(0, 0, 16, 16),
                    new Rectangle(0, 20 + (height - (110 + (pad * 2))) + 4, 16, 16),
                    Tuple.Create(9354, 9304),
                    Tuple.Create(5604, 5600, 5604),
                    Tuple.Create(5606, 5602, 5606));
            });

            layout.Add(
                "scrollX",
                () =>
            {
                var value = Math.Max(0, (_HueGrid.Width + 1) - ScrollWidth);

                AddScrollbarH(
                    100 + pad,
                    height - (16 + pad),
                    value,
                    ScrollX,
                    b => ScrollLeft(),
                    b => ScrollRight(),
                    new Rectangle(20, 0, width - (175 + (pad * 2)), 16),
                    new Rectangle(0, 0, 16, 16),
                    new Rectangle(20 + (width - (175 + (pad * 2))) + 4, 0, 16, 16),
                    Tuple.Create(9354, 9304),
                    Tuple.Create(5607, 5603, 5607),
                    Tuple.Create(5605, 5601, 5605));
            });

            layout.Add(
                "cancel",
                () =>
            {
                AddButton(width - (15 + pad), pad, 11410, 11411, OnCancel);
                AddTooltip(1006045);
            });

            layout.Add(
                "accept",
                () =>
            {
                AddButton(width - (15 + pad), height - (15 + pad), 11400, 11401, OnAccept);
                AddTooltip(1006044);
            });
        }