mirror of
https://github.com/4sval/FModel.git
synced 2026-06-21 15:30:05 -05:00
added abilities on Valorant Character Icons
This commit is contained in:
parent
472e0d15ab
commit
4d794e8fc8
|
|
@ -5,7 +5,7 @@ using PakReader.Parsers.Class;
|
|||
using PakReader.Parsers.PropertyTagData;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FModel.Creator.Fortnite
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class BaseBundle
|
||||
{
|
||||
|
|
@ -10,7 +10,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace FModel.Creator.Fortnite
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class BaseIcon
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using PakReader.Parsers.Class;
|
|||
using PakReader.Parsers.PropertyTagData;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace FModel.Creator.Valorant
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class BaseMapUIData
|
||||
{
|
||||
|
|
@ -5,7 +5,7 @@ using SkiaSharp;
|
|||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace FModel.Creator.Fortnite
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class BaseOffer
|
||||
{
|
||||
160
FModel/Creator/Bases/BaseUIData.cs
Normal file
160
FModel/Creator/Bases/BaseUIData.cs
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
using FModel.Creator.Stats;
|
||||
using FModel.Creator.Texts;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
using SkiaSharp;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class BaseUIData
|
||||
{
|
||||
private readonly SKPaint descriptionPaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DescriptionTypeface,
|
||||
TextSize = 19.5f,
|
||||
Color = SKColors.White,
|
||||
};
|
||||
|
||||
public SKBitmap IconImage;
|
||||
public string DisplayName;
|
||||
public string Description;
|
||||
public List<Statistic> Abilities;
|
||||
public int Width = 768; // keep it 512 (or a multiple of 512) if you don't want blurry icons
|
||||
public int AdditionalWidth = 0;
|
||||
public int Height = 96;
|
||||
public int Margin = 3;
|
||||
|
||||
public BaseUIData()
|
||||
{
|
||||
IconImage = null;
|
||||
DisplayName = "";
|
||||
Description = "";
|
||||
Abilities = new List<Statistic>();
|
||||
}
|
||||
|
||||
public BaseUIData(IUExport[] exports, int baseIndex) : this()
|
||||
{
|
||||
if (exports[baseIndex].GetExport<TextProperty>("DisplayName") is TextProperty displayName)
|
||||
DisplayName = Text.GetTextPropertyBase(displayName) ?? "";
|
||||
if (exports[baseIndex].GetExport<TextProperty>("Description") is TextProperty description)
|
||||
{
|
||||
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;
|
||||
Height += (int)descriptionPaint.TextSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (exports[baseIndex].GetExport<ObjectProperty>("StoreFeaturedImage", "FullRender", "VerticalPromoImage", "LargeIcon", "DisplayIcon2", "DisplayIcon") is ObjectProperty icon)
|
||||
{
|
||||
SKBitmap raw = Utils.GetObjectTexture(icon);
|
||||
if (raw != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (exports[baseIndex].GetExport<MapProperty>("Abilities") is MapProperty abilities)
|
||||
{
|
||||
AdditionalWidth = 768;
|
||||
foreach (var (_, value) in abilities.Value)
|
||||
{
|
||||
if (value is ObjectProperty o && o.Value.Resource == null && o.Value.Index > 0)
|
||||
{
|
||||
Statistic s = new Statistic();
|
||||
if (exports[o.Value.Index - 1].GetExport<TextProperty>("DisplayName") is TextProperty aDisplayName)
|
||||
s.DisplayName = Text.GetTextPropertyBase(aDisplayName) ?? "";
|
||||
if (exports[o.Value.Index - 1].GetExport<TextProperty>("Description") is TextProperty aDescription)
|
||||
{
|
||||
s.Description = Text.GetTextPropertyBase(aDescription) ?? "";
|
||||
if (!string.IsNullOrEmpty(Description))
|
||||
{
|
||||
s.Height += (int)descriptionPaint.TextSize * Helper.SplitLines(s.Description, descriptionPaint, Width - Margin).Length;
|
||||
s.Height += (int)descriptionPaint.TextSize * 3;
|
||||
}
|
||||
}
|
||||
if (exports[o.Value.Index - 1].GetExport<ObjectProperty>("DisplayIcon") is ObjectProperty displayIcon)
|
||||
{
|
||||
SKBitmap raw = Utils.GetObjectTexture(displayIcon);
|
||||
if (raw != null) s.Icon = raw.Resize(128, 128);
|
||||
}
|
||||
Abilities.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(SKCanvas c)
|
||||
{
|
||||
float textSize = 67.5f;
|
||||
SKPaint namePaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DisplayNameTypeface,
|
||||
TextSize = textSize,
|
||||
Color = SKColors.White,
|
||||
TextAlign = SKTextAlign.Left,
|
||||
};
|
||||
|
||||
// resize if too long
|
||||
while (namePaint.MeasureText(DisplayName) > Width)
|
||||
{
|
||||
namePaint.TextSize = textSize -= 2;
|
||||
}
|
||||
|
||||
c.DrawText(DisplayName, Margin, Margin + textSize, namePaint);
|
||||
|
||||
// wrap if too long
|
||||
Helper.DrawMultilineText(c, Description, Width, Margin, ETextSide.Left,
|
||||
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),
|
||||
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
|
||||
|
||||
int yaPos = 0;
|
||||
foreach (Statistic ability in Abilities)
|
||||
{
|
||||
int xToAdd = ability.Icon != null ? ability.Icon.Width : 0;
|
||||
textSize = 42.5f;
|
||||
namePaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DisplayNameTypeface,
|
||||
TextSize = textSize,
|
||||
Color = SKColors.White,
|
||||
TextAlign = SKTextAlign.Left,
|
||||
};
|
||||
|
||||
// resize if too long
|
||||
while (namePaint.MeasureText(ability.DisplayName) > Width - 128)
|
||||
{
|
||||
namePaint.TextSize = textSize -= 2;
|
||||
}
|
||||
|
||||
c.DrawText(ability.DisplayName, Width + Margin + xToAdd + 10, yaPos + Margin + textSize, namePaint);
|
||||
|
||||
Helper.DrawMultilineText(c, ability.Description, Width, Width + Margin + xToAdd + 10, ETextSide.Left,
|
||||
new SKRect(Margin, textSize + yaPos + 27.5f, Width + AdditionalWidth - Margin, Height - 27.5f), descriptionPaint, out var _);
|
||||
|
||||
if (ability.Icon != null)
|
||||
c.DrawBitmap(ability.Icon, new SKRect(Width + Margin, yaPos, Width + Margin + ability.Icon.Width, yaPos + ability.Icon.Height),
|
||||
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
|
||||
|
||||
yaPos += ability.Height + 48 + (Margin * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using PakReader.Parsers.PropertyTagData;
|
|||
using SkiaSharp;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FModel.Creator.Fortnite
|
||||
namespace FModel.Creator.Bases
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Creator.Texts;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Creator.Texts;
|
||||
using SkiaSharp;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
|
|
|
|||
|
|
@ -1,33 +1,32 @@
|
|||
using FModel.Creator.Bundles;
|
||||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Creator.Bundles;
|
||||
using FModel.Creator.Icons;
|
||||
using FModel.Creator.Rarities;
|
||||
using FModel.Creator.Stats;
|
||||
using FModel.Creator.Texts;
|
||||
using FModel.ViewModels.ImageBox;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.Objects;
|
||||
using SkiaSharp;
|
||||
using System.IO;
|
||||
|
||||
namespace FModel.Creator
|
||||
{
|
||||
static class FortniteCreator
|
||||
static class Creator
|
||||
{
|
||||
/// <summary>
|
||||
/// we draw based on the fist export type of the asset, no need to check others it's a waste of time
|
||||
/// i don't cache images because i don't wanna store a lot of SKCanvas in the memory
|
||||
/// </summary>
|
||||
/// <returns>true if an icon has been drawn</returns>
|
||||
public static bool TryDrawFortniteIcon(string assetPath, string exportType, IUExport export)
|
||||
public static bool TryDrawIcon(string assetPath, FName[] exportTypes, IUExport[] exports)
|
||||
{
|
||||
var d = new DirectoryInfo(assetPath);
|
||||
string assetName = d.Name;
|
||||
string assetFolder = d.Parent.Name;
|
||||
if (Text.TypeFaces.NeedReload(false))
|
||||
Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first
|
||||
if (Text.TypeFaces.NeedReload(false)) Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first
|
||||
|
||||
// please respect my wave if you wanna add a new exportType
|
||||
// Athena first, then Fort, thank you
|
||||
int index = Globals.Game.ActualGame == EGame.Valorant ? 1 : 0;
|
||||
string exportType = exportTypes.Length > index ? exportTypes[index].String : string.Empty;
|
||||
switch (exportType)
|
||||
{
|
||||
case "AthenaConsumableEmoteItemDefinition":
|
||||
|
|
@ -91,7 +90,7 @@ namespace FModel.Creator
|
|||
case "FortWeaponMeleeDualWieldItemDefinition":
|
||||
case "FortDailyRewardScheduleTokenDefinition":
|
||||
{
|
||||
BaseIcon icon = new BaseIcon(export, exportType, ref assetName);
|
||||
BaseIcon icon = new BaseIcon(exports[index], exportType, ref assetName);
|
||||
int height = icon.Size + icon.AdditionalSize;
|
||||
using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
|
|
@ -133,7 +132,7 @@ namespace FModel.Creator
|
|||
}
|
||||
case "FortMtxOfferData":
|
||||
{
|
||||
BaseOffer icon = new BaseOffer(export);
|
||||
BaseOffer icon = new BaseOffer(exports[index]);
|
||||
using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
|
|
@ -154,7 +153,7 @@ namespace FModel.Creator
|
|||
using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
Serie.GetRarity(icon, export);
|
||||
Serie.GetRarity(icon, exports[index]);
|
||||
Rarity.DrawRarity(c, icon);
|
||||
|
||||
Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
|
||||
|
|
@ -173,7 +172,7 @@ namespace FModel.Creator
|
|||
case "PlaylistUserOptionPrimaryAsset":
|
||||
case "PlaylistUserOptionCollisionProfileEnum":
|
||||
{
|
||||
BaseUserOption icon = new BaseUserOption(export);
|
||||
BaseUserOption icon = new BaseUserOption(exports[index]);
|
||||
using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Opaque))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
|
|
@ -186,7 +185,7 @@ namespace FModel.Creator
|
|||
}
|
||||
case "FortChallengeBundleItemDefinition":
|
||||
{
|
||||
BaseBundle icon = new BaseBundle(export, assetFolder);
|
||||
BaseBundle icon = new BaseBundle(exports[index], assetFolder);
|
||||
using (var ret = new SKBitmap(icon.Width, icon.HeaderHeight + icon.AdditionalSize, SKColorType.Rgba8888, SKAlphaType.Opaque))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
|
|
@ -199,6 +198,46 @@ namespace FModel.Creator
|
|||
}
|
||||
return true;
|
||||
}
|
||||
case "MapUIData":
|
||||
{
|
||||
BaseMapUIData icon = new BaseMapUIData(exports[index]);
|
||||
using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
icon.Draw(c);
|
||||
ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "ArmorUIData":
|
||||
case "SprayUIData":
|
||||
case "ThemeUIData":
|
||||
case "ContractUIData":
|
||||
case "CurrencyUIData":
|
||||
case "GameModeUIData":
|
||||
case "CharacterUIData":
|
||||
case "SprayLevelUIData":
|
||||
case "EquippableUIData":
|
||||
case "PlayerCardUIData":
|
||||
case "Gun_UIData_Base_C":
|
||||
case "CharacterRoleUIData":
|
||||
case "EquippableSkinUIData":
|
||||
case "EquippableCharmUIData":
|
||||
case "EquippableSkinLevelUIData":
|
||||
case "EquippableSkinChromaUIData":
|
||||
case "EquippableCharmLevelUIData":
|
||||
{
|
||||
BaseUIData icon = new BaseUIData(exports, index);
|
||||
using (var ret = new SKBitmap(icon.Width + icon.AdditionalWidth, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
icon.Draw(c);
|
||||
|
||||
Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
|
||||
ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.Objects;
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
using FModel.Creator.Valorant;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
|
||||
namespace FModel.Creator.Labels
|
||||
{
|
||||
static class ExplicitAsset
|
||||
{
|
||||
public static void GetAsset(BaseLabel icon, SoftObjectProperty s)
|
||||
{
|
||||
PakPackage p = Utils.GetPropertyPakPackage(s.Value.AssetPathName.String);
|
||||
if (p.HasExport() && !p.Equals(default))
|
||||
{
|
||||
var obj = p.GetIndexedExport<UObject>(0);
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj.TryGetValue("UIData", out var t) && t is SoftObjectProperty sop)
|
||||
{
|
||||
p = Utils.GetPropertyPakPackage(sop.Value.AssetPathName.String);
|
||||
if (p.HasExport() && !p.Equals(default))
|
||||
{
|
||||
obj = p.GetIndexedExport<UObject>(0);
|
||||
if (obj != null)
|
||||
{
|
||||
var uiData = new BaseUIData(obj);
|
||||
icon.IconImages.Add(uiData);
|
||||
icon.Height += uiData.IconImage.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.Objects;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.Objects;
|
||||
|
|
|
|||
|
|
@ -6,5 +6,7 @@ namespace FModel.Creator.Stats
|
|||
{
|
||||
public SKBitmap Icon;
|
||||
public string Description;
|
||||
public string DisplayName;
|
||||
public int Height;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Creator.Texts;
|
||||
using FModel.Utils;
|
||||
using PakReader.Pak;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Creator.Icons;
|
||||
using FModel.Utils;
|
||||
using PakReader.Pak;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using PakReader.Pak;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.Objects;
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
using FModel.Creator.Labels;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
using SkiaSharp;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FModel.Creator.Valorant
|
||||
{
|
||||
public class BaseLabel
|
||||
{
|
||||
public List<BaseUIData> IconImages;
|
||||
public int Width = 512; // keep it 512 (or a multiple of 512) if you don't want blurry icons
|
||||
public int Height = 512;
|
||||
public int Margin = 4;
|
||||
|
||||
public BaseLabel()
|
||||
{
|
||||
IconImages = new List<BaseUIData>();
|
||||
}
|
||||
|
||||
public BaseLabel(IUExport export) : this()
|
||||
{
|
||||
if (export.GetExport<ArrayProperty>("ExplicitAssets") is ArrayProperty explicitAssetsArray)
|
||||
{
|
||||
foreach (var o in explicitAssetsArray.Value)
|
||||
{
|
||||
if (o is SoftObjectProperty s)
|
||||
ExplicitAsset.GetAsset(this, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(SKCanvas c)
|
||||
{
|
||||
int yPos = Margin;
|
||||
foreach (BaseUIData icon in IconImages)
|
||||
{
|
||||
if (icon.IconImage != null)
|
||||
{
|
||||
c.DrawBitmap(icon.IconImage, new SKRect(0, yPos, icon.Width, yPos + icon.Height),
|
||||
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
|
||||
|
||||
yPos += icon.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
using FModel.Creator.Texts;
|
||||
using PakReader.Parsers.Class;
|
||||
using PakReader.Parsers.PropertyTagData;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace FModel.Creator.Valorant
|
||||
{
|
||||
public class BaseUIData
|
||||
{
|
||||
private readonly SKPaint descriptionPaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DescriptionTypeface,
|
||||
TextSize = 19.5f,
|
||||
Color = SKColors.White,
|
||||
};
|
||||
|
||||
public SKBitmap IconImage;
|
||||
public string DisplayName;
|
||||
public string Description;
|
||||
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()
|
||||
{
|
||||
IconImage = null;
|
||||
DisplayName = "";
|
||||
Description = "";
|
||||
}
|
||||
|
||||
public BaseUIData(IUExport export) : this()
|
||||
{
|
||||
if (export.GetExport<TextProperty>("DisplayName") is TextProperty displayName)
|
||||
DisplayName = Text.GetTextPropertyBase(displayName) ?? "";
|
||||
if (export.GetExport<TextProperty>("Description") is TextProperty description)
|
||||
{
|
||||
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;
|
||||
Height += (int)descriptionPaint.TextSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (export.GetExport<ObjectProperty>("StoreFeaturedImage", "FullRender", "VerticalPromoImage", "LargeIcon", "DisplayIcon2", "DisplayIcon") is ObjectProperty icon)
|
||||
{
|
||||
SKBitmap raw = Utils.GetObjectTexture(icon);
|
||||
if (raw != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(SKCanvas c)
|
||||
{
|
||||
float textSize = 67.5f;
|
||||
SKPaint namePaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
FilterQuality = SKFilterQuality.High,
|
||||
Typeface = Text.TypeFaces.DisplayNameTypeface,
|
||||
TextSize = textSize,
|
||||
Color = SKColors.White,
|
||||
TextAlign = SKTextAlign.Left,
|
||||
};
|
||||
|
||||
// resize if too long
|
||||
while (namePaint.MeasureText(DisplayName) > Width)
|
||||
{
|
||||
namePaint.TextSize = textSize -= 2;
|
||||
}
|
||||
|
||||
c.DrawText(DisplayName, Margin, Margin + textSize, namePaint);
|
||||
|
||||
// wrap if too long
|
||||
Helper.DrawMultilineText(c, Description, Width, Margin, ETextSide.Left,
|
||||
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),
|
||||
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
using FModel.Creator.Icons;
|
||||
using FModel.Creator.Texts;
|
||||
using FModel.Creator.Valorant;
|
||||
using FModel.ViewModels.ImageBox;
|
||||
using PakReader.Parsers.Class;
|
||||
using SkiaSharp;
|
||||
using System.IO;
|
||||
|
||||
namespace FModel.Creator
|
||||
{
|
||||
static class ValorantCreator
|
||||
{
|
||||
public static bool TryDrawValorantIcon(string assetPath, string exportType, IUExport export)
|
||||
{
|
||||
var d = new DirectoryInfo(assetPath);
|
||||
string assetName = d.Name;
|
||||
if (Text.TypeFaces.NeedReload(false))
|
||||
Text.TypeFaces = new Typefaces();
|
||||
|
||||
switch (exportType)
|
||||
{
|
||||
case "MapUIData":
|
||||
{
|
||||
BaseMapUIData icon = new BaseMapUIData(export);
|
||||
using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
icon.Draw(c);
|
||||
ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "ArmorUIData":
|
||||
case "SprayUIData":
|
||||
case "ThemeUIData":
|
||||
case "ContractUIData":
|
||||
case "CurrencyUIData":
|
||||
case "GameModeUIData":
|
||||
case "CharacterUIData":
|
||||
case "SprayLevelUIData":
|
||||
case "EquippableUIData":
|
||||
case "PlayerCardUIData":
|
||||
case "Gun_UIData_Base_C":
|
||||
case "CharacterRoleUIData":
|
||||
case "EquippableSkinUIData":
|
||||
case "EquippableCharmUIData":
|
||||
case "EquippableSkinLevelUIData":
|
||||
case "EquippableSkinChromaUIData":
|
||||
case "EquippableCharmLevelUIData":
|
||||
{
|
||||
BaseUIData icon = new BaseUIData(export);
|
||||
using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
|
||||
using (var c = new SKCanvas(ret))
|
||||
{
|
||||
icon.Draw(c);
|
||||
|
||||
Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
|
||||
ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,6 @@
|
|||
{
|
||||
English,
|
||||
French,
|
||||
AustralianEnglish,
|
||||
German,
|
||||
Italian,
|
||||
Spanish,
|
||||
|
|
@ -56,7 +55,8 @@
|
|||
Russian,
|
||||
Turkish,
|
||||
Chinese,
|
||||
TraditionalChinese
|
||||
TraditionalChinese,
|
||||
AustralianEnglish
|
||||
}
|
||||
|
||||
public enum EJsonType: long
|
||||
|
|
|
|||
1072
FModel/Globals.cs
1072
FModel/Globals.cs
File diff suppressed because it is too large
Load Diff
|
|
@ -58,6 +58,6 @@ namespace PakReader.Parsers.Objects
|
|||
public static bool operator !=(FGuid left, FGuid right) => !left.Equals(right);
|
||||
|
||||
// TODO: maybe make this more performant?
|
||||
public override string ToString() => $"{A}-{B}-{C}-{D}";
|
||||
public override string ToString() => $"{A:X8}{B:X8}{C:X8}{D:X8}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using FModel.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
|
@ -97,7 +98,7 @@ namespace FModel.PakReader
|
|||
string key = $"{didxSection.WemFilesRef[i].Id}.wem";
|
||||
if (stidSection != null && stidSection.SoundBanks.TryGetValue(didxSection.WemFilesRef[i].Id, out string name))
|
||||
key = $"{name}.wem";
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant && Globals.ValorantWemToName.TryGetValue(didxSection.WemFilesRef[i].Id, out string hardcodedname))
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant && ValoloWwiseDict.ValorantWemToName.TryGetValue(didxSection.WemFilesRef[i].Id, out string hardcodedname))
|
||||
key = $"{hardcodedname}.wem";
|
||||
|
||||
AudioFiles[key] = dataSection.WemFiles[i];
|
||||
|
|
@ -112,7 +113,7 @@ namespace FModel.PakReader
|
|||
string key = $"{entry.Path.ToUpper()}_{entry.NameHash}.wem";
|
||||
if (stidSection != null && stidSection.SoundBanks.TryGetValue(entry.NameHash, out string name))
|
||||
key = $"{name}.wem";
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant && Globals.ValorantWemToName.TryGetValue(entry.NameHash, out string hardcodedname))
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant && ValoloWwiseDict.ValorantWemToName.TryGetValue(entry.NameHash, out string hardcodedname))
|
||||
key = $"{hardcodedname}.wem";
|
||||
|
||||
AudioFiles[key] = entry.Data;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ using System.Text;
|
|||
using FModel.ViewModels.DataGrid;
|
||||
using FModel.PakReader;
|
||||
using ICSharpCode.AvalonEdit.Highlighting;
|
||||
using static FModel.Creator.FortniteCreator;
|
||||
using static FModel.Creator.ValorantCreator;
|
||||
using static FModel.Creator.Creator;
|
||||
|
||||
namespace FModel.Utils
|
||||
{
|
||||
|
|
@ -280,9 +279,7 @@ namespace FModel.Utils
|
|||
}
|
||||
|
||||
// Image Creator
|
||||
if (Globals.Game.ActualGame == EGame.Fortnite && TryDrawFortniteIcon(entry.Name, p.ExportTypes[0].String, p.Exports[0]))
|
||||
return p;
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant && TryDrawValorantIcon(entry.Name, p.ExportTypes.Length > 1 ? p.ExportTypes[1].String : p.ExportTypes[0].String, p.Exports.Length > 1 ? p.Exports[1] : p.Exports[0]))
|
||||
if (TryDrawIcon(entry.Name, p.ExportTypes, p.Exports))
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
1080
FModel/Utils/ValoloWwiseDict.cs
Normal file
1080
FModel/Utils/ValoloWwiseDict.cs
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
using FModel.Creator.Bundles;
|
||||
using FModel.Creator.Fortnite;
|
||||
using FModel.Creator.Bases;
|
||||
using FModel.Logger;
|
||||
using FModel.Windows.ColorPicker;
|
||||
using Microsoft.Win32;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user