update yooasset2.0

pull/189/head
hevinci 2023-09-20 16:10:57 +08:00
parent 6687d75090
commit 6fb5a4b946
5 changed files with 10 additions and 38 deletions

View File

@ -22,11 +22,6 @@ public class PackEffectTexture : IPackRule
var packRuleResult = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);
return packRuleResult;
}
bool IPackRule.IsRawFilePackRule()
{
return false;
}
}
[DisplayName("打包视频(自定义)")]
@ -41,11 +36,6 @@ public class PackVideo : IPackRule
return result;
}
bool IPackRule.IsRawFilePackRule()
{
return true;
}
private string RemoveExtension(string str)
{
if (string.IsNullOrEmpty(str))

View File

@ -40,7 +40,7 @@ namespace YooAsset.Editor
{
if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150)))
{
string streamingAssetsRoot = AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot();
string streamingAssetsRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
EditorTools.ClearFolder(streamingAssetsRoot);
CopyPackageFiles(_manifestPath);
}
@ -59,18 +59,18 @@ namespace YooAsset.Editor
// 拷贝核心文件
{
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.bytes";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.bytes";
EditorTools.CopyFile(sourcePath, destPath, true);
}
{
string sourcePath = $"{outputDirectory}/{manifestFileName}.hash";
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.hash";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.hash";
EditorTools.CopyFile(sourcePath, destPath, true);
}
{
string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
string sourcePath = $"{outputDirectory}/{fileName}";
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{fileName}";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
@ -80,7 +80,7 @@ namespace YooAsset.Editor
{
fileCount++;
string sourcePath = $"{outputDirectory}/{packageBundle.FileName}";
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{packageBundle.FileName}";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{packageBundle.FileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}

View File

@ -5,28 +5,10 @@ using YooAsset;
public static class AssetOperationHandleExtension
{
/*
/// <summary>
/// 获取资源对象
/// </summary>
/// <typeparam name="TAsset"></typeparam>
/// <param name="asset"></param>
public static AssetOperationHandle GetAssetObject<TAsset>(this AssetOperationHandle thisHandle, out TAsset asset) where TAsset : UnityEngine.Object
{
if (thisHandle.Status != EOperationStatus.Succeed)
{
var assetInfo = thisHandle.GetAssetInfo();
Debug.LogWarning($"The {assetInfo.AssetPath}[{assetInfo.AssetType}] is not success. Error[{thisHandle.LastError}]");
}
asset = thisHandle.AssetObject as TAsset;
return thisHandle;
}
*/
/// <summary>
/// 等待异步执行完毕
/// </summary>
public static AssetOperationHandle WaitForAsyncOperationComplete(this AssetOperationHandle thisHandle)
public static AssetHandle WaitForAsyncOperationComplete(this AssetHandle thisHandle)
{
thisHandle.WaitForAsyncComplete();
return thisHandle;

View File

@ -45,7 +45,7 @@ public class GameObjectAssetReference : MonoBehaviour
[HideInInspector]
public string AssetGUID = "";
private AssetOperationHandle _handle;
private AssetHandle _handle;
public void Start()
{
@ -63,7 +63,7 @@ public class GameObjectAssetReference : MonoBehaviour
}
}
private void Handle_Completed(AssetOperationHandle handle)
private void Handle_Completed(AssetHandle handle)
{
if (handle.Status == EOperationStatus.Succeed)
{

View File

@ -16,7 +16,7 @@ public class LoadAssetsByTagOperation<TObject> : GameAsyncOperation where TObjec
private readonly string _tag;
private ESteps _steps = ESteps.None;
private List<AssetOperationHandle> _handles;
private List<AssetHandle> _handles;
/// <summary>
/// 资源对象集合
@ -40,7 +40,7 @@ public class LoadAssetsByTagOperation<TObject> : GameAsyncOperation where TObjec
if (_steps == ESteps.LoadAssets)
{
AssetInfo[] assetInfos = YooAssets.GetAssetInfos(_tag);
_handles = new List<AssetOperationHandle>(assetInfos.Length);
_handles = new List<AssetHandle>(assetInfos.Length);
foreach (var assetInfo in assetInfos)
{
var handle = YooAssets.LoadAssetAsync(assetInfo);