|
|
@@ -42,6 +42,7 @@ namespace GFGGame
|
|
|
|
|
|
public static async Task AddPackageAsync(string descFilePath)
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 1");
|
|
|
_assetCount.TryGetValue(descFilePath, out var count);
|
|
|
if (count > 0)
|
|
|
{
|
|
|
@@ -49,12 +50,15 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
_assetCount.Add(descFilePath, count + 1);
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 2");
|
|
|
var handle = YooAssets.LoadAssetAsync<TextAsset>($"{descFilePath}_fui.bytes");
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 3");
|
|
|
await handle.Task;
|
|
|
TextAsset textAsset = handle.AssetObject as TextAsset;
|
|
|
CacheAssetHandle(descFilePath, handle);
|
|
|
var uiPackage = UIPackage.AddPackage(textAsset.bytes, descFilePath, (string name, string extension, System.Type type, PackageItem item) =>
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 4");
|
|
|
string location = name + extension;
|
|
|
if (!YooAssets.CheckResExist(location))
|
|
|
{
|
|
|
@@ -64,27 +68,34 @@ namespace GFGGame
|
|
|
CacheAssetHandle(descFilePath, handle);
|
|
|
handle.Completed += (handle) =>
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 5");
|
|
|
if (handle.AssetObject == null) return;
|
|
|
Texture tex = handle.AssetObject as Texture;
|
|
|
if (tex != null)
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 6");
|
|
|
string location = name + "!a" + extension;
|
|
|
if (YooAssets.CheckResExist(location))
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 7");
|
|
|
AssetOperationHandle handleAlpha = YooAssets.LoadAssetAsync(location, type);
|
|
|
CacheAssetHandle(descFilePath, handleAlpha);
|
|
|
handleAlpha.Completed += (handle1) =>
|
|
|
{
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 8");
|
|
|
if (handle1.AssetObject == null) return;
|
|
|
Texture alphaTex = handle1.AssetObject as Texture;
|
|
|
item.owner.SetItemAsset(item, tex, alphaTex, DestroyMethod.None);//注意:这里一定要设置为None
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 9");
|
|
|
};
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 10");
|
|
|
item.owner.SetItemAsset(item, handle.AssetObject, null, DestroyMethod.None);//注意:这里一定要设置为None
|
|
|
};
|
|
|
});
|
|
|
+ Debug.Log($"正在初始化 descFilePath:{descFilePath} 11");
|
|
|
_packages.Add(descFilePath, uiPackage);
|
|
|
CheckRemovePackage(descFilePath);
|
|
|
}
|