update file system

重构运行时核心代码
This commit is contained in:
何冠峰
2024-12-24 18:23:19 +08:00
parent 6d6fd3af2c
commit 6254d00bb5
67 changed files with 1811 additions and 204 deletions
@@ -81,12 +81,19 @@ namespace YooAsset
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{
var operation = new DEFSLoadBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
public virtual void UnloadBundleFile(PackageBundle bundle, object result)
{
if (bundle.BundleType == (int)EBuildBundleType.VirtualBundle)
{
var operation = new DEFSLoadBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else
{
string error = $"{nameof(DefaultEditorFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
}
public virtual void SetParameter(string name, object value)
@@ -139,13 +146,29 @@ namespace YooAsset
return false;
}
public virtual byte[] ReadFileData(PackageBundle bundle)
public virtual string GetBundleFilePath(PackageBundle bundle)
{
throw new System.NotImplementedException();
if (bundle.IncludeMainAssets.Count == 0)
return string.Empty;
var pacakgeAsset = bundle.IncludeMainAssets[0];
return pacakgeAsset.AssetPath;
}
public virtual string ReadFileText(PackageBundle bundle)
public virtual byte[] ReadBundleFileData(PackageBundle bundle)
{
throw new System.NotImplementedException();
if (bundle.IncludeMainAssets.Count == 0)
return null;
var pacakgeAsset = bundle.IncludeMainAssets[0];
return FileUtility.ReadAllBytes(pacakgeAsset.AssetPath);
}
public virtual string ReadBundleFileText(PackageBundle bundle)
{
if (bundle.IncludeMainAssets.Count == 0)
return null;
var pacakgeAsset = bundle.IncludeMainAssets[0];
return FileUtility.ReadAllText(pacakgeAsset.AssetPath);
}
#region 内部方法
@@ -57,7 +57,7 @@ namespace YooAsset
if (_steps == ESteps.CheckResult)
{
_steps = ESteps.Done;
Result = new VirtualBundle(_fileSystem, _bundle);
Result = new VirtualBundleResult(_fileSystem, _bundle);
Status = EOperationStatus.Succeed;
}
}