fix: Fixes TextDefinition and optimizes CraftItem (#930)

This commit is contained in:
Kamron Batman 2022-02-12 22:42:50 -08:00 • committed by GitHub
parent 202c4a99b7
commit d7786ce586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 138 additions and 173 deletions

View file

@ -9,7 +9,7 @@ namespace Server.Gumps
private readonly NoticeGumpCallback m_Callback;
public NoticeGump(
int header, int headerColor, object content, int contentColor, int width, int height,
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
NoticeGumpCallback callback = null
) : base((640 - width) / 2, (480 - height) / 2)
{
@ -28,18 +28,18 @@ namespace Server.Gumps
AddImageTiled(10, 40, width - 20, height - 80, 2624);
AddAlphaRegion(10, 40, width - 20, height - 80);
if (content is int i)
if (content.Number > 0)
{
AddHtmlLocalized(10, 40, width - 20, height - 80, i, contentColor, false, true);
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
}
else if (content is string)
else
{
AddHtml(
10,
40,
width - 20,
height - 80,
$"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>",
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
false,
true
);

View file

@ -9,7 +9,7 @@ namespace Server.Gumps
private readonly WarningGumpCallback m_Callback;
public WarningGump(
int header, int headerColor, object content, int contentColor, int width, int height,
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
WarningGumpCallback callback = null, bool cancelButton = true
) : base((640 - width) / 2, (480 - height) / 2)
{
@ -28,18 +28,18 @@ namespace Server.Gumps
AddImageTiled(10, 40, width - 20, height - 80, 2624);
AddAlphaRegion(10, 40, width - 20, height - 80);
if (content is int i)
if (content.Number > 0)
{
AddHtmlLocalized(10, 40, width - 20, height - 80, i, contentColor, false, true);
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
}
else if (content is string)
else
{
AddHtml(
10,
40,
width - 20,
height - 80,
$"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>",
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
false,
true
);
@ -71,7 +71,7 @@ namespace Server.Gumps
}
else
{
m_Callback.Invoke(false);
m_Callback(false);
}
}
}