feat: Consolidates staff gump layouts (#2404)
## Summary - Creates `PropsLayoutExtensions.cs` with reusable extension methods for both legacy `Gump` and `DynamicGumpBuilder` that encapsulate the repeating PropsConfig-style layout patterns (frame, header navigation, entry rows) - Converts all 12 standardized staff gumps to use the new extensions, reducing ~570 lines of duplicated layout code - Adds Type and Serial display to PropsGump and SkillsGump headers (e.g. `PlayerMobile (0x1)`) ### Extension methods provided | Method | Pattern | |--------|---------| | `AddPropsFrame` | Background + offset region + origin coordinates | | `AddPropsHeader` | 3-column: [Prev] [Title] [Next] | | `AddPropsHeaderWithBack` | 4-column: [Back] [Title] [Prev] [Next] | | `AddPropsEntryButton` | Label + action button | | `AddPropsEntryNameValue` | Name + Value + action button | | `AddPropsEntryTextInput` | Text input + action button | | `AddPropsEntryLabel` | Label only (no button) | | `AddPropsEntryType` | Full-width type label | | `AddPropsEntryBlank` | Separator row | ### Gumps converted PropsGump, GoGump, WhoGump, SkillsGump (frame+header), EditSkillGump, SetGump, SetObjectGump, SetPoint2DGump, SetPoint3DGump, SetTimeSpanGump (frame), SetListOptionGump (frame+header), CategorizedAddGump (frame+header) ## Test plan - [x] Verify `[props` gump displays correctly with type + serial in header - [x] Verify `[skills` gump displays correctly with type + serial in header - [x] Verify `[go` navigation gump works (prev/next/back) - [x] Verify property editing gumps (Set, SetObject, SetPoint2D, SetPoint3D, SetTimeSpan, SetListOption) - [x] Verify `[categorizedadd` gump works - [x] Verify `[who` gump works with pagination
This commit is contained in:
parent
c0d75562be
commit
8a34903326
13 changed files with 786 additions and 570 deletions
|
|
@ -14,8 +14,6 @@ namespace Server.Gumps
|
|||
|
||||
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
|
||||
|
||||
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
|
||||
private readonly object[] m_Values;
|
||||
protected Mobile m_Mobile;
|
||||
protected object m_Object;
|
||||
|
|
@ -48,52 +46,13 @@ namespace Server.Gumps
|
|||
count = EntryCount;
|
||||
}
|
||||
|
||||
var totalHeight = OffsetSize + (count + 2) * (EntryHeight + OffsetSize);
|
||||
var backHeight = BorderSize + totalHeight + BorderSize;
|
||||
|
||||
AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
|
||||
|
||||
var x = BorderSize + OffsetSize;
|
||||
const int y = BorderSize + OffsetSize;
|
||||
|
||||
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
|
||||
|
||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (page > 1)
|
||||
{
|
||||
AddButton(
|
||||
x + PrevOffsetX,
|
||||
y + PrevOffsetY,
|
||||
PrevButtonID1,
|
||||
PrevButtonID2,
|
||||
0,
|
||||
GumpButtonType.Page,
|
||||
page - 1
|
||||
);
|
||||
}
|
||||
|
||||
x += PrevWidth + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
x += emptyWidth + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
||||
|
||||
if (page < pages)
|
||||
{
|
||||
AddButton(
|
||||
x + NextOffsetX,
|
||||
y + NextOffsetY,
|
||||
NextButtonID1,
|
||||
NextButtonID2,
|
||||
0,
|
||||
GumpButtonType.Page,
|
||||
page + 1
|
||||
);
|
||||
}
|
||||
this.AddPropsFrame(TotalWidth, count + 2, out var x, out var y);
|
||||
this.AddPropsHeader(
|
||||
TotalWidth, ref x, ref y, null,
|
||||
page > 1, 0, page < pages, 0,
|
||||
prevType: GumpButtonType.Page, prevParam: page - 1,
|
||||
nextType: GumpButtonType.Page, nextParam: page + 1
|
||||
);
|
||||
|
||||
AddRect(0, prop.Name, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue