Add a working background to battle breakers item definitions

I tried using the texture from the files, but it kept being null
This commit is contained in:
GMatrixGames 2020-10-17 19:08:59 -04:00
parent fef39af079
commit 5741372139
No known key found for this signature in database
GPG Key ID: 19B7F96FB9AF302F
4 changed files with 15 additions and 3 deletions

View File

@ -12,6 +12,7 @@ namespace FModel.Creator.Bases
{
public SKBitmap FallbackImage;
public SKBitmap IconImage;
public SKBitmap RarityBackgroundImage;
public SKColor[] RarityBackgroundColors;
public SKColor[] RarityBorderColor;
public string DisplayName;
@ -23,6 +24,7 @@ namespace FModel.Creator.Bases
public BaseBBDefinition(string exportType)
{
FallbackImage = SKBitmap.Decode(Application.GetResourceStream(new Uri("pack://application:,,,/Resources/T_Placeholder_Item_Image.png"))?.Stream);
RarityBackgroundImage = null;
IconImage = FallbackImage;
RarityBackgroundColors = new[] { SKColor.Parse("D0D0D0"), SKColor.Parse("636363") };
RarityBorderColor = new[] { SKColor.Parse("D0D0D0"), SKColor.Parse("FFFFFF") };
@ -32,8 +34,6 @@ namespace FModel.Creator.Bases
public BaseBBDefinition(IUExport export, string exportType) : this(exportType)
{
// Not sure how to handle rarity for this. From what I can see, there is no data for colors
if (export.GetExport<SoftObjectProperty>("IconTextureAssetData") is {} previewImage)
IconImage = Utils.GetSoftObjectTexture(previewImage);
else if (export.GetExport<ObjectProperty>("IconTextureAssetData") is {} iconTexture)
@ -43,6 +43,8 @@ namespace FModel.Creator.Bases
DisplayName = Text.GetTextPropertyBase(displayName);
if (export.GetExport<TextProperty>("Description") is {} description)
Description = Text.GetTextPropertyBase(description);
RarityBackgroundImage = SKBitmap.Decode(Application.GetResourceStream(new Uri("pack://application:,,,/Resources/battle-breakers-item-background.png"))?.Stream);
}
SKBitmap IBase.FallbackImage => FallbackImage;

View File

@ -462,7 +462,15 @@ namespace FModel.Creator
{
if ((EIconDesign) Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
{
Rarity.DrawRarity(c, icon);
if (icon.RarityBackgroundImage != null)
{
c.DrawBitmap(icon.RarityBackgroundImage, new SKRect(icon.Margin, icon.Margin, icon.Width - icon.Margin, icon.Height - icon.Margin),
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });
}
else
{
Rarity.DrawRarity(c, icon);
}
}
LargeSmallImage.DrawPreviewImage(c, icon);

View File

@ -108,6 +108,7 @@
<None Remove="Resources\T_Placeholder_Challenge_Image.png" />
<None Remove="Resources\T_Placeholder_Item_Image.png" />
<None Remove="Resources\T_ReloadTime_Weapon_Stats.png" />
<None Remove="Resources\battle-breakers-item-background.png" />
<None Remove="Resources\valorant.live.ico" />
<None Remove="Resources\view-dashboard.png" />
<None Remove="Resources\volume-minus.png" />
@ -227,6 +228,7 @@
<Resource Include="Resources\T_Placeholder_Challenge_Image.png" />
<Resource Include="Resources\T_Placeholder_Item_Image.png" />
<Resource Include="Resources\T_ReloadTime_Weapon_Stats.png" />
<Resource Include="Resources\battle-breakers-item-background.png" />
<Resource Include="Resources\valorant.live.ico" />
<Resource Include="Resources\view-dashboard.png" />
<Resource Include="Resources\volume-minus.png" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB