mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
equipment icons
This commit is contained in:
1 parent
8cf3da12fa
commit
1f690d11c7
7 files changed
+97
-28
No files matched your search
@@ -1,10 +1,15 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using CUE4Parse.Compression;
|
||||
using CUE4Parse.FileProvider;
|
||||
using CUE4Parse.MappingsProvider;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.UE4.Exceptions;
|
||||
using CUE4Parse.UE4.Objects.Engine;
|
||||
using CUE4Parse.UE4.Objects.UObject;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using CUE4Parse.Utils;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace BlitzKit.Game.Models;
|
||||
|
||||
@@ -23,4 +28,32 @@ public class BlitzFileProvider : DefaultFileProvider
|
||||
Initialize();
|
||||
Mount();
|
||||
}
|
||||
|
||||
public UPrimaryDataAsset PDA(string path)
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
var combined = $"{path}.{name}";
|
||||
return LoadPackageObject<UPrimaryDataAsset>(combined);
|
||||
}
|
||||
|
||||
public byte[] Image(FSoftObjectPath path)
|
||||
{
|
||||
var uTexture = path.Load<UTexture2D>();
|
||||
return Image(uTexture);
|
||||
}
|
||||
|
||||
private readonly SKEncodedImageFormat imageFormat = SKEncodedImageFormat.Webp;
|
||||
private readonly int imageQuality = 80;
|
||||
|
||||
public byte[] Image(UTexture2D uTexture)
|
||||
{
|
||||
var cTexture = uTexture.Decode(ETexturePlatform.DesktopMobile);
|
||||
|
||||
ArgumentNullException.ThrowIfNull(cTexture);
|
||||
|
||||
var bitmap = cTexture.ToSkBitmap();
|
||||
var data = bitmap.Encode(imageFormat, imageQuality);
|
||||
|
||||
return data.ToArray();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user