feat: Moves gumps out of the core (#1916)

> [!Important]
> **Developer Note**
> This code change will **completely move gumps out of the core**


### Summary

- Adds `GetGumps()` convenience which exposes methods to Find/Close/Send multiple gumps. This helper is a performance improvement by eliminating the Dictionary<Player, List> lookup for gumps.
This commit is contained in:
Kamron Batman 2024-08-09 19:07:32 -07:00 • committed by GitHub
parent 40d99f6d1c
commit 8282b00ca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
246 changed files with 1722 additions and 1383 deletions

View file

@ -14,14 +14,14 @@ public class AddGump : DynamicGump
private readonly string _searchString;
private readonly bool _explicitSearch;
public AddGump(Mobile from, string searchString, int page, Type[] searchResults, bool explicitSearch) : base(50, 50)
public override bool Singleton => true;
public AddGump(string searchString, int page, Type[] searchResults, bool explicitSearch) : base(50, 50)
{
_searchString = searchString;
_searchResults = searchResults;
_explicitSearch = explicitSearch;
_page = page;
from.CloseGump<AddGump>();
}
protected override void BuildLayout(ref DynamicGumpBuilder builder) {
@ -120,7 +120,7 @@ public class AddGump : DynamicGump
explicitSearch = true;
}
e.Mobile.SendGump(new AddGump(e.Mobile, val, 0, types, explicitSearch));
e.Mobile.SendGump(new AddGump(val, 0, types, explicitSearch));
}
private static void Match(string match, Type[] types, HashSet<Type> results)
@ -212,11 +212,11 @@ public class AddGump : DynamicGump
if (match.Length < 3)
{
from.SendMessage("Invalid search string.");
from.SendGump(new AddGump(from, match, _page, _searchResults, false));
from.SendGump(new AddGump(match, _page, _searchResults, false));
}
else
{
from.SendGump(new AddGump(from, match, 0, Match(match), true));
from.SendGump(new AddGump(match, 0, Match(match), true));
}
break;
@ -225,7 +225,7 @@ public class AddGump : DynamicGump
{
if (_page > 0)
{
from.SendGump(new AddGump(from, _searchString, _page - 1, _searchResults, true));
from.SendGump(new AddGump(_searchString, _page - 1, _searchResults, true));
}
break;
@ -234,7 +234,7 @@ public class AddGump : DynamicGump
{
if ((_page + 1) * 10 < _searchResults.Length)
{
from.SendGump(new AddGump(from, _searchString, _page + 1, _searchResults, true));
from.SendGump(new AddGump(_searchString, _page + 1, _searchResults, true));
}
break;
@ -307,7 +307,7 @@ public class AddGump : DynamicGump
{
if (cancelType == TargetCancelType.Canceled)
{
from.SendGump(new AddGump(from, m_SearchString, m_Page, m_SearchResults, true));
from.SendGump(new AddGump(m_SearchString, m_Page, m_SearchResults, true));
}
}
}