Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
 protected virtual void CompileEntryOptions(MenuGumpOptions opts, T entry)
 {
     if (CanRemove)
     {
         opts.AppendEntry(new ListGumpEntry("Remove", b => HandleRemove(entry), ErrorHue));
     }
 }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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));
        }
Exemplo n.º 10
0
        protected override void Compile()
        {
            base.Compile();

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

            CompileMenuOptions(Options);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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 => { }));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 15
0
        protected override void CompileEntryOptions(MenuGumpOptions opts, Rectangle3D entry)
        {
            base.CompileEntryOptions(opts, entry);

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