mirror of https://github.com/tuyoogame/YooAsset
update yooasset2.0
parent
6687d75090
commit
6fb5a4b946
|
@ -22,11 +22,6 @@ public class PackEffectTexture : IPackRule
|
||||||
var packRuleResult = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);
|
var packRuleResult = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension);
|
||||||
return packRuleResult;
|
return packRuleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPackRule.IsRawFilePackRule()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("打包视频(自定义)")]
|
[DisplayName("打包视频(自定义)")]
|
||||||
|
@ -41,11 +36,6 @@ public class PackVideo : IPackRule
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPackRule.IsRawFilePackRule()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string RemoveExtension(string str)
|
private string RemoveExtension(string str)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(str))
|
if (string.IsNullOrEmpty(str))
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150)))
|
if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150)))
|
||||||
{
|
{
|
||||||
string streamingAssetsRoot = AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot();
|
string streamingAssetsRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
EditorTools.ClearFolder(streamingAssetsRoot);
|
EditorTools.ClearFolder(streamingAssetsRoot);
|
||||||
CopyPackageFiles(_manifestPath);
|
CopyPackageFiles(_manifestPath);
|
||||||
}
|
}
|
||||||
|
@ -59,18 +59,18 @@ namespace YooAsset.Editor
|
||||||
// 拷贝核心文件
|
// 拷贝核心文件
|
||||||
{
|
{
|
||||||
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
|
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
|
||||||
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.bytes";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.bytes";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
string sourcePath = $"{outputDirectory}/{manifestFileName}.hash";
|
string sourcePath = $"{outputDirectory}/{manifestFileName}.hash";
|
||||||
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.hash";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.hash";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
|
||||||
string sourcePath = $"{outputDirectory}/{fileName}";
|
string sourcePath = $"{outputDirectory}/{fileName}";
|
||||||
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{fileName}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{fileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
fileCount++;
|
fileCount++;
|
||||||
string sourcePath = $"{outputDirectory}/{packageBundle.FileName}";
|
string sourcePath = $"{outputDirectory}/{packageBundle.FileName}";
|
||||||
string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{packageBundle.FileName}";
|
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{packageBundle.FileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,28 +5,10 @@ using YooAsset;
|
||||||
|
|
||||||
public static class AssetOperationHandleExtension
|
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>
|
||||||
/// 等待异步执行完毕
|
/// 等待异步执行完毕
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static AssetOperationHandle WaitForAsyncOperationComplete(this AssetOperationHandle thisHandle)
|
public static AssetHandle WaitForAsyncOperationComplete(this AssetHandle thisHandle)
|
||||||
{
|
{
|
||||||
thisHandle.WaitForAsyncComplete();
|
thisHandle.WaitForAsyncComplete();
|
||||||
return thisHandle;
|
return thisHandle;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class GameObjectAssetReference : MonoBehaviour
|
||||||
[HideInInspector]
|
[HideInInspector]
|
||||||
public string AssetGUID = "";
|
public string AssetGUID = "";
|
||||||
|
|
||||||
private AssetOperationHandle _handle;
|
private AssetHandle _handle;
|
||||||
|
|
||||||
public void Start()
|
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)
|
if (handle.Status == EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class LoadAssetsByTagOperation<TObject> : GameAsyncOperation where TObjec
|
||||||
|
|
||||||
private readonly string _tag;
|
private readonly string _tag;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
private List<AssetOperationHandle> _handles;
|
private List<AssetHandle> _handles;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源对象集合
|
/// 资源对象集合
|
||||||
|
@ -40,7 +40,7 @@ public class LoadAssetsByTagOperation<TObject> : GameAsyncOperation where TObjec
|
||||||
if (_steps == ESteps.LoadAssets)
|
if (_steps == ESteps.LoadAssets)
|
||||||
{
|
{
|
||||||
AssetInfo[] assetInfos = YooAssets.GetAssetInfos(_tag);
|
AssetInfo[] assetInfos = YooAssets.GetAssetInfos(_tag);
|
||||||
_handles = new List<AssetOperationHandle>(assetInfos.Length);
|
_handles = new List<AssetHandle>(assetInfos.Length);
|
||||||
foreach (var assetInfo in assetInfos)
|
foreach (var assetInfo in assetInfos)
|
||||||
{
|
{
|
||||||
var handle = YooAssets.LoadAssetAsync(assetInfo);
|
var handle = YooAssets.LoadAssetAsync(assetInfo);
|
||||||
|
|
Loading…
Reference in New Issue