Skip to content

Commit

Permalink
Merge pull request #89 from AIO-GAME/1.x
Browse files Browse the repository at this point in the history
1.x
  • Loading branch information
xinansky authored Jun 24, 2024
2 parents a06925a + af19c88 commit ebb4a78
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/upversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def read_current_version() -> str:
# 上传到远程仓库 捕获异常
if current_version != new_version:
try:
subprocess.run(['git', 'pull'], check=True)
subprocess.run(['git', 'pull', 'origin', current_branch], check=True)
subprocess.run(['git', 'add', 'package.json'], check=True)
subprocess.run(['git', 'commit', '-m', f"✨ up version {current_branch} -> {new_version}"], check=True)
subprocess.run(['git', 'push', 'origin', current_branch], check=True)
Expand Down
2 changes: 1 addition & 1 deletion Extensions/YooAsset.CLI/Runtime/1.5.7/Handle/Load.Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected override TaskAwaiter<TObject> CreateAsync()
}

/// <inheritdoc />
public override ILoaderHandle<TObject> LoadAssetTask<TObject>(string location, Type type, Action<TObject> completed = null) =>
public override ILoaderHandle<TObject> LoadAssetAsync<TObject>(string location, Type type, Action<TObject> completed = null) =>
new LoadAsset<TObject>(location, type, completed);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected override TaskAwaiter<GameObject> CreateAsync()
}

/// <inheritdoc />
public override ILoaderHandle<GameObject> InstGameObjectTask(string location, Action<GameObject> completed = null, Transform parent = null)
public override ILoaderHandle<GameObject> InstGameObjectAsync(string location, Action<GameObject> completed = null, Transform parent = null)
{
return new InstGameObject(location, completed, parent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected override TaskAwaiter<byte[]> CreateAsync()
}

/// <inheritdoc />
public override ILoaderHandle<byte[]> LoadRawFileDataTask(string location, Action<byte[]> cb = null)
public override ILoaderHandle<byte[]> LoadRawFileDataAsync(string location, Action<byte[]> cb = null)
=> new LoadRawFileData(location, cb);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected override TaskAwaiter<string> CreateAsync()
}

/// <inheritdoc />
public override ILoaderHandle<string> LoadRawFileTextTask(string location, Action<string> cb = null)
public override ILoaderHandle<string> LoadRawFileTextAsync(string location, Action<string> cb = null)
=> new LoadRawFileText(location, cb);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AIO.UEngine.YooAsset
partial class Proxy
{
/// <inheritdoc />
public override ILoaderHandle<TObject[]> LoadSubAssetsTask<TObject>(string location, Type type, Action<TObject[]> completed = null)
public override ILoaderHandle<TObject[]> LoadSubAssetsAsync<TObject>(string location, Type type, Action<TObject[]> completed = null)
{
return new LoadSubAsset<TObject>(location, type, completed);
}
Expand Down
88 changes: 44 additions & 44 deletions Runtime/Basics/AssetSystem.Load.Generated.cs

Large diffs are not rendered by default.

101 changes: 50 additions & 51 deletions Runtime/Basics/AssetSystem.Load.cs

Large diffs are not rendered by default.

64 changes: 12 additions & 52 deletions Runtime/Config/ASConfig.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#if UNITY_EDITOR
#region

using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

#endregion

namespace AIO.UEngine
{
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using UnityEngine;

[Description("资源系统配置"), Serializable]
[HelpURL("https://github.com/AIO-GAME/Unity.Asset.CLI/blob/main/.github/API_USAGE/Config.md#-aiouengineasconfig---%E8%B5%84%E6%BA%90%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE-")]
public class ASConfig : ScriptableObject
public class ASConfig : ScriptableObject<ASConfig>
{
/// <summary>
/// 资源加载模式
Expand Down Expand Up @@ -155,49 +158,6 @@ public AssetSystem.SequenceRecordQueue SequenceRecord

#region static

#if UNITY_EDITOR
private static ASConfig instance;
#endif

private static ASConfig GetResource() { return Resources.LoadAll<ASConfig>(nameof(ASConfig)).FirstOrDefault(item => item); }

/// <summary>
/// 获取本地资源包地址
/// </summary>
public static ASConfig GetOrCreate()
{
#if UNITY_EDITOR
if (!instance)
{
foreach (var item in AssetDatabase
.FindAssets("t:ASConfig", new[] { "Assets", })
.Select(AssetDatabase.GUIDToAssetPath)
.Select(AssetDatabase.LoadAssetAtPath<ASConfig>)
.Where(item => item))
{
instance = item;
break;
}

if (!instance)
{
instance = CreateInstance<ASConfig>();
instance.ASMode = EASMode.Editor;
instance.Packages = Array.Empty<AssetsPackageConfig>();
var resourcesDir = Path.Combine(Application.dataPath, "Resources");
if (!Directory.Exists(resourcesDir)) Directory.CreateDirectory(resourcesDir);
AssetDatabase.CreateAsset(instance, "Assets/Resources/ASConfig.asset");
AssetDatabase.SaveAssets();
}
}

if (!instance) throw new Exception("Not found ASConfig.asset ! Please create it !");
return instance;
#else
return GetResource();
#endif
}

/// <summary>
/// 获取本地资源包配置
/// </summary>
Expand Down Expand Up @@ -268,4 +228,4 @@ public void Save()

#endregion
}
}
}
12 changes: 6 additions & 6 deletions Runtime/Proxy/ASProxy.Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ partial class ASProxy
/// </summary>
/// <param name="location">资源的定位地址</param>
/// <param name="cb">回调</param>
public abstract ILoaderHandle<byte[]> LoadRawFileDataTask(string location, Action<byte[]> cb = null);
public abstract ILoaderHandle<byte[]> LoadRawFileDataAsync(string location, Action<byte[]> cb = null);

