Add concrete component script field support

This commit is contained in:
2026-04-03 16:51:42 +08:00
parent 73415915e6
commit e0e5c1fcaa
11 changed files with 507 additions and 4 deletions

View File

@@ -23,7 +23,8 @@ enum class ScriptFieldType {
Vector2,
Vector3,
Vector4,
GameObject
GameObject,
Component
};
struct GameObjectReference {
@@ -38,6 +39,20 @@ struct GameObjectReference {
}
};
struct ComponentReference {
uint64_t gameObjectUUID = 0;
uint64_t scriptComponentUUID = 0;
bool operator==(const ComponentReference& other) const {
return gameObjectUUID == other.gameObjectUUID
&& scriptComponentUUID == other.scriptComponentUUID;
}
bool operator!=(const ComponentReference& other) const {
return !(*this == other);
}
};
struct ScriptFieldMetadata {
std::string name;
ScriptFieldType type = ScriptFieldType::None;
@@ -99,7 +114,8 @@ using ScriptFieldValue = std::variant<
Math::Vector2,
Math::Vector3,
Math::Vector4,
GameObjectReference>;
GameObjectReference,
ComponentReference>;
struct ScriptFieldDefaultValue {
std::string fieldName;