Exemplo n.º 1
0
        public override void CompileLayout(UOFCentralGump g, SuperGumpLayout layout)
        {
            base.CompileLayout(g, layout);

            if (g == null || layout == null)
            {
                return;
            }

            if (g.Edit)
            {
                layout.Add(
                    "page/text",
                    () =>
                {
                    g.AddImageTiled(120, 160, 410, 200, 2624);
                    g.AddButton(
                        120,
                        160,
                        2640,
                        2641,
                        b =>
                    {
                        Text = String.Empty;
                        g.Refresh(true);
                    });
                    g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Clear));
                    g.AddImageTiled(150, 153, 385, 2, 30072);

                    if (Background)
                    {
                        g.AddBackground(150, 160, 380, 200, 9350);
                    }

                    g.AddTextEntry(155, 165, 370, 190, g.TextHue, Text, (e, t) => Text = t);
                });
            }
            else
            {
                layout.Add(
                    "page/text",
                    () =>
                {
                    string text = Text.ParseBBCode(TextColor.ToColor()).WrapUOHtmlColor(TextColor, false);

                    g.AddImageTiled(120, 160, 410, 200, 2624);
                    g.AddHtml(125, 165, 400, 190, text, Background, Scrollbar);
                });
            }
        }
Exemplo n.º 2
0
        public virtual void CompileLayout(UOFCentralGump g, SuperGumpLayout layout)
        {
            if (g == null || layout == null)
            {
                return;
            }

            // Page Bounds: (110, 120 -> 540, 370) (430 x 250)

            if (g.Edit)
            {
                layout.Add(
                    "page/title",
                    () =>
                {
                    g.AddImageTiled(120, 130, 410, 25, 2624);
                    g.AddButton(
                        120,
                        130,
                        2640,
                        2641,
                        b =>
                    {
                        Title = String.Empty;
                        g.Refresh(true);
                    });
                    g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Clear));
                    g.AddImageTiled(150, 153, 380, 2, 30072);
                    g.AddTextEntryLimited(155, 130, 370, 25, g.TextHue, Title, 100, (e, t) => Title = t ?? String.Empty);
                });
            }
            else
            {
                layout.Add(
                    "page/title",
                    () =>
                {
                    string title = Title.ParseBBCode(TitleColor.ToColor()).WrapUOHtmlTag("CENTER").WrapUOHtmlColor(TitleColor, false);

                    g.AddImageTiled(120, 130, 410, 25, 2624);
                    g.AddImageTiled(120, 153, 410, 2, 30072);
                    g.AddHtml(125, 130, 400, 40, title, false, false);
                });
            }
        }
Exemplo n.º 3
0
 public ToolbarButton(ButtonIcon icon, Action cb)
     : this()
 {
     Icon     = ButtonIconInfo.GetInfo(icon);
     Callback = cb;
 }
