Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 protected virtual void CompileEntryOptions(MenuGumpOptions opts, T entry)
 {
     if (CanRemove)
     {
         opts.AppendEntry(new ListGumpEntry("Remove", b => HandleRemove(entry), ErrorHue));
     }
 }
Beispiel #7
0
        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));
            }
        }
Beispiel #8
0
        protected override sealed void CompileList(List <ListGumpEntry> list)
        {
            var opts = new MenuGumpOptions(list);

            CompileOptions(opts);
            list.Clear();
            list.TrimExcess();
            list.AddRange(opts);
            InvalidateWidth();
        }
Beispiel #9
0
        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));
        }
Beispiel #10
0
        protected override void Compile()
        {
            base.Compile();

            if (Options == null)
            {
                Options = new MenuGumpOptions();
            }

            CompileMenuOptions(Options);
        }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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 => { }));
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
        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);
            }
        }
Beispiel #15
0
        protected override void CompileEntryOptions(MenuGumpOptions opts, Rectangle3D entry)
        {
            base.CompileEntryOptions(opts, entry);

            opts.AppendEntry("Go To", () => User.MoveToWorld(entry.Start, InputMap), HighlightHue);
        }
Beispiel #16
0
 public virtual bool Equals(MenuGumpOptions other)
 {
     return(!ReferenceEquals(other, null) && (ReferenceEquals(this, other) || GetHashCode() == other.GetHashCode()));
 }
Beispiel #17
0
 protected virtual void CompileOptions(MenuGumpOptions list)
 {
     list.Insert(list.Count, new ListGumpEntry("Cancel", Cancel, ErrorHue));
 }
 protected sealed override void CompileMenuOptions(MenuGumpOptions list)
 {
 }