Skip to content

Commit 979ac93

Browse files
authored
Merge pull request #59 from AIO-GAME/1.x
1.x
2 parents e544bb1 + 08ceb0d commit 979ac93

File tree

7 files changed

+70
-25
lines changed

7 files changed

+70
-25
lines changed

Editor/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using Newtonsoft.Json.Linq;
2-
using UnityEditor;
3-
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
1+
using AIO.UEditor;
2+
using Newtonsoft.Json.Linq;
3+
using UnityEditor.PackageManager;
44

55
namespace AIO
66
{
@@ -16,7 +16,7 @@ internal static class Setting
1616
/// </summary>
1717
public static string Version { get; private set; }
1818

19-
[InitializeOnLoadMethod]
19+
[AInit(mode: EInitAttrMode.Both, int.MaxValue)]
2020
public static void Initialize()
2121
{
2222
var package = PackageInfo.FindForAssembly(typeof(Setting).Assembly);

Editor/Windows/AssetCollectWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public partial class AssetCollectWindow : GraphicWindow
2424
{
2525
[LnkTools(
2626
Tooltip = "AIO 资源管理工具",
27-
IconResource = "Editor/Icon/Asset"
27+
IconResource = "Editor/Icon/Asset",
28+
ShowMode = ELnkShowMode.Toolbar
2829
)]
2930
public static void OpenWindow()
3031
{

Editor/Windows/Mode/AssetCollectWindow.OnDrawFirstPackageMode.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,16 @@ private void OnDrawHeaderFirstPackageMode()
126126
{
127127
GUI.FocusControl(null);
128128
Config.SequenceRecord.Save();
129-
EditorUtility.DisplayDialog("保存", "保存成功", "确定");
129+
Config.Save();
130+
#if UNITY_2021_1_OR_NEWER
131+
AssetDatabase.SaveAssetIfDirty(Config);
132+
#else
133+
AssetDatabase.SaveAssets();
134+
#endif
135+
if (EditorUtility.DisplayDialog("保存", "保存成功", "确定"))
136+
{
137+
AssetDatabase.Refresh();
138+
}
130139
}
131140
}
132141

Extensions/YooAsset.CLI/Editor/1.5.7/AssetProxyEditor.Yoo.157.UploadGCloud.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public static async Task UploadGCloudAsync(ASUploadGCloudConfig config)
174174
Version = config.IsUploadLatest ? "Latest" : config.Version
175175
});
176176
}
177-
else data2.Version = config.Version;
178-
177+
else data2.Version = config.IsUploadLatest ? "Latest" : config.Version;
179178
versionContent = AHelper.Json.Serialize(data);
180179
}
181180
else