Exemplo n.º 4
0
        public virtual void CompileEntry(UOFCentralGump g, SuperGumpLayout layout, int gx, int gy, Entry entry)
        {
            if (g == null || layout == null)
            {
                return;
            }

            bool valid = entry != null && entry.Valid(g);

            if (!g.Edit && !valid)
            {
                return;
            }

            int x = 120 + (gx * 104);
            int y = 160 + (gy * 104);

            string root = "page/grid/entry/" + (entry != null ? entry.UID.Value : gx + "," + gy);

            if (entry != null)
            {
                if (g.Edit)
                {
                    layout.Add(root + "/select", () => g.AddButton(x + 26, y + 4, 2297, 2297, b => entry.Select(g)));
                    g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Edit));
                }
                else
                {
                    layout.Add(root + "/select", () => g.AddButton(x + 4, y + 4, 5104, 5104, b => entry.Select(g)));
                }
            }
            else if (g.Edit)
            {
                layout.Add(
                    root + "/select",
                    () =>
                {
                    g.AddButton(x + 4, y + 4, 5104, 5104, b => SendCreateMenu(g, gx, gy));
                    g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Add));
                });
            }

            if (entry != null || g.Edit)
            {
                int borderID;

                if (entry == null)
                {
                    borderID = 30072; // Red 30073
                }
                else if (valid)
                {
                    borderID = 30072; // Green
                }
                else
                {
                    borderID = 30072;                     // Blue
                }

                layout.Add(
                    root + "/bg",
                    () =>
                {
                    g.AddImageTiled(x, y, 100, 100, 2624);

                    g.AddImageTiled(x, y, 100, 2, borderID);                             //TL -> TR
                    g.AddImageTiled(x + 98, y, 2, 100, borderID);                        //TR -> BR
                    g.AddImageTiled(x, y, 2, 100, borderID);                             //TL -> BL
                    g.AddImageTiled(x, y + 98, 100, 2, borderID);                        //BL -> BR
                });
            }

            if (entry == null)
            {
                if (g.Edit)
                {
                    layout.Add(
                        root + "/add",
                        () =>
                    {
                        g.AddImageTiled(x + 2, y + 2, 20, 20, 2624);
                        g.AddButton(x + 4, y + 4, 55, 55, b => SendCreateMenu(g, gx, gy));
                        g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Add));
                    });
                }
            }
            else
            {
                if (g.Edit)
                {
                    if (entry.ArtID > 0)
                    {
                        layout.Add(
                            root + "/icon", () => g.AddItem(x + 2 + entry.ArtOffset.X, y + 2 + entry.ArtOffset.Y, entry.ArtID, entry.ArtHue));
                    }

                    layout.Add(
                        root + "/delete",
                        () =>
                    {
                        g.AddImageTiled(x + 2, y + 2, 20, 20, 2624);
                        g.AddButton(
                            x + 4,
                            y + 4,
                            56,
                            56,
                            b =>
                        {
                            g.Refresh();

                            new ConfirmDialogGump(g.User)
                            {
                                Title = "Confirm Clear?",
                                Html  =
                                    "Removing this entry will delete all data associated with it, " +
                                    "including any changes you have made.\nThis action can not be undone!\nClick OK to confirm.",
                                AcceptHandler = cb =>
                                {
                                    Grid.SetContent(gx, gy, null);
                                    g.Refresh(true);
                                }
                            }.Send();
                        });
                        g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Remove));
                    });

                    layout.Add(
                        root + "/props",
                        () =>
                    {
                        g.AddImageTiled(x + 78, y + 2, 20, 20, 2624);
                        g.AddButton(
                            x + 80,
                            y + 4,
                            4033,
                            4032,
                            b =>
                        {
                            g.Refresh();
                            g.User.SendGump(new PropertiesGump(g.User, entry));
                        });
                        g.AddTooltip(ButtonIconInfo.GetTooltip(ButtonIcon.Properties));
                    });

                    layout.Add(
                        root + "/label",
                        () =>
                    {
                        g.AddImageTiled(x + 5, y + 55, 90, 40, 2624);
                        g.AddTextEntryLimited(
                            x + 5, y + 55, 90, 40, g.TextHue, entry.Label, 50, (e, t) => entry.Label = t ?? String.Empty);
                    });
                }
                else
                {
                    bool icon = entry.ArtID > 0;

                    if (icon)
                    {
                        layout.Add(
                            root + "/icon", () => g.AddItem(x + 2 + entry.ArtOffset.X, y + 2 + entry.ArtOffset.Y, entry.ArtID, entry.ArtHue));
                    }

                    layout.Add(
                        root + "/label",
                        () =>
                    {
                        string label =
                            entry.Label.ParseBBCode(entry.LabelColor.ToColor())
                            .WrapUOHtmlTag("CENTER")
                            .WrapUOHtmlColor(entry.LabelColor, false);

                        g.AddImageTiled(x + 5, y + (icon ? 55 : 5), 90, icon ? 40 : 90, 2624);
                        g.AddHtml(x + 5, y + (icon ? 55 : 5), 90, icon ? 40 : 90, label, false, false);
                    });
                }
            }

            if (g.Edit)
            {
                // Move entries around cells.
                // Left/Right/Up/Down
            }
        }