mirror of
https://github.com/4sval/FModel.git
synced 2026-04-21 00:57:46 -05:00
added more languages support while drawing Valorant icons
This commit is contained in:
parent
71b459fb67
commit
b7c133dffb
|
|
@ -39,7 +39,15 @@ namespace FModel.Creator.Texts
|
|||
|
||||
private const string _VALORANT_BASE_PATH = "/Game/";
|
||||
private const string _TUNGSTEN_BOLD = "Tungsten-Bold";
|
||||
private const string _DINNEXT_LTARABIC_HEAVY = "UI/Fonts/FinalFonts/LOCFonts/DIN_Next_Arabic/DINNextLTArabic-Heavy";
|
||||
private const string _TUNGSTEN_CYRILLIC = "UI/Fonts/FinalFonts/LOCFonts/LOC_Tungsten/Cyrillic_Tungsten";
|
||||
private const string _TUNGSTEN_JAPANESE = "UI/Fonts/FinalFonts/LOCFonts/LOC_Tungsten/JP_Tungsten";
|
||||
private const string _TUNGSTEN_KOREAN = "UI/Fonts/FinalFonts/LOCFonts/LOC_Tungsten/KR_Tungsten";
|
||||
private const string _TUNGSTEN_SIMPLIFIED_CHINESE = "UI/Fonts/FinalFonts/LOCFonts/LOC_Tungsten/zh-CN_Tungsten";
|
||||
private const string _TUNGSTEN_TRADITIONAL_CHINESE = "UI/Fonts/FinalFonts/LOCFonts/LOC_Tungsten/zh-TW_Tungsten";
|
||||
private const string _DINNEXT_W1G_LIGHT = "UI/Fonts/FinalFonts/DINNextW1G-Light";
|
||||
private const string _DINNEXT_LTARABIC_LIGHT = "UI/Fonts/FinalFonts/LOCFonts/DIN_Next_Arabic/DINNextLTArabic-Light";
|
||||
private const string _NOTOSANS_CJK_LIGHT = "UI/Fonts/FinalFonts/LOCFonts/CJK/NotoSansCJK-Light"; // chinese, japanese, korean
|
||||
private const string _DINNEXT_W1G_BOLD = "UI/Fonts/FinalFonts/DINNextW1G-Bold";
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
|
|
@ -51,14 +59,17 @@ namespace FModel.Creator.Texts
|
|||
|
||||
public Typefaces()
|
||||
{
|
||||
DefaultTypeface = SKTypeface.FromStream(Application.GetResourceStream(_BURBANK_BIG_CONDENSED_BOLD).Stream);
|
||||
BundleDefaultTypeface = DefaultTypeface;
|
||||
DisplayNameTypeface = DefaultTypeface;
|
||||
DescriptionTypeface = DefaultTypeface;
|
||||
BundleDisplayNameTypeface = DefaultTypeface;
|
||||
|
||||
if (Globals.Game.ActualGame == EGame.Fortnite)
|
||||
{
|
||||
DefaultTypeface = SKTypeface.FromStream(Application.GetResourceStream(_BURBANK_BIG_CONDENSED_BOLD).Stream);
|
||||
|
||||
ArraySegment<byte>[] t = Utils.GetPropertyArraySegmentByte(_FORTNITE_BASE_PATH + _BURBANK_BIG_CONDENSED_BLACK);
|
||||
if (t != null && t.Length == 3)
|
||||
BundleDefaultTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else BundleDefaultTypeface = DefaultTypeface;
|
||||
|
||||
string namePath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _ASIA_ERINM :
|
||||
|
|
@ -74,7 +85,6 @@ namespace FModel.Creator.Texts
|
|||
if (t != null && t.Length == 3)
|
||||
DisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
}
|
||||
else DisplayNameTypeface = DefaultTypeface;
|
||||
|
||||
string descriptionPath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _NOTO_SANS_KR_REGULAR :
|
||||
|
|
@ -86,7 +96,6 @@ namespace FModel.Creator.Texts
|
|||
t = Utils.GetPropertyArraySegmentByte(descriptionPath);
|
||||
if (t != null && t.Length == 3)
|
||||
DescriptionTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else DescriptionTypeface = DefaultTypeface;
|
||||
|
||||
string bundleNamePath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _ASIA_ERINM :
|
||||
|
|
@ -102,21 +111,35 @@ namespace FModel.Creator.Texts
|
|||
if (t != null && t.Length == 3)
|
||||
BundleDisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
}
|
||||
else BundleDisplayNameTypeface = BundleDefaultTypeface;
|
||||
}
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant)
|
||||
{
|
||||
ArraySegment<byte>[] t = Utils.GetPropertyArraySegmentByte(_VALORANT_BASE_PATH + _TUNGSTEN_BOLD);
|
||||
string namePath = _VALORANT_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _TUNGSTEN_KOREAN :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Russian ? _TUNGSTEN_CYRILLIC :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Japanese ? _TUNGSTEN_JAPANESE :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Arabic ? _DINNEXT_LTARABIC_HEAVY :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.TraditionalChinese ? _TUNGSTEN_TRADITIONAL_CHINESE :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Chinese ? _TUNGSTEN_SIMPLIFIED_CHINESE :
|
||||
_TUNGSTEN_BOLD);
|
||||
ArraySegment<byte>[] t = Utils.GetPropertyArraySegmentByte(namePath);
|
||||
if (t != null && t.Length == 3)
|
||||
DisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
|
||||
string descriptionPath = _VALORANT_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _NOTOSANS_CJK_LIGHT :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Japanese ? _NOTOSANS_CJK_LIGHT :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Arabic ? _DINNEXT_LTARABIC_LIGHT :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.TraditionalChinese ? _NOTOSANS_CJK_LIGHT :
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Chinese ? _NOTOSANS_CJK_LIGHT :
|
||||
_DINNEXT_W1G_LIGHT);
|
||||
t = Utils.GetPropertyArraySegmentByte(descriptionPath);
|
||||
if (t != null && t.Length == 3)
|
||||
DescriptionTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
|
||||
t = Utils.GetPropertyArraySegmentByte(_VALORANT_BASE_PATH + _DINNEXT_W1G_BOLD);
|
||||
if (t != null && t.Length == 3)
|
||||
BundleDefaultTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
|
||||
t = Utils.GetPropertyArraySegmentByte(_VALORANT_BASE_PATH + _DINNEXT_W1G_LIGHT);
|
||||
if (t != null && t.Length == 3)
|
||||
DescriptionTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@ namespace FModel.Creator.Valorant
|
|||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DescriptionTypeface,
|
||||
TextSize = 13,
|
||||
TextSize = 19.5f,
|
||||
Color = SKColors.White,
|
||||
};
|
||||
|
||||
public SKBitmap IconImage;
|
||||
public string DisplayName;
|
||||
public string Description;
|
||||
public int Width = 512; // keep it 512 (or a multiple of 512) if you don't want blurry icons
|
||||
public int Height = 64;
|
||||
public int Margin = 2;
|
||||
public int Width = 768; // keep it 512 (or a multiple of 512) if you don't want blurry icons
|
||||
public int Height = 96;
|
||||
public int Margin = 3;
|
||||
|
||||
public BaseUIData()
|
||||
{
|
||||
|
|
@ -33,11 +33,11 @@ namespace FModel.Creator.Valorant
|
|||
public BaseUIData(IUExport export) : this()
|
||||
{
|
||||
if (export.GetExport<TextProperty>("DisplayName") is TextProperty displayName)
|
||||
DisplayName = Text.GetTextPropertyBase(displayName);
|
||||
DisplayName = Text.GetTextPropertyBase(displayName) ?? "";
|
||||
if (export.GetExport<TextProperty>("Description") is TextProperty description)
|
||||
{
|
||||
Description = Text.GetTextPropertyBase(description);
|
||||
if (Description != null && Description.Equals(DisplayName)) Description = string.Empty;
|
||||
Description = Text.GetTextPropertyBase(description) ?? "";
|
||||
if (Description.Equals(DisplayName)) Description = string.Empty;
|
||||
if (!string.IsNullOrEmpty(Description))
|
||||
{
|
||||
Height += (int)descriptionPaint.TextSize * Helper.SplitLines(Description, descriptionPaint, Width - Margin).Length;
|
||||
|
|
@ -45,14 +45,14 @@ namespace FModel.Creator.Valorant
|
|||
}
|
||||
}
|
||||
|
||||
if (export.GetExport<ObjectProperty>("ListViewIcon", "FullRender", "VerticalPromoImage", "LargeIcon", "DisplayIcon") is ObjectProperty icon)
|
||||
if (export.GetExport<ObjectProperty>("StoreFeaturedImage", "FullRender", "VerticalPromoImage", "LargeIcon", "DisplayIcon2", "DisplayIcon") is ObjectProperty icon)
|
||||
{
|
||||
SKBitmap raw = Utils.GetObjectTexture(icon);
|
||||
if (raw != null)
|
||||
{
|
||||
int coef = Width / raw.Width;
|
||||
int sizeX = raw.Width * coef;
|
||||
int sizeY = raw.Height * coef;
|
||||
float coef = (float)Width / (float)raw.Width;
|
||||
int sizeX = (int)(raw.Width * coef);
|
||||
int sizeY = (int)(raw.Height * coef);
|
||||
Height += sizeY;
|
||||
IconImage = raw.Resize(sizeX, sizeY);
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ namespace FModel.Creator.Valorant
|
|||
|
||||
public void Draw(SKCanvas c)
|
||||
{
|
||||
int textSize = 45;
|
||||
float textSize = 67.5f;
|
||||
SKPaint namePaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
|
|
@ -82,7 +82,7 @@ namespace FModel.Creator.Valorant
|
|||
|
||||
// wrap if too long
|
||||
Helper.DrawMultilineText(c, Description, Width, Margin, ETextSide.Left,
|
||||
new SKRect(Margin, textSize + 25, Width - Margin, Height - 25), descriptionPaint, out var yPos);
|
||||
new SKRect(Margin, textSize + 37.5f, Width - Margin, Height - 37.5f), descriptionPaint, out var yPos);
|
||||
|
||||
if (IconImage != null)
|
||||
c.DrawBitmap(IconImage, new SKRect(0, yPos, Width, Height),
|
||||
|
|
|
|||
|
|
@ -33,28 +33,19 @@ namespace FModel.Creator
|
|||
case "ArmorUIData":
|
||||
case "SprayUIData":
|
||||
case "ThemeUIData":
|
||||
case "SeasonUIData":
|
||||
case "MissionUIData":
|
||||
case "ContractUIData":
|
||||
case "CurrencyUIData":
|
||||
case "GameModeUIData":
|
||||
case "ObjectiveUIData":
|
||||
case "CharacterUIData":
|
||||
case "SprayLevelUIData":
|
||||
case "EquippableUIData":
|
||||
case "PlayerCardUIData":
|
||||
case "ContentTierUIData":
|
||||
case "PlayerTitleUIData":
|
||||
case "Gun_UIData_Base_C":
|
||||
case "CharacterRoleUIData":
|
||||
case "StorefrontItemUIData":
|
||||
case "SprayEquipSlotUIData":
|
||||
case "EquippableSkinUIData":
|
||||
case "ContractChapterUIData":
|
||||
case "EquippableCharmUIData":
|
||||
case "EquippableSkinLevelUIData":
|
||||
case "EquippableSkinChromaUIData":
|
||||
case "EquippableAttachmentUIData":
|
||||
case "EquippableCharmLevelUIData":
|
||||
{
|
||||
BaseUIData icon = new BaseUIData(export);
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ namespace FModel.Utils
|
|||
return lang switch
|
||||
{
|
||||
//Indonesian id-ID
|
||||
//Mexican Spanish es-MX
|
||||
//Thailand th-TH
|
||||
//Vietnam vi-VN
|
||||
ELanguage.English => "en-US",
|
||||
|
|
@ -150,7 +149,7 @@ namespace FModel.Utils
|
|||
ELanguage.German => "de-DE",
|
||||
ELanguage.Italian => "it-IT",
|
||||
ELanguage.Spanish => "es-ES",
|
||||
ELanguage.SpanishLatin => "es-419",
|
||||
ELanguage.SpanishLatin => "es-MX",
|
||||
ELanguage.Arabic => "ar-AE",
|
||||
ELanguage.Japanese => "ja-JP",
|
||||
ELanguage.Korean => "ko-KR",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user