/// <summary>
/// 异步加载原生文件
/// </summary>
/// <param name="location">资源的定位地址</param>
/// <param name="cb">回调</param>
public abstract ILoaderHandle<string> LoadRawFileTextTask(string location, Action<string> cb = null);
public abstract ILoaderHandle<string> LoadRawFileTextAsync(string location, Action<string> cb = null);

/// <summary>
/// 加载子资源对象
/// </summary>
/// <param name="location">资源的定位地址</param>
/// <param name="type">子对象类型</param>
/// <param name="completed">回调</param>
public abstract ILoaderHandle<TObject[]> LoadSubAssetsTask<TObject>(string location, Type type, Action<TObject[]> completed = null)
public abstract ILoaderHandle<TObject[]> LoadSubAssetsAsync<TObject>(string location, Type type, Action<TObject[]> completed = null)
where TObject : Object;

/// <summary>
Expand All @@ -56,7 +56,7 @@ public abstract ILoaderHandle<Scene> LoadSceneTask(
/// <param name="location">资源的定位地址</param>
/// <param name="completed">回调</param>
/// <param name="type">资源类型</param>
public abstract ILoaderHandle<TObject> LoadAssetTask<TObject>(string location, Type type, Action<TObject> completed = null)
public abstract ILoaderHandle<TObject> LoadAssetAsync<TObject>(string location, Type type, Action<TObject> completed = null)
where TObject : Object;

/// <summary>
Expand All @@ -65,6 +65,6 @@ public abstract ILoaderHandle<TObject> LoadAssetTask<TObject>(string location, T
/// <param name="location">资源的定位地址</param>
/// <param name="completed">回调</param>
/// <param name="parent">父位置</param>
public abstract ILoaderHandle<GameObject> InstGameObjectTask(string location, Action<GameObject> completed = null, Transform parent = null);
public abstract ILoaderHandle<GameObject> InstGameObjectAsync(string location, Action<GameObject> completed = null, Transform parent = null);
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.aio.cli.asset",
"displayName": "AIO Unity CLI Asset",
"description": "unity3d resources management system.",
"version": "1.1.13-preview",
"version": "1.1.14-preview",
"unity": "2019.4",
"category": "Runtime",
"unityRelease": "0f1",
Expand All @@ -16,7 +16,7 @@
},
"relatedPackages": {
"com.aio.package": "1.0.47-preview",
"com.aio.runner": "1.0.0-preview"
"com.aio.runner": "1.0.1-preview"
},
"keywords": [
"Asset",
Expand Down

0 comments on commit ebb4a78

Please sign in to comment.