Made improvements to the XP card text visibility with other backgrounds

This commit is contained in:
Kwoth
2022-08-01 12:01:01 +02:00
parent cf3788c6ea
commit 98272f66e7
2 changed files with 30 additions and 16 deletions

View File

@@ -887,6 +887,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
throw new ArgumentNullException(nameof(bgBytes));
}
var outlinePen = new Pen(Color.Black, 1f);
using var img = Image.Load<Rgba32>(bgBytes, out var imageFormat);
if (template.User.Name.Show)
{
@@ -909,7 +911,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
Origin = new(template.User.Name.Pos.X, template.User.Name.Pos.Y + 8)
},
"@" + username,
template.User.Name.Color);
Brushes.Solid(template.User.Name.Color),
outlinePen);
});
}
@@ -929,7 +932,8 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
Origin = new(template.Club.Name.Pos.X + 50, template.Club.Name.Pos.Y - 8)
},
clubName,
template.Club.Name.Color));
Brushes.Solid(template.Club.Name.Color),
outlinePen));
}
Font GetTruncatedFont(
@@ -987,7 +991,6 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
});
}
var pen = new Pen(Color.Black, 1.25f);
var global = stats.Global;
var guild = stats.Guild;
@@ -1012,7 +1015,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
},
$"{global.LevelXp}/{global.RequiredXp}",
Brushes.Solid(template.User.Xp.Global.Color),
pen));
outlinePen));
}
if (template.User.Xp.Guild.Show)
@@ -1026,7 +1029,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
},
$"{guild.LevelXp}/{guild.RequiredXp}",
Brushes.Solid(template.User.Xp.Guild.Color),
pen));
outlinePen));
}
if (stats.FullGuildStats.AwardedXp != 0 && template.User.Xp.Awarded.Show)
@@ -1038,10 +1041,11 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
img.Mutate(x => x.DrawText($"({sign}{stats.FullGuildStats.AwardedXp})",
_fonts.NotoSans.CreateFont(template.User.Xp.Awarded.FontSize, FontStyle.Bold),
Brushes.Solid(template.User.Xp.Awarded.Color),
pen,
outlinePen,
new(awX, awY)));
}
var rankPen = new Pen(Color.White, 1);
//ranking
if (template.User.GlobalRank.Show)
{
@@ -1054,10 +1058,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
globalRankStr,
68);
img.Mutate(x => x.DrawText(globalRankStr,
globalRankFont,
template.User.GlobalRank.Color,
new(template.User.GlobalRank.Pos.X, template.User.GlobalRank.Pos.Y)));
img.Mutate(x => x.DrawText(
new TextOptions(globalRankFont)
{
Origin = new(template.User.GlobalRank.Pos.X, template.User.GlobalRank.Pos.Y)
},
globalRankStr,
Brushes.Solid(template.User.GlobalRank.Color),
rankPen
));
}
if (template.User.GuildRank.Show)
@@ -1071,10 +1080,15 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
guildRankStr,
43);
img.Mutate(x => x.DrawText(guildRankStr,
guildRankFont,
template.User.GuildRank.Color,
new(template.User.GuildRank.Pos.X, template.User.GuildRank.Pos.Y)));
img.Mutate(x => x.DrawText(
new TextOptions(guildRankFont)
{
Origin = new(template.User.GuildRank.Pos.X, template.User.GuildRank.Pos.Y)
},
guildRankStr,
Brushes.Solid(template.User.GuildRank.Color),
rankPen
));
}
//avatar

View File

@@ -65,7 +65,7 @@
"Bar": {
"Show": true,
"Global": {
"Color": "00000066",
"Color": "00000095",
"PointA": {
"X": 321,
"Y": 104
@@ -78,7 +78,7 @@
"Direction": 3
},
"Guild": {
"Color": "00000066",
"Color": "00000095",
"PointA": {
"X": 282,
"Y": 248