docs: update resources API docs
This commit is contained in:
56
docs/api/resources/resource-file-system/remove-archive.md
Normal file
56
docs/api/resources/resource-file-system/remove-archive.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# ResourceFileSystem::RemoveArchive
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
void RemoveArchive(const Containers::String& archivePath);
|
||||
```
|
||||
|
||||
## 所属类
|
||||
|
||||
`XCEngine::Resources::ResourceFileSystem`
|
||||
|
||||
## 描述
|
||||
|
||||
移除已注册的档案压缩包。移除后,该档案内的资源将无法通过此资源系统访问。
|
||||
|
||||
此方法线程安全。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数名 | 类型 | 描述 |
|
||||
|--------|------|------|
|
||||
| `archivePath` | `const Containers::String&` | 要移除的档案路径 |
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
#include "Resources/ResourceFileSystem.h"
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
|
||||
ResourceFileSystem& fs = ResourceFileSystem::Get();
|
||||
fs.Initialize("C:/Game/Resources");
|
||||
|
||||
fs.AddArchive("C:/Game/Paks/Common.pak");
|
||||
fs.AddArchive("C:/Game/Paks/DLC.pak");
|
||||
|
||||
// 检查资源是否存在
|
||||
if (fs.Exists("dlc/special_texture.png")) {
|
||||
// 使用 DLC 资源
|
||||
}
|
||||
|
||||
// 移除 DLC 包
|
||||
fs.RemoveArchive("C:/Game/Paks/DLC.pak");
|
||||
|
||||
// 现在 DLC 资源无法访问
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 如果档案不存在,则此方法不做任何操作
|
||||
- 当前实现从目录列表中移除匹配路径(档案与目录共用存储)
|
||||
Reference in New Issue
Block a user