perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423)
## Summary Migrates 14 ConPVP lobby/tournament gumps from legacy `Gump` to modern `DynamicGump`/`StaticGump<T>`. Layouts move into `BuildLayout(ref DynamicGumpBuilder)`, constructors become private, and validation moves into static `DisplayTo` entry points (empty-gump rule). **Per-gump base type decisions:** - `BeginGump` → `StaticGump<BeginGump>`: layout is fully fixed (no dynamic content). All other gumps below are `DynamicGump` because they bake dynamic player names, guild abbreviations, ruleset titles, arena names, tournament participant names, ladder rankings, or per-instance rule modifications. Per the cliloc/dynamic-text rule, dynamic content forces `DynamicGump`. - `ReadyGump`, `ReadyUpGump` → `DynamicGump` (per-instance participant rosters). - `AcceptDuelGump`, `AcceptTeamGump`, `ConfirmSignupGump` → `DynamicGump` (challenger/registrar/team names, dynamic rule modifications). - `PickRulesetGump`, `RulesetGump` → `DynamicGump` (ruleset titles and option labels per instance). - `ParticipantGump`, `DuelContextGump` → `DynamicGump` (player rosters/team labels). - `LadderGump` → `DynamicGump` (ladder entries: ranks, levels, guild abbrs, names, wins/losses). - `ArenaGump` → `DynamicGump` (arena names with active player names). - `PreferencesGump` → `DynamicGump` (arena name list). - `TournamentBracketGump` (~1k LOC) → `DynamicGump`. The whole gump is one type-switched view that re-renders on every button press across `Index`, `Rules_Info`, `Participant_List`, `Participant_Info`, `Round_List`, `Round_Info`, `Match_Info`, `Player_Info`. All branches bake per-instance content. **Refresh-via-this conversions (the big perf wins):** - `LadderGump`: page +/- now mutates `_page` and calls `from.SendGump(this)` instead of allocating a new `LadderGump`. - `PickRulesetGump`: ruleset apply / flavor toggle now refreshes via `this`. - `ParticipantGump`: increase/decrease team size, remove player, target failure all refresh via `this`. - `DuelContextGump`: failed-start and add-participant refresh via `this`. - `ConfirmSignupGump`: every signup-validation rejection branch in `OnResponse` and every `AddPlayer_OnTarget` rejection branch refreshes via `this` (was allocating a new gump per branch). - `TournamentBracketGump`: every navigation button (back/forward, type change, page change, drill-down) mutates `_type`/`_object`/`_list`/`_page` and refreshes via `this`. Previously each click allocated a new 1k LOC gump. All gumps are `Singleton`, use private constructors with static `DisplayTo` entry points that null-check `NetState` before allocation. External callers in `DuelContext`, `TournamentBracketItem`, `TournamentController`, `TournamentSignupItem`, and the cross-references between `AcceptDuelGump`/`ParticipantGump`/`AcceptTeamGump`/`ConfirmSignupGump` are all updated to use `DisplayTo`. Legacy `m_X` fields renamed to `_x` per coding standards.
This commit is contained in:
parent
9c2ac2b8ea
commit
a74c7f9d4e
18 changed files with 3203 additions and 3226 deletions
|
|
@ -1307,19 +1307,19 @@ public partial class DuelContext
|
|||
{
|
||||
if (dc.m_Tournament == null)
|
||||
{
|
||||
pm.SendGump(new ReadyGump(pm, dc, dc.ReadyCount));
|
||||
ReadyGump.DisplayTo(pm, dc, dc.ReadyCount);
|
||||
}
|
||||
}
|
||||
else if (dc.ReadyWait && !dc.StartedBeginCountdown && !dc.Started && !dc.Finished)
|
||||
{
|
||||
if (dc.m_Tournament == null)
|
||||
{
|
||||
pm.SendGump(new ReadyUpGump(pm, dc));
|
||||
ReadyUpGump.DisplayTo(pm, dc);
|
||||
}
|
||||
}
|
||||
else if (dc.Initiator == pm && !dc.ReadyWait && !dc.StartedBeginCountdown && !dc.Started && !dc.Finished)
|
||||
{
|
||||
pm.SendGump(new DuelContextGump(pm, dc));
|
||||
DuelContextGump.DisplayTo(pm, dc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ public partial class DuelContext
|
|||
}
|
||||
else
|
||||
{
|
||||
pm.SendGump(new DuelContextGump(pm, new DuelContext(pm, RulesetLayout.Root)));
|
||||
DuelContextGump.DisplayTo(pm, new DuelContext(pm, RulesetLayout.Root));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1433,7 +1433,7 @@ public partial class DuelContext
|
|||
|
||||
if (prefs != null)
|
||||
{
|
||||
e.Mobile.SendGump(new PreferencesGump(e.Mobile, prefs));
|
||||
PreferencesGump.DisplayTo(e.Mobile, prefs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1547,13 +1547,13 @@ public partial class DuelContext
|
|||
{
|
||||
if (g is ParticipantGump pg && pg.Participant == p)
|
||||
{
|
||||
init.SendGump(new ParticipantGump(init, dc, p));
|
||||
ParticipantGump.DisplayTo(init, dc, p);
|
||||
break;
|
||||
}
|
||||
|
||||
if (g is DuelContextGump dcg && dcg.Context == dc)
|
||||
{
|
||||
init.SendGump(new DuelContextGump(init, dc));
|
||||
DuelContextGump.DisplayTo(init, dc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1582,14 +1582,14 @@ public partial class DuelContext
|
|||
{
|
||||
if (g is ParticipantGump pg && pg.Participant == p)
|
||||
{
|
||||
init.SendGump(new ParticipantGump(init, dc, p));
|
||||
ParticipantGump.DisplayTo(init, dc, p);
|
||||
send = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g is DuelContextGump dcg && dcg.Context == dc)
|
||||
{
|
||||
init.SendGump(new DuelContextGump(init, dc));
|
||||
DuelContextGump.DisplayTo(init, dc);
|
||||
send = false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1597,7 +1597,7 @@ public partial class DuelContext
|
|||
|
||||
if (send)
|
||||
{
|
||||
init.SendGump(new DuelContextGump(init, dc));
|
||||
DuelContextGump.DisplayTo(init, dc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1626,14 +1626,14 @@ public partial class DuelContext
|
|||
{
|
||||
if (g is ParticipantGump pg && pg.Participant == p)
|
||||
{
|
||||
init.SendGump(new ParticipantGump(init, dc, p));
|
||||
ParticipantGump.DisplayTo(init, dc, p);
|
||||
send = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g is DuelContextGump dcg && dcg.Context == dc)
|
||||
{
|
||||
init.SendGump(new DuelContextGump(init, dc));
|
||||
DuelContextGump.DisplayTo(init, dc);
|
||||
send = false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1641,7 +1641,7 @@ public partial class DuelContext
|
|||
|
||||
if (send)
|
||||
{
|
||||
init.SendGump(new DuelContextGump(init, dc));
|
||||
DuelContextGump.DisplayTo(init, dc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1801,7 +1801,7 @@ public partial class DuelContext
|
|||
}
|
||||
else if (!m_Yielding)
|
||||
{
|
||||
Initiator.SendGump(new DuelContextGump(Initiator, this));
|
||||
DuelContextGump.DisplayTo(Initiator, this);
|
||||
}
|
||||
|
||||
ReadyWait = false;
|
||||
|
|
@ -2195,7 +2195,7 @@ public partial class DuelContext
|
|||
gumps.Close<ReadyGump>();
|
||||
gumps.Close<ReadyUpGump>();
|
||||
gumps.Close<BeginGump>();
|
||||
gumps.Send(new BeginGump(count));
|
||||
BeginGump.DisplayTo(mob, count);
|
||||
}
|
||||
|
||||
mob.Frozen = true;
|
||||
|
|
@ -2254,7 +2254,7 @@ public partial class DuelContext
|
|||
|
||||
if (mob != null && m_Tournament == null)
|
||||
{
|
||||
mob.SendGump(new ReadyUpGump(mob, this), true);
|
||||
ReadyUpGump.DisplayTo(mob, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2509,7 +2509,7 @@ public partial class DuelContext
|
|||
{
|
||||
if (m_Tournament == null)
|
||||
{
|
||||
mob.SendGump(new ReadyGump(mob, this, count), true);
|
||||
ReadyGump.DisplayTo(mob, this, count);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue