- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
35 lines
999 B
Markdown
35 lines
999 B
Markdown
# IResourceLoader::LoadAsync
|
||
|
||
```cpp
|
||
void LoadAsync(const Containers::String& path, const ImportSettings* settings,
|
||
std::function<void(LoadResult)> callback)
|
||
```
|
||
|
||
异步加载资源。默认实现直接调用同步 `Load` 方法并在当前线程执行回调。子类可重写以实现真正的多线程异步加载。
|
||
|
||
**参数:**
|
||
- `path` - 资源路径
|
||
- `settings` - 导入设置(可为 nullptr)
|
||
- `callback` - 加载完成回调函数
|
||
|
||
**返回:** 无
|
||
|
||
**复杂度:** O(n)
|
||
|
||
**示例:**
|
||
|
||
```cpp
|
||
void AsyncTextureLoader::LoadAsync(const Containers::String& path,
|
||
const ImportSettings* settings,
|
||
std::function<void(LoadResult)> callback) {
|
||
std::thread([this, path, settings, callback]() {
|
||
LoadResult result = Load(path, settings);
|
||
callback(result); // 回调可在工作线程执行
|
||
}).detach();
|
||
}
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [IResourceLoader 总览](iloader.md) - 返回类总览
|