mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-07-01 19:33:47 +00:00
update file system
重构运行时核心代码
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal abstract class FSLoadAllAssetsOperation : AsyncOperationBase
|
||||
{
|
||||
public UnityEngine.Object[] Result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45cfe41807608d24dbe5506c8d7b4a9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal abstract class FSLoadAssetOperation : AsyncOperationBase
|
||||
{
|
||||
public UnityEngine.Object Result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51851bd94e8307d4881ceecc84ee71e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 加载结果
|
||||
/// </summary>
|
||||
public object Result { protected set; get; }
|
||||
public BundleResult Result { protected set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 下载进度
|
||||
@@ -24,4 +24,25 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public abstract void AbortDownloadOperation();
|
||||
}
|
||||
|
||||
internal sealed class FSLoadBundleCompleteOperation : FSLoadBundleOperation
|
||||
{
|
||||
private readonly string _error;
|
||||
|
||||
internal FSLoadBundleCompleteOperation(string error)
|
||||
{
|
||||
_error = error;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _error;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal abstract class FSLoadSceneOperation : AsyncOperationBase
|
||||
{
|
||||
public UnityEngine.SceneManagement.Scene Result;
|
||||
|
||||
public abstract void UnSuspendLoad();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ad384dede61ad6478cc376d4af598a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal abstract class FSLoadSubAssetsOperation : AsyncOperationBase
|
||||
{
|
||||
public UnityEngine.Object[] Result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b44c0a8ba7b4bcd4a9271675db5a5a83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -126,19 +126,5 @@ namespace YooAsset
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否请求的本地文件
|
||||
/// </summary>
|
||||
protected bool IsRequestLocalFile()
|
||||
{
|
||||
//TODO : UNITY_STANDALONE_OSX平台目前无法确定
|
||||
if (Param.MainURL.StartsWith("file:"))
|
||||
return true;
|
||||
if (Param.MainURL.StartsWith("jar:file:"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,9 +55,19 @@ namespace YooAsset
|
||||
// 检查网络错误
|
||||
if (CheckRequestResult())
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = _downloadhandler.assetBundle;
|
||||
Status = EOperationStatus.Succeed;
|
||||
var assetBundle = _downloadhandler.assetBundle;
|
||||
if (assetBundle == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Error = "Download handler asset bundle object is null !";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Result = assetBundle;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user