예제 #1
0
파일: Panel.cs 프로젝트: thehaunted88/Core
        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);
            }
        }
예제 #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);
        }
예제 #3
0
파일: Rect2DList.cs 프로젝트: LordEnigma/UO
        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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #6
0
 protected virtual void CompileEntryOptions(MenuGumpOptions opts, T entry)
 {
     if (CanRemove)
     {
         opts.AppendEntry(new ListGumpEntry("Remove", b => HandleRemove(entry), ErrorHue));
     }
 }
예제 #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));
            }
        }
예제 #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();
        }
예제 #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));
        }
예제 #10
0
파일: Panel.cs 프로젝트: thehaunted88/Core
        protected override void Compile()
        {
            base.Compile();

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

            CompileMenuOptions(Options);
        }
예제 #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);
        }
예제 #12
0
파일: Panel.cs 프로젝트: thehaunted88/Core
        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 => { }));
        }
예제 #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);
        }
예제 #14
0
파일: List.cs 프로젝트: uotools/JustUO
        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);
            }
        }
예제 #15
0
        protected override void CompileEntryOptions(MenuGumpOptions opts, Rectangle3D entry)
        {
            base.CompileEntryOptions(opts, entry);

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