FModel 3.1.0.4

This commit is contained in:
iAmAsval
2020-05-25 21:50:35 +02:00
parent a4f1cc2b2c
commit e9de63b69e
13 changed files with 111 additions and 40 deletions

View File

@@ -26,27 +26,42 @@ namespace FModel.Creator
public BaseOffer(IUExport export) : this()
{
if (export.TryGetValue("DetailsImage", out var v1) && v1 is StructProperty s &&
s.Value is UObject typeImage && typeImage.TryGetValue("ResourceObject", out var v2) && v2 is ObjectProperty resourceObject)
if (export.GetExport<StructProperty>("DetailsImage", "TileImage") is StructProperty typeImage)
{
IconImage = Utils.GetObjectTexture(resourceObject);
}
if (export.TryGetValue("Gradient", out var g) && g is StructProperty r && r.Value is UObject gradient)
{
if (gradient.TryGetValue("Start", out var s1) && s1 is StructProperty t1 && t1.Value is FLinearColor start &&
gradient.TryGetValue("Stop", out var s2) && s2 is StructProperty t2 && t2.Value is FLinearColor stop)
if (typeImage.Value is UObject t && t.TryGetValue("ResourceObject", out var v) && v is ObjectProperty resourceObject)
{
RarityBackgroundColors = new SKColor[2] { SKColor.Parse(stop.Hex), SKColor.Parse(start.Hex) };
IconImage = Utils.GetObjectTexture(resourceObject);
}
}
if (export.TryGetValue("Background", out var b) && b is StructProperty a && a.Value is FLinearColor background)
RarityBorderColor = SKColor.Parse(background.Hex);
if (export.GetExport<StructProperty>("Gradient") is StructProperty gradient)
{
if (gradient.Value is UObject g &&
g.TryGetValue("Start", out var s1) && s1 is StructProperty t1 && t1.Value is FLinearColor start &&
g.TryGetValue("Stop", out var s2) && s2 is StructProperty t2 && t2.Value is FLinearColor stop)
{
RarityBackgroundColors = new SKColor[2] { SKColor.Parse(start.Hex), SKColor.Parse(stop.Hex) };
}
}
if (export.GetExport<StructProperty>("Background") is StructProperty background)
{
if (background.Value is FLinearColor b)
{
RarityBorderColor = SKColor.Parse(b.Hex);
}
}
}
public void Draw(SKCanvas c)
public void DrawBackground(SKCanvas c)
{
if (RarityBackgroundColors[0] == RarityBackgroundColors[1])
RarityBackgroundColors[0] = RarityBorderColor;
RarityBackgroundColors[0].ToHsl(out var _, out var _, out var l1);
RarityBackgroundColors[1].ToHsl(out var _, out var _, out var l2);
bool reverse = l1 > l2;
// border
c.DrawRect(new SKRect(0, 0, Size, Size),
new SKPaint
@@ -64,10 +79,13 @@ namespace FModel.Creator
Shader = SKShader.CreateRadialGradient(
new SKPoint(Size / 2, Size / 2),
Size / 5 * 4,
RarityBackgroundColors,
new SKColor[2] { reverse ? RarityBackgroundColors[0] : RarityBackgroundColors[1], reverse ? RarityBackgroundColors[1] : RarityBackgroundColors[0] },
SKShaderTileMode.Clamp)
});
}
public void DrawImage(SKCanvas c)
{
c.DrawBitmap(IconImage ?? FallbackImage, new SKRect(Margin, Margin, Size - Margin, Size - Margin),
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
}

View File

@@ -92,29 +92,37 @@ namespace FModel.Creator
{
BaseIcon icon = new BaseIcon(export, exportType, ref assetName);
int height = icon.Size + icon.AdditionalSize;
using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Opaque))
using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul))
using (var c = new SKCanvas(ret))
{
Rarity.DrawRarity(c, icon);
LargeSmallImage.DrawPreviewImage(c, icon);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
{
Text.DrawBackground(c, icon);
Text.DrawDisplayName(c, icon);
Text.DrawDescription(c, icon);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini)
{
if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description))
Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription);
Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource);
}
Rarity.DrawRarity(c, icon);
}
UserFacingFlag.DrawUserFacingFlags(c, icon);
// has more things to show
if (height > icon.Size)
LargeSmallImage.DrawPreviewImage(c, icon);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
{
Statistics.DrawStats(c, icon);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
{
Text.DrawBackground(c, icon);
Text.DrawDisplayName(c, icon);
Text.DrawDescription(c, icon);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini)
{
if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description))
Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription);
Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource);
}
}
UserFacingFlag.DrawUserFacingFlags(c, icon);
// has more things to show
if (height > icon.Size)
{
Statistics.DrawStats(c, icon);
}
}
Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
@@ -125,10 +133,14 @@ namespace FModel.Creator
case "FortMtxOfferData":
{
BaseOffer icon = new BaseOffer(export);
using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque))
using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
using (var c = new SKCanvas(ret))
{
icon.Draw(c);
if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
{
icon.DrawBackground(c);
}
icon.DrawImage(c);
Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
ImageBoxVm.imageBoxViewModel.Set(ret, assetName);

View File

@@ -54,6 +54,7 @@
public enum EIconDesign : long
{
Default,
NoBackground,
NoText,
Mini,
Flat

View File

@@ -8,8 +8,8 @@
<StartupObject>FModel.App</StartupObject>
<Authors>Asval</Authors>
<Company></Company>
<AssemblyVersion>3.1.0.3</AssemblyVersion>
<FileVersion>3.1.0.3</FileVersion>
<AssemblyVersion>3.1.0.4</AssemblyVersion>
<FileVersion>3.1.0.4</FileVersion>
<PackageIcon>FModel.ico</PackageIcon>
<PackageIconUrl />
<PackageProjectUrl>https://github.com/iAmAsval/FModel</PackageProjectUrl>
@@ -53,6 +53,7 @@
<None Remove="Resources\EIconDesign_Default.png" />
<None Remove="Resources\EIconDesign_Flat.png" />
<None Remove="Resources\EIconDesign_Mini.png" />
<None Remove="Resources\EIconDesign_NoBackground.png" />
<None Remove="Resources\EIconDesign_NoText.png" />
<None Remove="Resources\file-export.png" />
<None Remove="Resources\file-image.ico" />
@@ -122,7 +123,7 @@
<PackageReference Include="AvalonEdit" Version="6.0.1" />
<PackageReference Include="CSCore" Version="1.2.1.2" />
<PackageReference Include="DiscordRichPresence" Version="1.0.150" />
<PackageReference Include="DotNetZip" Version="1.13.7" />
<PackageReference Include="DotNetZip" Version="1.13.8" />
<PackageReference Include="Extended.Wpf.Toolkit" Version="3.8.1" />
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
@@ -156,6 +157,7 @@
<Resource Include="Resources\EIconDesign_Default.png" />
<Resource Include="Resources\EIconDesign_Flat.png" />
<Resource Include="Resources\EIconDesign_Mini.png" />
<Resource Include="Resources\EIconDesign_NoBackground.png" />
<Resource Include="Resources\EIconDesign_NoText.png" />
<Resource Include="Resources\file-export.png" />
<Resource Include="Resources\file-image.ico" />

View File

@@ -881,6 +881,16 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap EIconDesign_NoBackground {
get {
object obj = ResourceManager.GetObject("EIconDesign_NoBackground", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
@@ -1766,6 +1776,15 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à No Background.
/// </summary>
public static string NoBackground {
get {
return ResourceManager.GetString("NoBackground", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à There are currently no data to export.
/// </summary>

View File

@@ -820,4 +820,7 @@ It's now the most used free software to leak on Fortnite.</value>
<data name="UseFEnglish" xml:space="preserve">
<value>استخدم Fmodel باللغة الإنجليزية</value>
</data>
<data name="NoBackground" xml:space="preserve">
<value>أي خلفية</value>
</data>
</root>

View File

@@ -855,4 +855,7 @@ Jetzt ist es die am häufigsten genutzte freie Software um mit Fortnite zu leake
<data name="UseFEnglish" xml:space="preserve">
<value>FModel in Englisch benutzen</value>
</data>
<data name="NoBackground" xml:space="preserve">
<value>Kein Hintergrund</value>
</data>
</root>

View File

@@ -862,4 +862,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite.</v
<data name="UseFEnglish" xml:space="preserve">
<value>Utiliser FModel en Anglais</value>
</data>
<data name="NoBackground" xml:space="preserve">
<value>Pas de fond</value>
</data>
</root>

View File

@@ -820,4 +820,7 @@ Col tempo sono state aggiunte nuove funzioni e molti altri utenti hanno comincia
<data name="NoImageToCopy" xml:space="preserve">
<value>Al momento non ci sono immagini da copiare</value>
</data>
<data name="NoBackground" xml:space="preserve">
<value>Nessuno Sfondo</value>
</data>
</root>

View File

@@ -1098,4 +1098,10 @@ It's now the most used free software to leak on Fortnite.</value>
<data name="UseFEnglish" xml:space="preserve">
<value>Use FModel in English</value>
</data>
<data name="NoBackground" xml:space="preserve">
<value>No Background</value>
</data>
<data name="EIconDesign_NoBackground" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\EIconDesign_NoBackground.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@@ -26,9 +26,10 @@ namespace FModel.ViewModels.ComboBox
public static ObservableCollection<ComboBoxViewModel> designCbViewModel = new ObservableCollection<ComboBoxViewModel>
{
new ComboBoxViewModel { Id = 0, Content = Properties.Resources.Default, Property = EIconDesign.Default },
new ComboBoxViewModel { Id = 1, Content = Properties.Resources.NoText, Property = EIconDesign.NoText },
new ComboBoxViewModel { Id = 2, Content = Properties.Resources.Minimalist, Property = EIconDesign.Mini },
new ComboBoxViewModel { Id = 3, Content = Properties.Resources.Flat, Property = EIconDesign.Flat }
new ComboBoxViewModel { Id = 1, Content = Properties.Resources.NoBackground, Property = EIconDesign.NoBackground },
new ComboBoxViewModel { Id = 2, Content = Properties.Resources.NoText, Property = EIconDesign.NoText },
new ComboBoxViewModel { Id = 3, Content = Properties.Resources.Minimalist, Property = EIconDesign.Mini },
new ComboBoxViewModel { Id = 4, Content = Properties.Resources.Flat, Property = EIconDesign.Flat }
};
public static ObservableCollection<ComboBoxViewModel> gamesCbViewModel = new ObservableCollection<ComboBoxViewModel>();

View File

@@ -129,7 +129,7 @@ namespace FModel.Windows.Settings
if (Designs_CbBox.HasItems && Designs_CbBox.SelectedIndex >= 0 && Designs_CbBox.SelectedItem is ComboBoxViewModel selectedItem)
{
using SKBitmap rarityBase = SKBitmap.Decode(Application.GetResourceStream(new Uri($"pack://application:,,,/Resources/EIconDesign_{(EIconDesign)selectedItem.Property}.png")).Stream);
using var ret = new SKBitmap(512, 512, SKColorType.Rgba8888, SKAlphaType.Opaque);
using var ret = new SKBitmap(512, 512, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(ret);
c.DrawBitmap(rarityBase, new SKRect(0, 0, 512, 512),
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });