Files
XCSDD/docs/api/resources/iloader/loadasync.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- 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
2026-03-19 12:44:08 +08:00

35 lines
999 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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) - 返回类总览