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,10 +14,6 @@ namespace Server.Gumps
|
|||
private const int EntryWidth = 212;
|
||||
|
||||
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
|
||||
private const int TotalHeight = OffsetSize + 5 * (EntryHeight + OffsetSize);
|
||||
|
||||
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly PropertyInfo m_Property;
|
||||
|
|
@ -38,76 +34,16 @@ namespace Server.Gumps
|
|||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
|
||||
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
|
||||
|
||||
var x = BorderSize + OffsetSize;
|
||||
var y = BorderSize + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
{
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, initialText);
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
{
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1);
|
||||
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Change by Serial");
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
{
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 2);
|
||||
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "Nullify");
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
{
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 3);
|
||||
|
||||
x = BorderSize + OffsetSize;
|
||||
y += EntryHeight + OffsetSize;
|
||||
|
||||
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
|
||||
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, "View Properties");
|
||||
x += EntryWidth + OffsetSize;
|
||||
|
||||
if (SetGumpID != 0)
|
||||
{
|
||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||
}
|
||||
|
||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 4);
|
||||
this.AddPropsFrame(TotalWidth, 5, out var x, out var y);
|
||||
this.AddPropsEntryLabel(ref x, ref y, EntryWidth, prop.Name);
|
||||
PropsLayout.NextRow(ref x, ref y);
|
||||
this.AddPropsEntryButton(ref x, ref y, EntryWidth, initialText, true, 1);
|
||||
PropsLayout.NextRow(ref x, ref y);
|
||||
this.AddPropsEntryButton(ref x, ref y, EntryWidth, "Change by Serial", true, 2);
|
||||
PropsLayout.NextRow(ref x, ref y);
|
||||
this.AddPropsEntryButton(ref x, ref y, EntryWidth, "Nullify", true, 3);
|
||||
PropsLayout.NextRow(ref x, ref y);
|
||||
this.AddPropsEntryButton(ref x, ref y, EntryWidth, "View Properties", true, 4);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue