fix: Consolidates Color/Center html (#1762)
### Summary - Fixes bad color in virtual check gump - Consolidates the Color/Center html strings for all gumps
This commit is contained in:
parent
05535ec9d1
commit
26dfde19ee
109 changed files with 473 additions and 752 deletions
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System.Drawing;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
|
@ -268,10 +269,7 @@ public sealed partial class VirtualCheck : Item
|
|||
AddImage(10, 8, 113);
|
||||
AddImage(360, 8, 113);
|
||||
|
||||
var title =
|
||||
$"<BASEFONT COLOR=#FF2F4F4F><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
|
||||
|
||||
AddHtml(40, 15, 320, 20, title);
|
||||
AddHtml(40, 15, 320, 20, $"BANK OF {User.RawName.ToUpper()}".Center(0x2F4F4F));
|
||||
|
||||
// Platinum Row
|
||||
AddBackground(15, 60, 175, 20, 9300);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ using Server.Network;
|
|||
using Server.Prompts;
|
||||
using Server.Targeting;
|
||||
using Server.Text;
|
||||
using Server.Utilities;
|
||||
using CalcMoves = Server.Movement.Movement;
|
||||
|
||||
namespace Server;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,106 @@ namespace Server;
|
|||
|
||||
public static class TextDefinitionExtensions
|
||||
{
|
||||
public static void AddHtmlText(
|
||||
this TextDefinition def,
|
||||
ref DynamicGumpBuilder builder,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
bool back = false,
|
||||
bool scroll = false,
|
||||
int numberColor = -1,
|
||||
int stringColor = -1
|
||||
)
|
||||
{
|
||||
if (def == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (def.Number > 0)
|
||||
{
|
||||
if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB)
|
||||
{
|
||||
builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll);
|
||||
}
|
||||
}
|
||||
else if (def.String != null)
|
||||
{
|
||||
if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB)
|
||||
{
|
||||
builder.AddHtml(
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
def.String.Color(stringColor),
|
||||
back,
|
||||
scroll
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AddHtml(x, y, width, height, def.String, back, scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddHtmlText(
|
||||
this TextDefinition def,
|
||||
ref StaticGumpBuilder builder,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
bool back = false,
|
||||
bool scroll = false,
|
||||
int numberColor = -1,
|
||||
int stringColor = -1
|
||||
)
|
||||
{
|
||||
if (def == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (def.Number > 0)
|
||||
{
|
||||
if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB)
|
||||
{
|
||||
builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll);
|
||||
}
|
||||
}
|
||||
else if (def.String != null)
|
||||
{
|
||||
if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB)
|
||||
{
|
||||
builder.AddHtml(
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
def.String.Color(stringColor),
|
||||
back,
|
||||
scroll
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AddHtml(x, y, width, height, def.String, back, scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddHtmlText(
|
||||
this TextDefinition def,
|
||||
Gump g,
|
||||
|
|
@ -57,7 +157,7 @@ public static class TextDefinitionExtensions
|
|||
y,
|
||||
width,
|
||||
height,
|
||||
$"<BASEFONT COLOR=#{stringColor:X6}>{def.String}</BASEFONT>",
|
||||
def.String.Color(stringColor),
|
||||
back,
|
||||
scroll
|
||||
);
|
||||
|
|
@ -102,7 +202,7 @@ public static class TextDefinitionExtensions
|
|||
y,
|
||||
width,
|
||||
height,
|
||||
$"<BASEFONT COLOR=#{stringColor:X6}>{string.Format(def.String, args)}</BASEFONT>",
|
||||
string.Format(def.String, args).Color(stringColor),
|
||||
back,
|
||||
scroll
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Server.Utilities;
|
||||
namespace Server;
|
||||
|
||||
public static class ActivatorExtensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Server.Utilities;
|
||||
namespace Server;
|
||||
|
||||
public static class EntityActivatorExtensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Server.Utilities;
|
||||
namespace Server;
|
||||
|
||||
public static class Html
|
||||
{
|
||||
|
|
@ -47,6 +47,21 @@ public static class Html
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Center(this string text, string color, int size) => $"<BASEFONT COLOR={color} SIZE={size}><CENTER>{text}</CENTER></BASEFONT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Right(this string text) => $"<RIGHT>{text}</RIGHT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Right(this string text, int color) => $"<BASEFONT COLOR=#{color:X6}><RIGHT>{text}</RIGHT></BASEFONT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Right(this string text, int color, int size) => $"<BASEFONT COLOR=#{color:X6} SIZE={size}><RIGHT>{text}</RIGHT></BASEFONT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Right(this string text, string color) => $"<BASEFONT COLOR={color}><RIGHT>{text}</RIGHT></BASEFONT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Right(this string text, string color, int size) => $"<BASEFONT COLOR={color} SIZE={size}><RIGHT>{text}</RIGHT></BASEFONT>";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string EscapeHtml(this string input) =>
|
||||
new StringBuilder(input.Length).Append(input)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue