Example #1
0
        protected virtual void CompileEntry(SuperGumpLayout layout, int x, int y, int idx, RuneCodexEntry entry)
        {
            var ui = UI;

            if (x >= ui.Category.Entries.Width || y >= ui.Category.Entries.Height)
            {
                return;
            }

            layout.Add(
                "entry/" + idx,
                () =>
            {
                ui = UI;

                int xOffset = 220 + (x * 70);
                int yOffset = 50 + (y * 70);
                int gx      = x + ui.EntryScroll.X;
                int gy      = y + ui.EntryScroll.Y;

                const int itemID = 7956;
                bool s           = entry != null && ui.Entry == entry;

                if (entry != null)
                {
                    AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => SelectEntry(gx, gy, idx, entry));
                }
                else if (Codex.CanAddEntries(User))
                {
                    AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => AddEntry(gx, gy, idx));
                }

                AddImageTiled(xOffset, yOffset, 60, 60, 2702);

                if (s)
                {
                    AddItem(xOffset + 10, yOffset + 4, itemID, 2050);
                    AddItem(xOffset + 10, yOffset + 2, itemID, 1);
                }

                if (entry != null)
                {
                    AddItem(xOffset + 10, yOffset, itemID, ui.Category.Hue);
                    AddHtml(
                        xOffset,
                        yOffset + 25,
                        60,
                        40,
                        GetEntryLabel(entry).WrapUOHtmlTag("center").WrapUOHtmlColor(Color.LawnGreen, false),
                        false,
                        false);
                }
                else if (Codex.CanAddEntries(User))
                {
                    AddImage(xOffset + 25, yOffset, 2511, HighlightHue);
                    AddHtml(
                        xOffset, yOffset + 25, 60, 40, "Add".WrapUOHtmlTag("center").WrapUOHtmlColor(Color.Yellow, false), false, false);
                }
            });
        }