refactor(docs): add GameObject UUID methods and Component serialization methods

This commit is contained in:
2026-03-26 01:55:34 +08:00
parent 1326860e5d
commit 5047d56080
7 changed files with 86 additions and 3 deletions

View File

@@ -35,6 +35,8 @@ Component 是 XCEngine ECS 架构中的组件基类,所有具体组件(如 T
| `virtual void OnEnable()` | 启用时调用 |
| `virtual void OnDisable()` | 禁用时调用 |
| `virtual void OnDestroy()` | 销毁时调用 |
| `virtual void Serialize(std::ostream& os) const` | 序列化组件数据 |
| `virtual void Deserialize(std::istream& is)` | 反序列化组件数据 |
## 使用示例

View File

@@ -0,0 +1,15 @@
# GameObject::DetachFromParent
从父对象分离。
```cpp
void DetachFromParent();
```
将当前 GameObject 从其父对象分离。分离后,该对象将成为根对象,但其子对象会保持为它的子对象。
## 相关文档
- [GameObject 总览](game-object.md)
- [SetParent](set-parent.md)
- [DetachChildren](detach-children.md)

View File

@@ -0,0 +1,18 @@
# GameObject::FindGameObjectsWithTag
查找具有指定标签的所有游戏对象。
```cpp
static std::vector<GameObject*> FindGameObjectsWithTag(const std::string& tag);
```
**参数:**
- `tag` - 要查找的标签
**返回:** `std::vector<GameObject*>` - 具有指定标签的所有游戏对象列表
## 相关文档
- [GameObject 总览](game-object.md)
- [Find](find.md)
- [FindObjectsOfType](find-objects-of-type.md)

View File

@@ -0,0 +1,15 @@
# GameObject::FindObjectsOfType
查找所有游戏对象。
```cpp
static std::vector<GameObject*> FindObjectsOfType();
```
**返回:** `std::vector<GameObject*>` - 场景中所有 GameObject 的列表
## 相关文档
- [GameObject 总览](game-object.md)
- [Find](find.md)
- [FindGameObjectsWithTag](find-game-objects-with-tag.md)

View File

@@ -0,0 +1,18 @@
# GameObject::Find
查找指定名称的游戏对象。
```cpp
static GameObject* Find(const std::string& name);
```
**参数:**
- `name` - 要查找的游戏对象名称
**返回:** `GameObject*` - 找到的游戏对象指针,如果未找到则返回 nullptr
## 相关文档
- [GameObject 总览](game-object.md)
- [FindObjectsOfType](find-objects-of-type.md)
- [FindGameObjectsWithTag](find-game-objects-with-tag.md)

View File

@@ -26,6 +26,7 @@ GameObject 是 XCEngine ECS 架构中的实体Entity代表游戏世
| 方法 | 描述 |
|------|------|
| [`GetID`](get-id.md) | 获取唯一标识符 |
| [`GetUUID`](get-uuid.md) | 获取全局唯一标识符 |
| [`GetName`](get-name.md) | 获取名称 |
| [`SetName`](set-name.md) | 设置名称 |
| [`GetScene`](get-scene.md) | 获取所属场景 |
@@ -46,6 +47,7 @@ GameObject 是 XCEngine ECS 架构中的实体Entity代表游戏世
| 方法 | 描述 |
|------|------|
| [`DetachFromParent`](detach-from-parent.md) | 从父对象分离 |
| [`GetParent`](get-parent.md) | 获取父对象 |
| [`SetParent`](set-parent.md) | 设置父对象 |
| [`GetChildCount`](get-child-count.md) | 获取子对象数量 |
@@ -65,9 +67,9 @@ GameObject 是 XCEngine ECS 架构中的实体Entity代表游戏世
| 方法 | 描述 |
|------|------|
| `static Find(name)` | 查找指定名称的对象 |
| `static FindObjectsOfType()` | 查找所有对象 |
| `static FindGameObjectsWithTag(tag)` | 查找具有指定标签的对象 |
| [`Find`](find.md) | 查找指定名称的对象 |
| [`FindObjectsOfType`](find-objects-of-type.md) | 查找所有对象 |
| [`FindGameObjectsWithTag`](find-game-objects-with-tag.md) | 查找具有指定标签的对象 |
### 生命周期

View File

@@ -0,0 +1,13 @@
# GameObject::GetUUID
获取游戏对象的全局唯一标识符。
```cpp
uint64_t GetUUID() const;
```
**返回:** `uint64_t` - 游戏对象的全局唯一标识符
## 相关文档
- [GameObject 总览](game-object.md)