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
|
|
@ -41,24 +41,14 @@ public class SpawnPropsGump : PropertiesGump
|
|||
|
||||
private List<object> _spawners;
|
||||
|
||||
public SpawnPropsGump(Mobile mobile, object o, List<object> spawners) : base(mobile, o)
|
||||
{
|
||||
_spawners = spawners;
|
||||
}
|
||||
public SpawnPropsGump(Mobile mobile, object o, List<object> spawners) : base(mobile, o) => _spawners = spawners;
|
||||
|
||||
public SpawnPropsGump(Mobile mobile, object o, Stack<StackEntry> stack, StackEntry parent, List<object> spawners) : base(
|
||||
mobile, o, stack, parent
|
||||
)
|
||||
{
|
||||
_spawners = spawners;
|
||||
}
|
||||
public SpawnPropsGump(Mobile mobile, object o, Stack<StackEntry> stack, StackEntry parent, List<object> spawners)
|
||||
: base(mobile, o, stack, parent) => _spawners = spawners;
|
||||
|
||||
public SpawnPropsGump(Mobile mobile, object o, Stack<StackEntry> stack, List<object> list, int page, List<object> spawners) : base(
|
||||
mobile, o, stack, list, page
|
||||
)
|
||||
{
|
||||
_spawners = spawners;
|
||||
}
|
||||
public SpawnPropsGump(
|
||||
Mobile mobile, object o, Stack<StackEntry> stack, List<object> list, int page, List<object> spawners
|
||||
) : base(mobile, o, stack, list, page) => _spawners = spawners;
|
||||
|
||||
protected override int TotalHeight => base.TotalHeight + PropsConfig.ApplySize;
|
||||
|
||||
|
|
@ -67,7 +57,7 @@ public class SpawnPropsGump : PropertiesGump
|
|||
base.Initialize(page);
|
||||
var totalHeight = TotalHeight - PropsConfig.ApplySize;
|
||||
|
||||
AddButton(BackWidth / 3, PropsConfig.BorderSize + totalHeight + PropsConfig.BorderSize, 5204, 5205, 3);
|
||||
AddButton(BackWidth / 3, PropsConfig.BorderSize * 2 + totalHeight, 5204, 5205, 3);
|
||||
}
|
||||
|
||||
public override void SendPropertiesGump() =>
|
||||
|
|
@ -111,9 +101,7 @@ public class SpawnPropsGump : PropertiesGump
|
|||
propsBuilder.Append(' ');
|
||||
}
|
||||
|
||||
propsBuilder.Append(attr);
|
||||
propsBuilder.Append(' ');
|
||||
propsBuilder.Append(prop.ToString()); // TODO: Replace with ZString, or IFormatter code
|
||||
propsBuilder.Append($"{attr} {prop}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue