Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using XWorld.Framework;
|
||||
|
||||
namespace XGame.MiniGame
|
||||
{
|
||||
// IAssetLoader over XResLoader(异步按需从 CDN 下载/加载小游戏 AB 资源)
|
||||
public sealed class UnityAssetLoader : IAssetLoader
|
||||
{
|
||||
// path: 形如 "Assets/Game/Art/UI/Prefab/UI_RPS.prefab";XResLoader 内部剥 "Assets/" 前缀并按目录解析 AB。
|
||||
// 用回调版 LoadRes(内部自驱动协程),可在非协程上下文 fire-and-forget;失败回调 null。
|
||||
public void Load(string path, Action<object> onLoaded)
|
||||
{
|
||||
XResLoader.LoadRes(path, typeof(UnityEngine.Object),
|
||||
objs => onLoaded?.Invoke(objs != null && objs.Length > 0 ? objs[0] : null));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user