public PanelGump( Mobile user, Gump parent = null, int?x = null, int?y = null, int width = 420, int height = 420, string emptyText = null, string title = null, IEnumerable <ListGumpEntry> opts = null, T selected = default(T)) : base(user, parent, x, y) { Width = width; Height = height; Selected = selected; EmptyText = emptyText ?? "No entry to display."; Title = title ?? "Panel View"; Minimized = false; CanMove = false; if (opts != null) { Options = new MenuGumpOptions(opts); } }
public ListGump( Mobile user, Gump parent = null, int?x = null, int?y = null, IEnumerable <T> list = null, string emptyText = null, string title = null, IEnumerable <ListGumpEntry> opts = null) : base(user, parent, x, y, list) { EmptyText = emptyText ?? DefaultEmptyText; Title = title ?? DefaultTitle; Minimized = false; CanMove = false; CanSearch = true; EntryHeight = 30; Width = 400; Columns = 1; Options = new MenuGumpOptions(opts); }
protected override void CompileEntryOptions(MenuGumpOptions opts, Rectangle2D entry) { opts.AppendEntry( new ListGumpEntry("Go To", () => User.MoveToWorld(entry.Start.GetWorldTop(InputMap), InputMap), HighlightHue)); base.CompileEntryOptions(opts, entry); }
protected override void CompileMenuOptions(MenuGumpOptions list) { if (!Preview) { list.Replace( "Disable Preview", "Enable Preview", () => { Preview = true; DisplayPreview(); Refresh(); }, HighlightHue); } else { list.Replace( "Enable Preview", "Disable Preview", () => { Preview = false; ClearPreview(); Refresh(); }, ErrorHue); } base.CompileMenuOptions(list); }
protected override void CompileMenuOptions(MenuGumpOptions list) { if (ChangesPending) { list.Insert(0, new ListGumpEntry("Apply Changes", HandleApplyChanges, HighlightHue)); list.Insert(1, new ListGumpEntry("Clear Changes", HandleClearChanges, HighlightHue)); } else { list.RemoveEntry("Apply Changes"); list.RemoveEntry("Clear Changes"); } if (CanAdd) { list.Insert(2, new ListGumpEntry("Add", HandleAdd, HighlightHue)); } else { list.RemoveEntry("Add"); } if (CanClear) { list.Insert(3, new ListGumpEntry("Clear", HandleClear, ErrorHue)); } else { list.RemoveEntry("Clear"); } base.CompileMenuOptions(list); }
protected virtual void CompileEntryOptions(MenuGumpOptions opts, T entry) { if (CanRemove) { opts.AppendEntry(new ListGumpEntry("Remove", b => HandleRemove(entry), ErrorHue)); } }
protected virtual void CompileMenuOptions(MenuGumpOptions list) { if (Minimized) { list.Replace("Minimize", "Maximize", Maximize); } else { list.Replace("Maximize", "Minimize", Minimize); } if (CanSearch) { if (IsSearching()) { list.Replace("New Search", "Clear Search", OnClearSearch); } else { list.Replace("Clear Search", "New Search", OnNewSearch); } } list.AppendEntry("Refresh", b => Refresh(b)); if (CanClose) { list.AppendEntry("Exit", b => Close(b)); } }
protected override sealed void CompileList(List <ListGumpEntry> list) { var opts = new MenuGumpOptions(list); CompileOptions(opts); list.Clear(); list.TrimExcess(); list.AddRange(opts); InvalidateWidth(); }
protected override void SelectEntry(GumpButton button, T entry) { base.SelectEntry(button, entry); var opts = new MenuGumpOptions(); CompileEntryOptions(opts, entry); Send(new MenuGump(User, Refresh(), opts, button)); }
protected override void Compile() { base.Compile(); if (Options == null) { Options = new MenuGumpOptions(); } CompileMenuOptions(Options); }
protected override void CompileOptions(MenuGumpOptions list) { if (typeof(TEnum).IsEnum) { foreach (var val in EnumerateValues()) { var e = new ListGumpEntry(GetOptionLabel(val), b => OnSelected(val)); if (Equals(val, DefaultValue)) { e.Hue = HighlightHue; } list.AppendEntry(e); } } base.CompileOptions(list); }
protected virtual void CompileMenuOptions(MenuGumpOptions list) { if (Minimized) { list.Replace("Minimize", new ListGumpEntry("Maximize", Maximize)); } else { list.Replace("Maximize", new ListGumpEntry("Minimize", Minimize)); } list.AppendEntry(new ListGumpEntry("Refresh", button => Refresh(true))); if (CanClose) { list.AppendEntry(new ListGumpEntry("Exit", button => Close())); } list.AppendEntry(new ListGumpEntry("Cancel", button => { })); }
protected override void CompileOptions(MenuGumpOptions list) { if (typeof(TEnum).IsEnum) { var vals = (default(TEnum) as Enum).EnumerateValues <TEnum>(false); foreach (var val in vals) { var e = new ListGumpEntry(val.ToString(), b => OnSelected(val)); if (Equals(val, DefaultValue)) { e.Hue = HighlightHue; } list.AppendEntry(e); } } base.CompileOptions(list); }
public ListGump( PlayerMobile user, Gump parent = null, int?x = null, int?y = null, IEnumerable <T> list = null, string emptyText = null, string title = null, IEnumerable <ListGumpEntry> opts = null) : base(user, parent, x, y, list) { SearchResults = new List <T>(); EmptyText = emptyText ?? DefaultEmptyText; Title = title ?? DefaultTitle; Minimized = false; CanMove = false; CanSearch = true; if (opts != null) { Options = new MenuGumpOptions(opts); } }
protected override void CompileEntryOptions(MenuGumpOptions opts, Rectangle3D entry) { base.CompileEntryOptions(opts, entry); opts.AppendEntry("Go To", () => User.MoveToWorld(entry.Start, InputMap), HighlightHue); }
public virtual bool Equals(MenuGumpOptions other) { return(!ReferenceEquals(other, null) && (ReferenceEquals(this, other) || GetHashCode() == other.GetHashCode())); }
protected virtual void CompileOptions(MenuGumpOptions list) { list.Insert(list.Count, new ListGumpEntry("Cancel", Cancel, ErrorHue)); }
protected sealed override void CompileMenuOptions(MenuGumpOptions list) { }