feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257)
> [!IMPORTANT] > **Developer Note** > THIS IS A BREAKING CHANGE TO THE NEW API GUMP. > Please give us feedback in [discord ](https://muo.gg/discord) if you have issues, need help, or have ideas for a better API change! ### Summary * Adds support for size/style to dynamic/static builder. * Drastically simplifies the dynamic/static builder api for AddHtml. * Cleans up some legacy gump files.
This commit is contained in:
parent
ea86d5b2a6
commit
7bd5a853a3
40 changed files with 398 additions and 635 deletions
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Text;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
@ -82,7 +83,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
using var sb = ValueStringBuilder.Create(128);
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
|
|
@ -117,12 +118,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (tourney.EventController != null)
|
||||
{
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
sb.Append(' ');
|
||||
sb.Append(tourney.EventController.Title);
|
||||
}
|
||||
|
||||
sb.Append(" Tournament Invitation");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 22, 294, 20, sb.AsSpan().Center(), LabelColor32, BlackColor32);
|
||||
|
||||
AddBorderedText(
|
||||
22,
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0);
|
||||
x += 325;
|
||||
|
||||
AddBorderedText(x, y + 5, 40, ar.Spectators.ToString().Center(), color, 0);
|
||||
AddBorderedText(x, y + 5, 40, Html.Center($"{ar.Spectators}"), color, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Server.Gumps;
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Text;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
@ -92,7 +93,7 @@ namespace Server.Engines.ConPVP
|
|||
AddImage(215, -43, 0xEE40);
|
||||
// AddImage( 330, 141, 0x8BA );
|
||||
|
||||
var sb = new StringBuilder();
|
||||
using var sb = ValueStringBuilder.Create(128);
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
|
|
@ -127,12 +128,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (tourney.EventController != null)
|
||||
{
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
sb.Append(' ');
|
||||
sb.Append(tourney.EventController.Title);
|
||||
}
|
||||
|
||||
sb.Append(" Tournament Signup");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 22, 294, 20, sb.AsSpan().Center(), LabelColor32, BlackColor32);
|
||||
AddBorderedText(
|
||||
22,
|
||||
50,
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace Server.Engines.ConPVP
|
|||
height - 12 - 2 - 18,
|
||||
400,
|
||||
20,
|
||||
$"Top {lc} of {m_List.Count:N0} duelists, page {page + 1} of {(lc + 14) / 15}".Color(0xFFC000)
|
||||
Html.Color($"Top {lc} of {m_List.Count:N0} duelists, page {page + 1} of {(lc + 14) / 15}", 0xFFC000)
|
||||
);
|
||||
|
||||
AddColumnHeader(75, "Rank");
|
||||
|
|
@ -174,7 +174,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
// AddImageTiled( 21, y + 6, width, 8, 0x2617 );
|
||||
AddImageTiled(x + 3, y + 4, width, 11, 0x806);
|
||||
AddBorderedText(x, y, 115, level.ToString().Center(), 0xFFFFFF, 0);
|
||||
AddBorderedText(x, y, 115, Html.Center($"{level}"), 0xFFFFFF, 0);
|
||||
x += 115;
|
||||
|
||||
var mob = entry.Mobile;
|
||||
|
|
@ -189,10 +189,10 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(x + 5, y, 115 - 5, mob.Name, 0xFFFFFF, 0);
|
||||
x += 115;
|
||||
|
||||
AddBorderedText(x, y, 60, entry.Wins.ToString().Center(), 0xFFFFFF, 0);
|
||||
AddBorderedText(x, y, 60, Html.Center($"{entry.Wins}"), 0xFFFFFF, 0);
|
||||
x += 60;
|
||||
|
||||
AddBorderedText(x, y, 60, entry.Losses.ToString().Center(), 0xFFFFFF, 0);
|
||||
AddBorderedText(x, y, 60, Html.Center($"{entry.Losses}"), 0xFFFFFF, 0);
|
||||
x += 60;
|
||||
|
||||
// AddBorderedText( 292 + 15, y, 115 - 30, String.Format( "{0} <DIV ALIGN=CENTER>/</DIV> <DIV ALIGN=RIGHT>{1}</DIV>", entry.Wins, entry.Losses ), 0xFFC000, 0 );
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Text;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
@ -51,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
AddPage(0);
|
||||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
using var sb = ValueStringBuilder.Create(128);
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
|
|
@ -86,12 +87,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (tourney.EventController != null)
|
||||
{
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
sb.Append(' ');
|
||||
sb.Append(tourney.EventController.Title);
|
||||
}
|
||||
|
||||
sb.Append(" Tournament Bracket");
|
||||
|
||||
AddHtml(25, 35, 250, 20, sb.ToString().Center());
|
||||
AddHtml(25, 35, 250, 20, sb.AsSpan().Center());
|
||||
|
||||
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
|
||||
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
|
||||
|
|
@ -278,7 +280,7 @@ namespace Server.Engines.ConPVP
|
|||
?? new List<TourneyParticipant>(tourney.Participants);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, $"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}".Center());
|
||||
AddHtml(25, 35, 250, 20, Html.Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
|
||||
|
||||
StartPage(out var index, out var count, out var y, 12);
|
||||
|
||||
|
|
@ -347,7 +349,7 @@ namespace Server.Engines.ConPVP
|
|||
AddHtml(25, y, 200, 20, "Log:");
|
||||
y += 20;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
|
||||
for (var i = 0; i < part.Log.Count; ++i)
|
||||
{
|
||||
|
|
@ -364,7 +366,7 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append("Nothing logged yet.");
|
||||
}
|
||||
|
||||
AddHtml(25, y, 250, 150, sb.ToString().Color(BlackColor32), false, true);
|
||||
AddHtml(25, y, 250, 150, sb.AsSpan().Color(BlackColor32), false, true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue