mirror of
https://github.com/4sval/FModel.git
synced 2026-06-21 07:20:05 -05:00
GameModeInfo (currently not generating)
This commit is contained in:
parent
603b7a8a9f
commit
dd605933a4
|
|
@ -17,11 +17,11 @@ namespace FModel.Creator.Bases.FN
|
|||
|
||||
public override void ParseForInfo()
|
||||
{
|
||||
if (!(Object is UMaterialInstanceConstant material)) return;
|
||||
if (Object is not UMaterialInstanceConstant material) return;
|
||||
|
||||
foreach (var textureParameter in material.TextureParameterValues) // get texture from base material
|
||||
{
|
||||
if (!(textureParameter.ParameterValue is UTexture2D texture) || Preview != null) continue;
|
||||
if (textureParameter.ParameterValue is not UTexture2D texture || Preview != null) continue;
|
||||
switch (textureParameter.ParameterInfo.Name.Text)
|
||||
{
|
||||
case "SeriesTexture":
|
||||
|
|
|
|||
50
FModel/Creator/Bases/SB/BaseGameModeInfo.cs
Normal file
50
FModel/Creator/Bases/SB/BaseGameModeInfo.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.UE4.Objects.Core.i18N;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace FModel.Creator.Bases.SB
|
||||
{
|
||||
public class BaseGameModeInfo : UCreator
|
||||
{
|
||||
private SKBitmap _icon;
|
||||
|
||||
public BaseGameModeInfo(UObject uObject, EIconStyle style) : base(uObject, style)
|
||||
{
|
||||
Width = 738;
|
||||
Height = 1024;
|
||||
}
|
||||
|
||||
public override void ParseForInfo()
|
||||
{
|
||||
if (Object.TryGetValue(out FText displayName, "DisplayName"))
|
||||
DisplayName = displayName.Text;
|
||||
if (Object.TryGetValue(out FText description, "Description"))
|
||||
Description = description.Text;
|
||||
if (Object.TryGetValue(out UMaterialInstanceConstant portrait, "Portrait"))
|
||||
Preview = Utils.GetBitmap(portrait);
|
||||
if (Object.TryGetValue(out UTexture2D icon, "Icon"))
|
||||
_icon = Utils.GetBitmap(icon).Resize(25);
|
||||
}
|
||||
|
||||
public override SKImage Draw()
|
||||
{
|
||||
using var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Premul);
|
||||
using var c = new SKCanvas(ret);
|
||||
|
||||
DrawPreview(c);
|
||||
DrawTextBackground(c);
|
||||
DrawDisplayName(c);
|
||||
DrawIcon(c);
|
||||
|
||||
return SKImage.FromBitmap(ret);
|
||||
}
|
||||
|
||||
private void DrawIcon(SKCanvas c)
|
||||
{
|
||||
if (_icon == null) return;
|
||||
c.DrawBitmap(_icon, new SKPoint(5, 5), ImagePaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,11 @@ namespace FModel.Creator.Bases
|
|||
}
|
||||
|
||||
protected void DrawPreview(SKCanvas c)
|
||||
=> c.DrawBitmap(Preview ?? DefaultPreview, new SKRect(Margin, Margin, Width - Margin, Height - Margin), ImagePaint);
|
||||
{
|
||||
var i = Preview ?? DefaultPreview;
|
||||
var x = i.Width < Width ? Width / 2 - i.Width / 2 : Margin;
|
||||
c.DrawBitmap(i, new SKRect(x, Margin, x + i.Width - Margin * 2, i.Height - Margin), ImagePaint);
|
||||
}
|
||||
|
||||
protected void DrawTextBackground(SKCanvas c)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@ namespace FModel.Creator
|
|||
case "GRMTStoreOffer":
|
||||
case "GCosmeticEmote":
|
||||
case "GCosmeticCard":
|
||||
case "GGameModeInfo":
|
||||
case "GCosmeticSkin":
|
||||
case "GStoreOffer":
|
||||
case "GAccolade":
|
||||
|
|
@ -226,6 +225,10 @@ namespace FModel.Creator
|
|||
case "GLeagueDivision":
|
||||
creator = new BaseDivision(_object, EIconStyle.Default);
|
||||
return true;
|
||||
// TODO: Draw this properly
|
||||
// case "GGameModeInfo":
|
||||
// creator = new BaseGameModeInfo(_object, EIconStyle.Default);
|
||||
// return true;
|
||||
default:
|
||||
creator = null;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -107,9 +107,10 @@ namespace FModel.Creator
|
|||
if (material == null) return null;
|
||||
foreach (var textureParameter in material.TextureParameterValues)
|
||||
{
|
||||
if (!(textureParameter.ParameterValue is UTexture2D texture)) continue;
|
||||
if (textureParameter.ParameterValue is not UTexture2D texture) continue;
|
||||
switch (textureParameter.ParameterInfo.Name.Text)
|
||||
{
|
||||
case "MainTex":
|
||||
case "TextureA":
|
||||
case "TextureB":
|
||||
case "OfferImage":
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user