Extensions/YooAsset.CLI/Runtime/1.5.7/Proxy.YooAsset/Extensions/Function/Helper.cs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ private static void PackageDebug(LoadType type, string location)
5151
private static void PackageDebug(LoadType type, string packageName, string location)
5252
{
5353
#if UNITY_EDITOR
54-
AssetSystem.Log($"Load {type.ToString()} : [{packageName} : {location}] -> {GetAssetInfo(location)?.AssetPath}");
54+
AssetSystem.Log(
55+
$"Load {type.ToString()} : [{packageName} : {location}] -> {GetAssetInfo(location)?.AssetPath}");
5556
#else
5657
AssetSystem.Log("{0} : [{1} : {2}]", type.ToString(), packageName, location);
5758
#endif
@@ -97,7 +98,11 @@ private static Task<YAssetPackage> GetAutoPackageTask(string packageName, AssetI
9798

9899
private static IEnumerator GetAutoPackageCO(string location, Action<YAssetPackage> cb)
99100
{
101+
#if !UNITY_2019_4_OR_NEWER
100102
if (location.EndsWith('/') || location.EndsWith('\\'))
103+
#else
104+
if (location.EndsWith("/") || location.EndsWith("\\"))
105+
#endif
101106
{
102107
cb.Invoke(null);
103108
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
@@ -146,7 +151,11 @@ private static IEnumerator GetAutoPackageCO(string location, Action<YAssetPackag
146151

147152
private static IEnumerator GetAutoPackageCO(string packageName, string location, Action<YAssetPackage> cb)
148153
{
154+
#if !UNITY_2019_4_OR_NEWER
149155
if (location.EndsWith('/') || location.EndsWith('\\'))
156+
#else
157+
if (location.EndsWith("/") || location.EndsWith("\\"))
158+
#endif
150159
{
151160
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
152161
cb.Invoke(null);
@@ -193,7 +202,8 @@ private static IEnumerator GetAutoPackageCO(string packageName, string location,
193202
if (package.CheckLocationValid(location)) cb.Invoke(package);
194203
else
195204
{
196-
AssetSystem.LogException($"[{package.PackageName} : {package.GetPackageVersion()}] 传入地址验证无效 {location}");
205+
AssetSystem.LogException(
206+
$"[{package.PackageName} : {package.GetPackageVersion()}] 传入地址验证无效 {location}");
197207
cb.Invoke(null);
198208
}
199209
}
@@ -202,7 +212,11 @@ private static IEnumerator GetAutoPackageCO(string packageName, string location,
202212

203213
private static YAssetPackage GetAutoPackageSync(string location)
204214
{
215+
#if !UNITY_2019_4_OR_NEWER
205216
if (location.EndsWith('/') || location.EndsWith('\\'))
217+
#else
218+
if (location.EndsWith("/") || location.EndsWith("\\"))
219+
#endif
206220
{
207221
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
208222
return null;
@@ -228,7 +242,11 @@ private static YAssetPackage GetAutoPackageSync(string location)
228242

229243
private static YAssetPackage GetAutoPackageSync(string packageName, string location)
230244
{
245+
#if !UNITY_2019_4_OR_NEWER
231246
if (location.EndsWith('/') || location.EndsWith('\\'))
247+
#else
248+
if (location.EndsWith("/") || location.EndsWith("\\"))
249+
#endif
232250
{
233251
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
234252
return null;
@@ -250,7 +268,8 @@ private static YAssetPackage GetAutoPackageSync(string packageName, string locat
250268

251269
if (!package.CheckLocationValid(location))
252270
{
253-
AssetSystem.LogException($"[{package.PackageName} : {package.GetPackageVersion()}] 传入地址验证无效 {location}");
271+
AssetSystem.LogException(
272+
$"[{package.PackageName} : {package.GetPackageVersion()}] 传入地址验证无效 {location}");
254273
return null;
255274
}
256275

@@ -259,7 +278,11 @@ private static YAssetPackage GetAutoPackageSync(string packageName, string locat
259278

260279
private static async Task<YAssetPackage> GetAutoPackageTask(string location)
261280
{
281+
#if !UNITY_2019_4_OR_NEWER
262282
if (location.EndsWith('/') || location.EndsWith('\\'))
283+
#else
284+
if (location.EndsWith("/") || location.EndsWith("\\"))
285+
#endif
263286
{
264287
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
265288
return null;
@@ -282,7 +305,8 @@ private static async Task<YAssetPackage> GetAutoPackageTask(string location)
282305
return package;
283306
}
284307

285-
AssetSystem.LogException($"资源获取失败 [{package.PackageName} : {package.GetPackageVersion()}] {location} -> {operation.Error}");
308+
AssetSystem.LogException(
309+
$"资源获取失败 [{package.PackageName} : {package.GetPackageVersion()}] {location} -> {operation.Error}");
286310
return null;
287311
}
288312

@@ -292,7 +316,11 @@ private static async Task<YAssetPackage> GetAutoPackageTask(string location)
292316

293317
private static async Task<YAssetPackage> GetAutoPackageTask(string packageName, string location)
294318
{
319+
#if !UNITY_2019_4_OR_NEWER
295320
if (location.EndsWith('/') || location.EndsWith('\\'))
321+
#else
322+
if (location.EndsWith("/") || location.EndsWith("\\"))
323+
#endif
296324
{
297325
AssetSystem.LogException($"资源查找失败 [auto : {location}]");
298326
return null;
@@ -324,7 +352,8 @@ private static async Task<YAssetPackage> GetAutoPackageTask(string packageName,
324352
return package;
325353
}
326354

327-
AssetSystem.LogException($"资源获取失败 [{package.PackageName} : {package.GetPackageVersion()}] {location} -> {operation.Error}");
355+
AssetSystem.LogException(
356+
$"资源获取失败 [{package.PackageName} : {package.GetPackageVersion()}] {location} -> {operation.Error}");
328357
return null;
329358
}
330359

Extensions/YooAsset.CLI/Runtime/1.5.7/Proxy.YooAsset/YAssetProxy.Downloader.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections;
1010
using System.Collections.Generic;
11+
using System.IO;
1112
using System.Linq;
1213
using System.Threading.Tasks;
1314
using AIO.UEngine.YooAsset;
@@ -175,7 +176,10 @@ public IEnumerator UpdateHeader()
175176
}
176177

177178
State = EProgressState.Fail;
178-
Event.OnError?.Invoke(new SystemException($"校验本地资源完整性失败 -> [{pair.Key} -> {pair.Value.Error}]"));
179+
AssetSystem.LogException("校验本地资源完整性失败");
180+
var ex = new SystemException($"[{pair.Key} -> {pair.Value.Error}]");
181+
if (Event.OnError is null) throw ex;
182+
Event.OnError.Invoke(ex);
179183
yield break;
180184
}
181185
}
@@ -279,15 +283,18 @@ protected override async Task OnWaitAsync()
279283

280284
TotalValue = TotalValueDict.Sum(pair => pair.Value);
281285
CurrentValue = CurrentValueDict.Sum(pair => pair.Value);
282-
if (AssetSystem.GetAvailableDiskSpace() < TotalValue - CurrentValue) // 检查磁盘空间是否足够
286+
var endValue = TotalValue - CurrentValue;
287+
if (AssetSystem.GetAvailableDiskSpace() < endValue) // 检查磁盘空间是否足够
283288
{
284289
State = EProgressState.Fail;
290+
285291
if (OnDiskSpaceNotEnough is null)
286-
throw new Exception(
287-
$"磁盘空间 {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
292+
throw new IOException(
293+
$"Out of disk space : {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {endValue.ToConverseStringFileSize()}");
294+
288295
OnDiskSpaceNotEnough.Invoke(Report);
289296
AssetSystem.LogException(
290-
$"磁盘空间 {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
297+
$"Out of disk space : {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {endValue.ToConverseStringFileSize()}");
291298
return;
292299
}
293300

@@ -374,16 +381,16 @@ protected override IEnumerator OnWaitCo()
374381
State = EProgressState.Fail;
375382
if (OnDiskSpaceNotEnough is null)
376383
throw new SystemException(
377-
$"磁盘空间 {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
384+
$"Out of disk space : {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
378385
AssetSystem.LogException(
379-
$"磁盘空间 {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
386+
$"Out of disk space : {AssetSystem.GetAvailableDiskSpace().ToConverseStringFileSize()} < {TotalValue.ToConverseStringFileSize()}");
380387
OnDiskSpaceNotEnough.Invoke(Report);
381388
yield break;
382389
}
383390

384391
foreach (var pair in ResourceDownloaderOperations)
385392
{
386-
CurrentInfo = $"Resource Download -> [{pair.Key}]";
393+
CurrentInfo = $"Resource download : [{pair.Key}]";
387394
while (State != EProgressState.Running)
388395
{
389396
switch (State)
@@ -448,10 +455,10 @@ void OnUpdateProgress(int _, int __, long totalDownloadBytes, long currentDownlo
448455

449456
private void OnDownloadError(string filename, string error)
450457
{
451-
AssetSystem.LogError($"下载资源失败 -> [{filename} -> {error}]");
452458
var ex = new SystemException($"{filename} : {error}");
453459
if (Event.OnError is null) throw ex;
454460
Event.OnError.Invoke(ex);
461+
AssetSystem.LogError($"Resource download failure : [{filename} -> {error}]");
455462
}
456463

457464
protected override void OnPause()

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.aio.cli.asset",
33
"displayName": "AIO Unity CLI Asset",
44
"description": "AIO Unity CLI Asset",
5-
"version": "1.0.31-preview",
5+
"version": "1.0.33-preview",
66
"unity": "2019.4",
77
"unityRelease": "0f1",
88
"license": "MIT",
@@ -14,10 +14,10 @@
1414
"url": "https://github.com/AIO-GAME/Unity.Asset.CLI.git"
1515
},
1616
"dependencies": {
17-
"com.aio.package": "1.0.32-preview"
17+
"com.aio.package": "1.0.33-preview"
1818
},
1919
"relatedPackages": {
20-
"com.aio.package": "1.0.32-preview"
20+
"com.aio.package": "1.0.33-preview"
2121
},
2222
"keywords": ["Asset", "YooAsset", "Unity Asset", "Resource"],
2323
"author": {

0 commit comments

Comments
 (0)