public override void Select(UOFCentralGump g) { base.Select(g); if (!String.IsNullOrWhiteSpace(Command)) { CommandSystem.Handle(g.User, Command, MessageType.Command); } }
public override void CompileLayout(UOFCentralGump g, SuperGumpLayout layout) { base.CompileLayout(g, layout); if (g != null && layout != null) { Grid.ForEach((c, x, y) => CompileEntry(g, layout, x, y, c)); } }
public override void Select(UOFCentralGump g) { base.Select(g); string url = URL; if (!String.IsNullOrWhiteSpace(url)) { g.User.LaunchBrowser(url); } }
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); }); } }
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); }); } }
private void SendCreateMenu(UOFCentralGump g, int gx, int gy) { var o = new MenuGumpOptions(); foreach (Type t in UOFCentral.EntryTypes) { o.AppendEntry( new ListGumpEntry( "New " + t.Name.Replace("Entry", String.Empty).SpaceWords(), () => { Grid.SetContent(gx, gy, t.CreateInstanceSafe <Entry>(this)); g.Refresh(true); })); } new MenuGump(g.User, g.Refresh(), o).Send(); }
public override bool Valid(UOFCentralGump g) { return base.Valid(g) && !String.IsNullOrWhiteSpace(Command) && (g.Edit || g.User.AccessLevel >= _Entry.AccessLevel); }
public override bool Valid(UOFCentralGump g) { return base.Valid(g) && !String.IsNullOrWhiteSpace(URL); }
public override bool Valid(UOFCentralGump g) { return(base.Valid(g) && !String.IsNullOrWhiteSpace(URL)); }
public override void Select(UOFCentralGump g) { g.SetPage(Page); base.Select(g); }
public override bool Valid(UOFCentralGump g) { return(base.Valid(g) && Page != null); }
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 } }
public virtual void Select(UOFCentralGump g) { g.Refresh(true); }
public virtual bool Valid(UOFCentralGump g) { return(!String.IsNullOrWhiteSpace(Label)); }
public override bool Valid(UOFCentralGump g) { return(base.Valid(g) && !String.IsNullOrWhiteSpace(Command) && (g.Edit || g.User.AccessLevel >= _Entry.AccessLevel)); }
public virtual void CompileToolbar(UOFCentralGump g, Dictionary <string, ToolbarButton> buttons) { if (g == null || buttons == null) { return; } if (g.History.Count > 0) { buttons.Add("prev", new ToolbarButton(ButtonIcon.Previous, g.PreviousPage)); } if (g.User.AccessLevel < UOFCentral.CMOptions.EditAccess) { return; } if (g.Edit) { // Clear buttons.Add( "clear", new ToolbarButton( ButtonIcon.Clear, () => { g.Refresh(); new ConfirmDialogGump(g.User) { Title = "Confirm Clear?", Html = "Clearing this page will delete all data associated with it, " + "including any changes you have made.\nThis action can not be undone!\nClick OK to confirm.", AcceptHandler = b => { Clear(); g.Refresh(true); } }.Send(); })); // Properties buttons.Add( "props", new ToolbarButton( ButtonIcon.Properties, () => { g.Refresh(); g.User.SendGump(new PropertiesGump(g.User, this)); })); // Done buttons.Add( "okay", new ToolbarButton( ButtonIcon.Okay, () => { g.Edit = false; g.Refresh(true); })); } else { // Edit buttons.Add( "edit", new ToolbarButton( ButtonIcon.Edit, () => { g.Edit = true; g.Refresh(true); if (g != UOFCentralGump.Editing) { new NoticeDialogGump(g.User) { Title = "Inaccessible", Html = String.Format( "The Central Gump is currently being edited by {0}, please wait until they have finished.", UOFCentralGump.Editing.User.RawName) }.Send(); } })); } }