mirror of
https://github.com/4sval/FModel.git
synced 2026-08-13 04:38:19 -05:00
fixed fortnite fonts + updated quest icons
Some checks failed
FModel QA Builder / build (push) Has been cancelled
Some checks failed
FModel QA Builder / build (push) Has been cancelled
This commit is contained in:
@@ -13,12 +13,11 @@ namespace FModel.Creator.Bases.FN;
|
||||
public class BaseBundle : UCreator
|
||||
{
|
||||
private IList<BaseQuest> _quests;
|
||||
private const int _headerHeight = 100;
|
||||
|
||||
public BaseBundle(UObject uObject, EIconStyle style) : base(uObject, style)
|
||||
{
|
||||
Width = 1024;
|
||||
Height = _headerHeight;
|
||||
Height = 0;
|
||||
Margin = 0;
|
||||
}
|
||||
|
||||
@@ -56,84 +55,31 @@ public class BaseBundle : UCreator
|
||||
if (!completionReward.TryGetValue(out int completionCount, "CompletionCount") ||
|
||||
!completionReward.TryGetValue(out FStructFallback[] rewards, "Rewards")) continue;
|
||||
|
||||
var quest = new BaseQuest(completionCount, Style);
|
||||
foreach (var reward in rewards)
|
||||
{
|
||||
if (!reward.TryGetValue(out int quantity, "Quantity") ||
|
||||
!reward.TryGetValue(out string templateId, "TemplateId") ||
|
||||
!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue;
|
||||
|
||||
if (!itemDefinition.AssetPathName.IsNone &&
|
||||
!itemDefinition.AssetPathName.Text.Contains("/Items/Tokens/") &&
|
||||
!itemDefinition.AssetPathName.Text.Contains("/Items/Quests"))
|
||||
{
|
||||
_quests.Add(new BaseQuest(completionCount, itemDefinition, Style));
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(templateId))
|
||||
{
|
||||
_quests.Add(new BaseQuest(completionCount, quantity, templateId, Style));
|
||||
}
|
||||
if (!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue;
|
||||
quest.AddCompletionRequest(itemDefinition);
|
||||
}
|
||||
_quests.Add(quest);
|
||||
}
|
||||
}
|
||||
|
||||
Height += 256 * _quests.Count;
|
||||
Height += 200 * _quests.Count;
|
||||
}
|
||||
|
||||
public override SKBitmap[] Draw()
|
||||
{
|
||||
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Opaque);
|
||||
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Unpremul);
|
||||
using var c = new SKCanvas(ret);
|
||||
|
||||
DrawHeader(c);
|
||||
DrawDisplayName(c);
|
||||
DrawQuests(c);
|
||||
|
||||
return new[] { ret };
|
||||
}
|
||||
|
||||
private readonly SKPaint _headerPaint = new()
|
||||
{
|
||||
IsAntialias = true, FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Utils.Typefaces.Bundle, TextSize = 50,
|
||||
TextAlign = SKTextAlign.Center, Color = SKColor.Parse("#262630")
|
||||
};
|
||||
|
||||
private void DrawHeader(SKCanvas c)
|
||||
{
|
||||
c.DrawRect(new SKRect(0, 0, Width, _headerHeight), _headerPaint);
|
||||
|
||||
var background = _quests.Count > 0 ? _quests[0].Background : Background;
|
||||
_headerPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width / 2, _headerHeight / 2), Width / 5 * 4,
|
||||
new[] { background[0].WithAlpha(50), background[1].WithAlpha(50) }, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(0, 0, Width, _headerHeight), _headerPaint);
|
||||
|
||||
_headerPaint.Shader = SKShader.CreateLinearGradient(new SKPoint(Width / 2, _headerHeight), new SKPoint(Width / 2, 75),
|
||||
new[] { SKColors.Black.WithAlpha(25), background[1].WithAlpha(0) }, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(0, 75, Width, _headerHeight), _headerPaint);
|
||||
}
|
||||
|
||||
private new void DrawDisplayName(SKCanvas c)
|
||||
{
|
||||
if (string.IsNullOrEmpty(DisplayName)) return;
|
||||
|
||||
_headerPaint.Shader = null;
|
||||
_headerPaint.Color = SKColors.White;
|
||||
while (_headerPaint.MeasureText(DisplayName) > Width)
|
||||
{
|
||||
_headerPaint.TextSize -= 1;
|
||||
}
|
||||
|
||||
var shaper = new CustomSKShaper(_headerPaint.Typeface);
|
||||
c.DrawShapedText(shaper, DisplayName, Width / 2f, _headerHeight / 2f + _headerPaint.TextSize / 2 - 10, _headerPaint);
|
||||
}
|
||||
|
||||
private void DrawQuests(SKCanvas c)
|
||||
{
|
||||
var y = _headerHeight;
|
||||
var y = 0;
|
||||
foreach (var quest in _quests)
|
||||
{
|
||||
quest.DrawQuest(c, y);
|
||||
y += quest.Height;
|
||||
}
|
||||
|
||||
return [ret];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ public class BaseIconStats : BaseIcon
|
||||
_informationPaint.TextSize = 50;
|
||||
_informationPaint.Color = SKColors.White;
|
||||
_informationPaint.Typeface = Utils.Typefaces.Bundle;
|
||||
_informationPaint.FakeBoldText = true;
|
||||
while (_informationPaint.MeasureText(DisplayName) > Width - _headerHeight * 2)
|
||||
{
|
||||
_informationPaint.TextSize -= 1;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.Engine;
|
||||
@@ -17,9 +18,8 @@ namespace FModel.Creator.Bases.FN;
|
||||
public class BaseQuest : BaseIcon
|
||||
{
|
||||
private int _count;
|
||||
private Reward _reward;
|
||||
private readonly List<Reward> _rewards;
|
||||
private readonly bool _screenLayer;
|
||||
private readonly string[] _unauthorizedReward = { "Token", "ChallengeBundle", "GiftBox" };
|
||||
|
||||
public string NextQuestName { get; private set; }
|
||||
|
||||
@@ -27,15 +27,15 @@ public class BaseQuest : BaseIcon
|
||||
{
|
||||
Margin = 0;
|
||||
Width = 1024;
|
||||
Height = 256;
|
||||
DefaultPreview = Utils.GetBitmap("FortniteGame/Content/Athena/HUD/Quests/Art/T_NPC_Default.T_NPC_Default");
|
||||
Height = 200;
|
||||
_rewards = [];
|
||||
if (uObject != null)
|
||||
{
|
||||
_screenLayer = uObject.ExportType.Equals("FortFeatItemDefinition", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
private BaseQuest(int completionCount, EIconStyle style) : this(null, style) // completion
|
||||
public BaseQuest(int completionCount, EIconStyle style) : this(null, style) // completion
|
||||
{
|
||||
var description = completionCount < 0 ?
|
||||
Utils.GetLocalizedResource("AthenaChallengeDetailsEntry", "CompletionRewardFormat_All", "Complete <text color=\"FFF\" case=\"upper\" fontface=\"black\">all {0} challenges</> to earn the reward item") :
|
||||
@@ -44,14 +44,14 @@ public class BaseQuest : BaseIcon
|
||||
DisplayName = ReformatString(description, completionCount.ToString(), completionCount < 0);
|
||||
}
|
||||
|
||||
public BaseQuest(int completionCount, FSoftObjectPath itemDefinition, EIconStyle style) : this(completionCount, style) // completion
|
||||
public void AddCompletionRequest(FSoftObjectPath itemDefinition)
|
||||
{
|
||||
_reward = Utils.TryLoadObject(itemDefinition.AssetPathName.Text, out UObject uObject) ? new Reward(uObject) : new Reward();
|
||||
_rewards.Add(itemDefinition.TryLoad(out UObject uObject) ? new Reward(uObject) : new Reward());
|
||||
}
|
||||
|
||||
public BaseQuest(int completionCount, int quantity, string reward, EIconStyle style) : this(completionCount, style) // completion
|
||||
public void AddCompletionRequest(int quantity, string reward)
|
||||
{
|
||||
_reward = new Reward(quantity, reward);
|
||||
_rewards.Add(new Reward(quantity, reward));
|
||||
}
|
||||
|
||||
public override void ParseForInfo()
|
||||
@@ -69,12 +69,7 @@ public class BaseQuest : BaseIcon
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ShortDescription))
|
||||
Description = ShortDescription;
|
||||
if (string.IsNullOrEmpty(DisplayName) && !string.IsNullOrEmpty(Description))
|
||||
DisplayName = Description;
|
||||
if (DisplayName == Description)
|
||||
Description = string.Empty;
|
||||
Description = string.Empty;
|
||||
|
||||
if ((Object.TryGetValue(out FSoftObjectPath icon, "QuestGiverWidgetIcon", "NotificationIconOverride") &&
|
||||
Utils.TryLoadObject(icon.AssetPathName.Text, out UObject iconObject)) ||
|
||||
@@ -98,8 +93,8 @@ public class BaseQuest : BaseIcon
|
||||
if (Object.TryGetValue(out FStructFallback[] objectives, "Objectives") && objectives.Length > 0)
|
||||
{
|
||||
// actual description doesn't exist
|
||||
if (string.IsNullOrEmpty(Description) && objectives[0].TryGetValue(out FText description, "Description"))
|
||||
Description = description.Text;
|
||||
if (string.IsNullOrEmpty(DisplayName) && objectives[0].TryGetValue(out FText description, "Description"))
|
||||
DisplayName = description.Text;
|
||||
|
||||
// ObjectiveCompletionCount doesn't exist
|
||||
if (_count == 0)
|
||||
@@ -111,77 +106,65 @@ public class BaseQuest : BaseIcon
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.TryGetValue(out FStructFallback[] rewards, "Rewards"))
|
||||
if (Object.TryGetValue(out FPackageIndex[] questDefinitionComponents, "QuestDefinitionComponents"))
|
||||
{
|
||||
foreach (var reward in rewards)
|
||||
foreach (var questDefinitionComponent in questDefinitionComponents)
|
||||
{
|
||||
if (!reward.TryGetValue(out FStructFallback itemPrimaryAssetId, "ItemPrimaryAssetId") ||
|
||||
!reward.TryGetValue(out int quantity, "Quantity")) continue;
|
||||
if (!questDefinitionComponent.Name.StartsWith("FortQuestDefinitionComponent_Rewards") ||
|
||||
!questDefinitionComponent.TryLoad(out var rewardComponent) ||
|
||||
!rewardComponent.TryGetValue(out FInstancedStruct[] questRewardsArray, "QuestRewardsArray")) continue;
|
||||
|
||||
if (!itemPrimaryAssetId.TryGetValue(out FStructFallback primaryAssetType, "PrimaryAssetType") ||
|
||||
!itemPrimaryAssetId.TryGetValue(out FName primaryAssetName, "PrimaryAssetName") ||
|
||||
!primaryAssetType.TryGetValue(out FName name, "Name")) continue;
|
||||
|
||||
if (name.Text.Equals("Quest", StringComparison.OrdinalIgnoreCase))
|
||||
foreach (var questReward in questRewardsArray)
|
||||
{
|
||||
NextQuestName = primaryAssetName.Text;
|
||||
if (questReward.NonConstStruct.TryGetValue(out FStructFallback[] resourceDataTableRewards, "ResourceDataTableRewards") &&
|
||||
resourceDataTableRewards.Length > 0 && resourceDataTableRewards[0].TryGetValue(out FStructFallback tableRowEntry, "TableRowEntry") &&
|
||||
tableRowEntry.TryGetValue(out UDataTable rewardsTable, "DataTable") &&
|
||||
tableRowEntry.TryGetValue(out FName rowName, "RowName") &&
|
||||
rewardsTable.TryGetDataTableRow(rowName.Text, StringComparison.InvariantCulture, out var row) &&
|
||||
row.TryGetValue(out FSoftObjectPath resourceDefinition, "ResourceDefinition") &&
|
||||
row.TryGetValue(out int quantity, "Quantity"))
|
||||
{
|
||||
_rewards.Add(new Reward(quantity, resourceDefinition));
|
||||
}
|
||||
else if (questReward.NonConstStruct.TryGetValue(out FInstancedStruct[] rewards, "CosmeticRewards", "CurrencyRewards", "VariantTokenRewards", "ResourceRewards"))
|
||||
{
|
||||
foreach (var reward in rewards)
|
||||
{
|
||||
if (reward.NonConstStruct.TryGetValue(out FSoftObjectPath cosmeticDefinition, "CosmeticDefinition", "CurrencyDefinition", "VariantTokenDefinition", "ResourceDefinition"))
|
||||
{
|
||||
if (reward.NonConstStruct.TryGetValue(out int count, "CurrencyCount", "ResourceCount"))
|
||||
{
|
||||
_rewards.Add(new Reward(count, cosmeticDefinition));
|
||||
}
|
||||
else if (cosmeticDefinition.TryLoad(out var cosmetic))
|
||||
{
|
||||
_rewards.Add(new Reward(cosmetic));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_unauthorizedReward.Contains(name.Text))
|
||||
{
|
||||
_reward = new Reward(quantity, $"{name}:{primaryAssetName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_reward == null)
|
||||
{
|
||||
FName rowName = null;
|
||||
if (Object.TryGetValue(out UDataTable rewardsTable, "RewardsTable"))
|
||||
rowName = new FName("Default");
|
||||
else if (Object.TryGetValue(out FStructFallback[] rewardTableRows, "IndividualRewardTableRows") &&
|
||||
rewardTableRows.Length > 0 && rewardTableRows[0].TryGetValue(out rowName, "RowName") &&
|
||||
rewardTableRows[0].TryGetValue(out rewardsTable, "DataTable")) {}
|
||||
|
||||
if (rewardsTable != null && rowName != null && rewardsTable.TryGetDataTableRow(rowName.Text, StringComparison.InvariantCulture, out var row))
|
||||
{
|
||||
if (row.TryGetValue(out FName templateId, "TemplateId") &&
|
||||
row.TryGetValue(out int quantity, "Quantity"))
|
||||
{
|
||||
_reward = new Reward(quantity, templateId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_reward == null && Object.TryGetValue(out FStructFallback[] hiddenRewards, "HiddenRewards"))
|
||||
{
|
||||
foreach (var hiddenReward in hiddenRewards)
|
||||
{
|
||||
if (!hiddenReward.TryGetValue(out FName templateId, "TemplateId") ||
|
||||
!hiddenReward.TryGetValue(out int quantity, "Quantity")) continue;
|
||||
|
||||
_reward = new Reward(quantity, templateId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_reward ??= new Reward();
|
||||
}
|
||||
|
||||
public void DrawQuest(SKCanvas c, int y)
|
||||
{
|
||||
DrawBackground(c, y);
|
||||
var x = Preview is null ? 0 : Height + 10;
|
||||
DrawBackground(c, x, y);
|
||||
DrawPreview(c, y);
|
||||
DrawTexts(c, y);
|
||||
DrawTexts(c, x + 50, y, 50);
|
||||
}
|
||||
|
||||
public override SKBitmap[] Draw()
|
||||
{
|
||||
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Opaque);
|
||||
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Unpremul);
|
||||
using var c = new SKCanvas(ret);
|
||||
|
||||
DrawQuest(c, 0);
|
||||
|
||||
return new[] { ret };
|
||||
return [ret];
|
||||
}
|
||||
|
||||
private string ReformatString(string s, string completionCount, bool isAll)
|
||||
@@ -202,77 +185,77 @@ public class BaseQuest : BaseIcon
|
||||
private readonly SKPaint _informationPaint = new()
|
||||
{
|
||||
IsAntialias = true, FilterQuality = SKFilterQuality.High,
|
||||
Color = SKColor.Parse("#262630")
|
||||
Color = SKColor.Parse("#183E94"),
|
||||
};
|
||||
|
||||
private void DrawBackground(SKCanvas c, int y)
|
||||
private void DrawBackground(SKCanvas c, int x, int y)
|
||||
{
|
||||
c.DrawRect(new SKRect(Margin, y, Width, y + Height), _informationPaint);
|
||||
|
||||
_informationPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width / 2, y + Height / 2), Width / 5 * 4,
|
||||
new[] { Background[0].WithAlpha(50), Background[1].WithAlpha(50) }, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(Height / 2, y, Width, y + Height), _informationPaint);
|
||||
|
||||
_informationPaint.Shader = SKShader.CreateLinearGradient(new SKPoint(Width / 2, y + Height), new SKPoint(Width / 2, 75),
|
||||
new[] { SKColors.Black.WithAlpha(25), Background[1].WithAlpha(0) }, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(0, y + 75, Width, y + Height), _informationPaint);
|
||||
|
||||
_informationPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width / 2, y + Height / 2), Width / 5 * 4, Background, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(Margin, y, Height / 2, y + Height), _informationPaint);
|
||||
|
||||
_informationPaint.Shader = SKShader.CreateLinearGradient(new SKPoint(Height / 2, y + Height / 2), new SKPoint(Height / 2 + 100, y + Height / 2),
|
||||
new[] { SKColors.Black.WithAlpha(25), Background[1].WithAlpha(0) }, SKShaderTileMode.Clamp);
|
||||
c.DrawRect(new SKRect(Height / 2, y, Height / 2 + 100, y + Height), _informationPaint);
|
||||
_informationPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width * 0.75f, y + Height * 0.5f), Width * 0.75f,
|
||||
[SKColor.Parse("#1565D0"), SKColor.Parse("#1B1150")], SKShaderTileMode.Clamp);
|
||||
c.DrawRoundRect(new SKRect(x, y, Width, y + Height), 25, 25, _informationPaint);
|
||||
}
|
||||
|
||||
private void DrawPreview(SKCanvas c, int y)
|
||||
{
|
||||
if (Preview is null) return;
|
||||
ImagePaint.BlendMode = _screenLayer ? SKBlendMode.Screen : Preview == null ? SKBlendMode.ColorBurn : SKBlendMode.SrcOver;
|
||||
c.DrawBitmap(Preview ?? DefaultPreview, new SKRect(Margin, y, Height - Margin, y + Height), ImagePaint);
|
||||
|
||||
var rect = new SKRect(0, y, Height, y + Height);
|
||||
|
||||
c.Save();
|
||||
using (var roundRectPath = new SKPath())
|
||||
{
|
||||
roundRectPath.AddRoundRect(rect, 15, 15);
|
||||
c.ClipPath(roundRectPath, antialias: true);
|
||||
}
|
||||
|
||||
_informationPaint.Shader = SKShader.CreateLinearGradient(
|
||||
new SKPoint(rect.Left, rect.Bottom),
|
||||
new SKPoint(rect.Left, rect.Top),
|
||||
[
|
||||
_informationPaint.Color,
|
||||
_informationPaint.Color.WithAlpha(0)
|
||||
],
|
||||
[0, 1],
|
||||
SKShaderTileMode.Clamp
|
||||
);
|
||||
c.DrawRect(rect, _informationPaint);
|
||||
c.DrawBitmap(Preview, rect, ImagePaint);
|
||||
c.Restore();
|
||||
}
|
||||
|
||||
private void DrawTexts(SKCanvas c, int y)
|
||||
private void DrawTexts(SKCanvas c, int x, int y, int padding)
|
||||
{
|
||||
_informationPaint.Shader = null;
|
||||
_informationPaint.Color = SKColors.White;
|
||||
|
||||
float maxX = Width - padding;
|
||||
float steps = Height * 0.5f;
|
||||
foreach (var reward in _rewards)
|
||||
{
|
||||
reward.DrawQuest(c, new SKRect(maxX - steps, y + padding, maxX, y + padding + steps));
|
||||
maxX -= steps;
|
||||
}
|
||||
maxX -= steps * 0.5f;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(DisplayName))
|
||||
{
|
||||
_informationPaint.TextSize = 40;
|
||||
_informationPaint.Color = SKColors.White;
|
||||
_informationPaint.TextSize = 25;
|
||||
_informationPaint.Typeface = Utils.Typefaces.Bundle;
|
||||
while (_informationPaint.MeasureText(DisplayName) > Width - Height - 10)
|
||||
{
|
||||
_informationPaint.TextSize -= 1;
|
||||
}
|
||||
|
||||
var shaper = new CustomSKShaper(_informationPaint.Typeface);
|
||||
c.DrawShapedText(shaper, DisplayName, Height, y + 50, _informationPaint);
|
||||
Utils.DrawMultilineText(c, DisplayName, Width - padding, 0, SKTextAlign.Left,
|
||||
new SKRect(x, y + padding, maxX, Height - padding * 1.5f), _informationPaint, out _);
|
||||
}
|
||||
|
||||
var outY = y + 75f;
|
||||
if (!string.IsNullOrWhiteSpace(Description))
|
||||
{
|
||||
_informationPaint.TextSize = 16;
|
||||
_informationPaint.Color = SKColors.White.WithAlpha(175);
|
||||
_informationPaint.Typeface = Utils.Typefaces.Description;
|
||||
Utils.DrawMultilineText(c, Description, Width - Height, y, SKTextAlign.Left,
|
||||
new SKRect(Height, outY, Width - 10, y + Height), _informationPaint, out outY);
|
||||
}
|
||||
|
||||
_informationPaint.Color = Border[0].WithAlpha(100);
|
||||
c.DrawRect(new SKRect(Height, outY, Width - 150, outY + 5), _informationPaint);
|
||||
|
||||
maxX -= steps * 0.5f;
|
||||
if (maxX > Width * 0.7f) maxX = Width * 0.7f;
|
||||
if (_count > 0)
|
||||
{
|
||||
_informationPaint.TextSize = 25;
|
||||
_informationPaint.Color = SKColors.White;
|
||||
_informationPaint.TextSize = 20;
|
||||
_informationPaint.Typeface = Utils.Typefaces.BundleNumber;
|
||||
c.DrawText("0 / ", new SKPoint(Width - 130, outY + 10), _informationPaint);
|
||||
|
||||
_informationPaint.Color = Border[0];
|
||||
c.DrawText(_count.ToString(), new SKPoint(Width - 95, outY + 10), _informationPaint);
|
||||
c.DrawText($"0/{_count}", new SKPoint(maxX, y + Height - padding), _informationPaint);
|
||||
}
|
||||
|
||||
_reward.DrawQuest(c, new SKRect(Height, outY + 25, Width - 20, y + Height - 25));
|
||||
_informationPaint.Color = SKColor.Parse("#121A45").WithAlpha(200);
|
||||
c.DrawRoundRect(new SKRect(x, y + Height - padding - 12.5f, maxX - 12.5f, y + Height - padding), 5, 5, _informationPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,18 @@ public class Reward
|
||||
_rewardQuantity = "x0";
|
||||
}
|
||||
|
||||
public Reward(int quantity, FSoftObjectPath softObjectPath) : this()
|
||||
{
|
||||
_rewardQuantity = $"{quantity / 1000f}k";
|
||||
|
||||
if (softObjectPath.TryLoad(out UObject d))
|
||||
{
|
||||
_theReward = new BaseIcon(d, EIconStyle.Default);
|
||||
_theReward.ParseForReward(false);
|
||||
_theReward.Border[0] = SKColors.White;
|
||||
}
|
||||
}
|
||||
|
||||
public Reward(int quantity, FName primaryAssetName) : this(quantity, primaryAssetName.Text)
|
||||
{
|
||||
}
|
||||
@@ -33,7 +45,7 @@ public class Reward
|
||||
|
||||
if (parts[0].Equals("HomebaseBannerIcon", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (!Utils.TryLoadObject($"FortniteGame/Content/Items/BannerIcons/{parts[1]}.{parts[1]}", out UObject p))
|
||||
if (!Utils.TryLoadObject($"FortniteGame/Plugins/GameFeatures/BRCosmetics/Content/Items/BannerIcons/{parts[1]}.{parts[1]}", out UObject p))
|
||||
return;
|
||||
|
||||
_theReward = new BaseIcon(p, EIconStyle.Default);
|
||||
@@ -51,7 +63,6 @@ public class Reward
|
||||
_theReward = new BaseIcon(uObject, EIconStyle.Default);
|
||||
_theReward.ParseForReward(false);
|
||||
_theReward.Border[0] = SKColors.White;
|
||||
_rewardQuantity = _theReward.DisplayName;
|
||||
}
|
||||
|
||||
private readonly SKPaint _rewardPaint = new()
|
||||
@@ -61,28 +72,30 @@ public class Reward
|
||||
|
||||
public void DrawQuest(SKCanvas c, SKRect rect)
|
||||
{
|
||||
_rewardPaint.TextSize = 50;
|
||||
_rewardPaint.TextSize = 25;
|
||||
if (HasReward())
|
||||
{
|
||||
c.DrawBitmap((_theReward.Preview ?? _theReward.DefaultPreview).Resize((int) rect.Height), new SKPoint(rect.Left, rect.Top), _rewardPaint);
|
||||
|
||||
_rewardPaint.Color = _theReward.Border[0];
|
||||
_rewardPaint.Typeface = _rewardQuantity.StartsWith("x") ? Utils.Typefaces.BundleNumber : Utils.Typefaces.Bundle;
|
||||
_rewardPaint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 5, 5, _theReward.Background[0].WithAlpha(150));
|
||||
while (_rewardPaint.MeasureText(_rewardQuantity) > rect.Width)
|
||||
var origin = new SKPoint(rect.Left, rect.Top);
|
||||
if (!string.IsNullOrEmpty(_rewardQuantity))
|
||||
{
|
||||
_rewardPaint.TextSize -= 1;
|
||||
origin.Y -= _rewardPaint.TextSize / 2;
|
||||
}
|
||||
|
||||
var shaper = new CustomSKShaper(_rewardPaint.Typeface);
|
||||
c.DrawShapedText(shaper, _rewardQuantity, rect.Left + rect.Height + 25, rect.MidY + 20, _rewardPaint);
|
||||
}
|
||||
else
|
||||
{
|
||||
c.DrawBitmap((_theReward.Preview ?? _theReward.DefaultPreview).Resize((int) rect.Height), origin, _rewardPaint);
|
||||
if (string.IsNullOrEmpty(_rewardQuantity)) return;
|
||||
|
||||
_rewardPaint.TextAlign = SKTextAlign.Center;
|
||||
_rewardPaint.FakeBoldText = true;
|
||||
_rewardPaint.Color = SKColors.White;
|
||||
_rewardPaint.Typeface = Utils.Typefaces.BundleNumber;
|
||||
c.DrawText("No Reward", new SKPoint(rect.Left, rect.MidY + 20), _rewardPaint);
|
||||
var shaper = new CustomSKShaper(Utils.Typefaces.BundleNumber);
|
||||
c.DrawShapedText(shaper, _rewardQuantity, rect.Left + rect.Width * 0.5f, rect.Bottom, _rewardPaint);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// _rewardPaint.Color = SKColors.White;
|
||||
// _rewardPaint.Typeface = Utils.Typefaces.BundleNumber;
|
||||
// c.DrawText("No Reward", new SKPoint(rect.Left, rect.MidY + 20), _rewardPaint);
|
||||
// }
|
||||
}
|
||||
|
||||
public void DrawSeasonWin(SKCanvas c, int size)
|
||||
|
||||
@@ -71,95 +71,87 @@ public class Typefaces
|
||||
{
|
||||
case "FORTNITEGAME":
|
||||
{
|
||||
DisplayName = Default;
|
||||
Description = Default;
|
||||
Bottom = Default;
|
||||
BundleNumber = Default;
|
||||
Bundle = Default;
|
||||
TandemDisplayName = Default;
|
||||
TandemGenDescription = Default;
|
||||
TandemAddDescription = Default;
|
||||
// DisplayName = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _ASIA_ERINM,
|
||||
// ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
// _ => string.Empty
|
||||
// } + _EXT);
|
||||
//
|
||||
// Description = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _NOTO_SANS_KR_REGULAR,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_REGULAR,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_REGULAR,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_REGULAR,
|
||||
// _ => _NOTO_SANS_REGULAR
|
||||
// } + _EXT);
|
||||
//
|
||||
// Bottom = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => string.Empty,
|
||||
// ELanguage.Japanese => string.Empty,
|
||||
// ELanguage.Arabic => string.Empty,
|
||||
// ELanguage.TraditionalChinese => string.Empty,
|
||||
// ELanguage.Chinese => string.Empty,
|
||||
// _ => _BURBANK_SMALL_BOLD
|
||||
// } + _EXT, true);
|
||||
//
|
||||
// BundleNumber = OnTheFly(_FORTNITE_BASE_PATH + _BURBANK_BIG_CONDENSED_BLACK + _EXT);
|
||||
//
|
||||
// Bundle = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _ASIA_ERINM,
|
||||
// ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
// _ => string.Empty
|
||||
// } + _EXT, true) ?? BundleNumber;
|
||||
//
|
||||
// TandemDisplayName = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _ASIA_ERINM,
|
||||
// ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
// _ => _BURBANK_BIG_REGULAR_BLACK
|
||||
// } + _EXT);
|
||||
//
|
||||
// TandemGenDescription = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _ASIA_ERINM,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
// _ => _BURBANK_SMALL_BLACK
|
||||
// } + _EXT);
|
||||
//
|
||||
// TandemAddDescription = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
// language switch
|
||||
// {
|
||||
// ELanguage.Korean => _ASIA_ERINM,
|
||||
// ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
// ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
// ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
// ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
// _ => _BURBANK_SMALL_BOLD
|
||||
// } + _EXT);
|
||||
DisplayName = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _ASIA_ERINM,
|
||||
ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
_ => string.Empty
|
||||
} + _EXT);
|
||||
|
||||
Description = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _NOTO_SANS_KR_REGULAR,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_REGULAR,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_REGULAR,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_REGULAR,
|
||||
_ => _NOTO_SANS_REGULAR
|
||||
} + _EXT);
|
||||
|
||||
Bottom = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => string.Empty,
|
||||
ELanguage.Japanese => string.Empty,
|
||||
ELanguage.Arabic => string.Empty,
|
||||
ELanguage.TraditionalChinese => string.Empty,
|
||||
ELanguage.Chinese => string.Empty,
|
||||
_ => _BURBANK_SMALL_BOLD
|
||||
} + _EXT, true);
|
||||
|
||||
BundleNumber = OnTheFly(_FORTNITE_BASE_PATH + _BURBANK_SMALL_BOLD + _EXT);
|
||||
|
||||
Bundle = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _ASIA_ERINM,
|
||||
ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
_ => _BURBANK_SMALL_BOLD
|
||||
} + _EXT, true) ?? BundleNumber;
|
||||
|
||||
TandemDisplayName = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _ASIA_ERINM,
|
||||
ELanguage.Russian => _BURBANK_BIG_CONDENSED_BLACK,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
_ => _BURBANK_BIG_REGULAR_BLACK
|
||||
} + _EXT);
|
||||
|
||||
TandemGenDescription = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _ASIA_ERINM,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
_ => _BURBANK_SMALL_BLACK
|
||||
} + _EXT);
|
||||
|
||||
TandemAddDescription = OnTheFly(_FORTNITE_BASE_PATH +
|
||||
language switch
|
||||
{
|
||||
ELanguage.Korean => _ASIA_ERINM,
|
||||
ELanguage.Japanese => _NOTO_SANS_JP_BOLD,
|
||||
ELanguage.Arabic => _NOTO_SANS_ARABIC_BLACK,
|
||||
ELanguage.TraditionalChinese => _NOTO_SANS_TC_BLACK,
|
||||
ELanguage.Chinese => _NOTO_SANS_SC_BLACK,
|
||||
_ => _BURBANK_SMALL_BOLD
|
||||
} + _EXT);
|
||||
break;
|
||||
}
|
||||
case "MULTIVERSUS":
|
||||
@@ -201,7 +193,7 @@ public class Typefaces
|
||||
public SKTypeface OnTheFly(string path, bool fallback = false)
|
||||
{
|
||||
if (!_viewModel.Provider.TrySaveAsset(path, out var data)) return fallback ? null : Default;
|
||||
var m = new MemoryStream(data) { Position = 0 };
|
||||
var m = new MemoryStream(data) { Position = _viewModel.Provider.Versions.Game >= EGame.GAME_UE5_6 ? 4 : 0 };
|
||||
return SKTypeface.FromStream(m);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user