Skip to content

Commit 037058d

Browse files
committed
fixed fortnite fonts + updated quest icons
1 parent a6c508c commit 037058d

File tree

5 files changed

+221
-286
lines changed

5 files changed

+221
-286
lines changed

FModel/Creator/Bases/FN/BaseBundle.cs

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ namespace FModel.Creator.Bases.FN;
1313
public class BaseBundle : UCreator
1414
{
1515
private IList<BaseQuest> _quests;
16-
private const int _headerHeight = 100;
1716

1817
public BaseBundle(UObject uObject, EIconStyle style) : base(uObject, style)
1918
{
2019
Width = 1024;
21-
Height = _headerHeight;
20+
Height = 0;
2221
Margin = 0;
2322
}
2423

@@ -56,84 +55,31 @@ public override void ParseForInfo()
5655
if (!completionReward.TryGetValue(out int completionCount, "CompletionCount") ||
5756
!completionReward.TryGetValue(out FStructFallback[] rewards, "Rewards")) continue;
5857

58+
var quest = new BaseQuest(completionCount, Style);
5959
foreach (var reward in rewards)
6060
{
61-
if (!reward.TryGetValue(out int quantity, "Quantity") ||
62-
!reward.TryGetValue(out string templateId, "TemplateId") ||
63-
!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue;
64-
65-
if (!itemDefinition.AssetPathName.IsNone &&
66-
!itemDefinition.AssetPathName.Text.Contains("/Items/Tokens/") &&
67-
!itemDefinition.AssetPathName.Text.Contains("/Items/Quests"))
68-
{
69-
_quests.Add(new BaseQuest(completionCount, itemDefinition, Style));
70-
}
71-
else if (!string.IsNullOrWhiteSpace(templateId))
72-
{
73-
_quests.Add(new BaseQuest(completionCount, quantity, templateId, Style));
74-
}
61+
if (!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue;
62+
quest.AddCompletionRequest(itemDefinition);
7563
}
64+
_quests.Add(quest);
7665
}
7766
}
7867

79-
Height += 256 * _quests.Count;
68+
Height += 200 * _quests.Count;
8069
}
8170

8271
public override SKBitmap[] Draw()
8372
{
84-
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Opaque);
73+
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Unpremul);
8574
using var c = new SKCanvas(ret);
8675

87-
DrawHeader(c);
88-
DrawDisplayName(c);
89-
DrawQuests(c);
90-
91-
return new[] { ret };
92-
}
93-
94-
private readonly SKPaint _headerPaint = new()
95-
{
96-
IsAntialias = true, FilterQuality = SKFilterQuality.High,
97-
Typeface = Utils.Typefaces.Bundle, TextSize = 50,
98-
TextAlign = SKTextAlign.Center, Color = SKColor.Parse("#262630")
99-
};
100-
101-
private void DrawHeader(SKCanvas c)
102-
{
103-
c.DrawRect(new SKRect(0, 0, Width, _headerHeight), _headerPaint);
104-
105-
var background = _quests.Count > 0 ? _quests[0].Background : Background;
106-
_headerPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width / 2, _headerHeight / 2), Width / 5 * 4,
107-
new[] { background[0].WithAlpha(50), background[1].WithAlpha(50) }, SKShaderTileMode.Clamp);
108-
c.DrawRect(new SKRect(0, 0, Width, _headerHeight), _headerPaint);
109-
110-
_headerPaint.Shader = SKShader.CreateLinearGradient(new SKPoint(Width / 2, _headerHeight), new SKPoint(Width / 2, 75),
111-
new[] { SKColors.Black.WithAlpha(25), background[1].WithAlpha(0) }, SKShaderTileMode.Clamp);
112-
c.DrawRect(new SKRect(0, 75, Width, _headerHeight), _headerPaint);
113-
}
114-
115-
private new void DrawDisplayName(SKCanvas c)
116-
{
117-
if (string.IsNullOrEmpty(DisplayName)) return;
118-
119-
_headerPaint.Shader = null;
120-
_headerPaint.Color = SKColors.White;
121-
while (_headerPaint.MeasureText(DisplayName) > Width)
122-
{
123-
_headerPaint.TextSize -= 1;
124-
}
125-
126-
var shaper = new CustomSKShaper(_headerPaint.Typeface);
127-
c.DrawShapedText(shaper, DisplayName, Width / 2f, _headerHeight / 2f + _headerPaint.TextSize / 2 - 10, _headerPaint);
128-
}
129-
130-
private void DrawQuests(SKCanvas c)
131-
{
132-
var y = _headerHeight;
76+
var y = 0;
13377
foreach (var quest in _quests)
13478
{
13579
quest.DrawQuest(c, y);
13680
y += quest.Height;
13781
}
82+
83+
return [ret];
13884
}
13985
}

FModel/Creator/Bases/FN/BaseIconStats.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ private void DrawHeader(SKCanvas c)
215215
_informationPaint.TextSize = 50;
216216
_informationPaint.Color = SKColors.White;
217217
_informationPaint.Typeface = Utils.Typefaces.Bundle;
218+
_informationPaint.FakeBoldText = true;
218219
while (_informationPaint.MeasureText(DisplayName) > Width - _headerHeight * 2)
219220
{
220221
_informationPaint.TextSize -= 1;

0 commit comments

Comments
 (0)