mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Compare commits
4 Commits
obfuz
...
TEngine6.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
eaccfdad5b | ||
![]() |
b6fbdf1d22 | ||
![]() |
5b8793de40 | ||
![]() |
9c9079c55b |
@@ -203,11 +203,20 @@
|
|||||||
{
|
{
|
||||||
if (_atlasMap.TryGetValue(atlasName, out List<string> spriteList))
|
if (_atlasMap.TryGetValue(atlasName, out List<string> spriteList))
|
||||||
{
|
{
|
||||||
return spriteList
|
var allSprites = new List<Sprite>();
|
||||||
.Where(File.Exists)
|
|
||||||
.Select(AssetDatabase.LoadAssetAtPath<Sprite>)
|
foreach (var assetPath in spriteList.Where(File.Exists))
|
||||||
.Where(s => s)
|
{
|
||||||
.ToList();
|
// 加载所有子图
|
||||||
|
var sprites = AssetDatabase.LoadAllAssetsAtPath(assetPath)
|
||||||
|
.OfType<Sprite>()
|
||||||
|
.Where(s => s != null)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
allSprites.AddRange(sprites);
|
||||||
|
}
|
||||||
|
|
||||||
|
return allSprites;
|
||||||
}
|
}
|
||||||
return new List<Sprite>();
|
return new List<Sprite>();
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,8 @@ namespace TEngine
|
|||||||
/// 初始化操作。
|
/// 初始化操作。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="customPackageName">资源包名称。</param>
|
/// <param name="customPackageName">资源包名称。</param>
|
||||||
UniTask<InitializationOperation> InitPackage(string customPackageName);
|
/// <param name="needInitMainFest">是否需要直接初始化资源清单。(单机OtherPackage使用)</param>
|
||||||
|
UniTask<InitializationOperation> InitPackage(string customPackageName, bool needInitMainFest = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认资源包名称。
|
/// 默认资源包名称。
|
||||||
|
@@ -131,7 +131,7 @@ namespace TEngine
|
|||||||
SetObjectPoolModule(objectPoolManager);
|
SetObjectPoolModule(objectPoolManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask<InitializationOperation> InitPackage(string packageName)
|
public async UniTask<InitializationOperation> InitPackage(string packageName, bool needInitMainFest = false)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
//编辑器模式使用。
|
//编辑器模式使用。
|
||||||
@@ -225,6 +225,27 @@ namespace TEngine
|
|||||||
|
|
||||||
Log.Info($"Init resource package version : {initializationOperation?.Status}");
|
Log.Info($"Init resource package version : {initializationOperation?.Status}");
|
||||||
|
|
||||||
|
if (needInitMainFest)
|
||||||
|
{
|
||||||
|
// 2. 请求资源清单的版本信息
|
||||||
|
var requestPackageVersionOperation = package.RequestPackageVersionAsync();
|
||||||
|
await requestPackageVersionOperation;
|
||||||
|
if (requestPackageVersionOperation.Status == EOperationStatus.Succeed)
|
||||||
|
{
|
||||||
|
// 3. 传入的版本信息更新资源清单
|
||||||
|
var updatePackageManifestAsync = package.UpdatePackageManifestAsync(requestPackageVersionOperation.PackageVersion);
|
||||||
|
await updatePackageManifestAsync;
|
||||||
|
if (updatePackageManifestAsync.Status == EOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
Log.Fatal($"Update package manifest failed : {updatePackageManifestAsync.Status}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Fatal($"Request package version failed : {requestPackageVersionOperation.Status}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return initializationOperation;
|
return initializationOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user