You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
659 B
24 lines
659 B
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using FairyGUI;
|
||
|
using System;
|
||
|
using YooAsset;
|
||
|
|
||
|
public static class FUIWrapper
|
||
|
{
|
||
|
public static UIPackage AddPakageSync(byte[] descData, string assetNamePrefix, Action<UnityEngine.Object> onAssetLoad = null)
|
||
|
{
|
||
|
UIPackage uiPackage = UIPackage.AddPackage(descData, assetNamePrefix, (string assetName, string extension, Type type, out DestroyMethod method) =>
|
||
|
{
|
||
|
method = DestroyMethod.None;
|
||
|
string location = $"{assetName}";
|
||
|
var asset = YooAssetWrapper.LoadAssetSync(location, type);
|
||
|
onAssetLoad?.Invoke(asset);
|
||
|
return asset;
|
||
|
});
|
||
|
|
||
|
return uiPackage;
|
||
|
}
|
||
|
}
|