GFSaveSlotCard¶
API Reference / Save / 类索引
- 路径:
addons/gf/extensions/save/slots/gf_save_slot_card.gd - 模块:
Save - 继承:
Resource - API:
public - 类别:值对象 (
value_object) - 首次版本:
3.17.0
通用存档槽摘要数据。 作为项目 UI 和存档系统之间的轻量 DTO,不规定具体界面布局、文案或业务字段。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 属性 | slot_index |
var slot_index: int = -1 |
| 属性 | slot_id |
var slot_id: StringName = &"" |
| 属性 | display_name |
var display_name: String = "" |
| 属性 | description |
var description: String = "" |
| 属性 | is_empty |
var is_empty: bool = true |
| 属性 | is_active |
var is_active: bool = false |
| 属性 | is_compatible |
var is_compatible: bool = true |
| 属性 | modified_time |
var modified_time: int = 0 |
| 属性 | metadata |
var metadata: Dictionary = {} |
| 属性 | compatibility_errors |
var compatibility_errors: PackedStringArray = PackedStringArray() |
| 方法 | configure_from_slot_summary |
func configure_from_slot_summary( summary: Dictionary, fallback_slot_id: StringName = &"", active_slot_index: int = -1 ) -> GFSaveSlotCard: |
| 方法 | to_dict |
func to_dict() -> Dictionary: |
| 方法 | get_status_id |
func get_status_id() -> StringName: |
| 方法 | from_slot_summary |
static func from_slot_summary( summary: Dictionary, fallback_slot_id: StringName = &"", active_slot_index: int = -1 ) -> GFSaveSlotCard: |
属性¶
slot_index¶
- API:
public
整数槽位索引。文件名/云端 key 场景可保持为 -1。
slot_id¶
- API:
public
逻辑槽位标识。
display_name¶
- API:
public
项目可选展示名称。
description¶
- API:
public
项目可选展示描述。
is_empty¶
- API:
public
是否为空槽位。
is_active¶
- API:
public
是否为当前选中槽位。
is_compatible¶
- API:
public
是否兼容当前项目版本或数据结构。
modified_time¶
- API:
public
最近修改时间戳。
metadata¶
- API:
public
原始元数据副本。
结构:
metadata: Dictionary,通常来自 GFSaveSlotMetadata.to_dict() 或 GFStorageUtility.list_slots() 的 metadata 字段。
compatibility_errors¶
- API:
public
兼容性问题列表。
方法¶
configure_from_slot_summary¶
- API:
public
func configure_from_slot_summary( summary: Dictionary, fallback_slot_id: StringName = &"", active_slot_index: int = -1 ) -> GFSaveSlotCard:
从 GFStorageUtility.list_slots() 风格的摘要配置卡片。
参数:
| 名称 | 说明 |
|---|---|
summary |
槽位摘要。 |
fallback_slot_id |
摘要缺少 slot_id 时的兜底标识。 |
active_slot_index |
当前选中槽位索引。 |
返回:当前卡片。
结构:
summary: Dictionary,可包含 slot_index、slot_id、modified_time、is_compatible、compatibility_errors 与 metadata。
to_dict¶
- API:
public
转换为 Dictionary。
返回:卡片字典。
结构:
return: Dictionary,包含 slot_index、slot_id、display_name、description、is_empty、is_active、is_compatible、status_id、modified_time、metadata 与 compatibility_errors。
get_status_id¶
- API:
public
获取非本地化状态标识。 项目 UI 可基于该标识映射自己的文案、样式或图标。
返回:状态标识:empty、incompatible、active 或 ready。
from_slot_summary¶
- API:
public
static func from_slot_summary( summary: Dictionary, fallback_slot_id: StringName = &"", active_slot_index: int = -1 ) -> GFSaveSlotCard:
从摘要创建卡片。
参数:
| 名称 | 说明 |
|---|---|
summary |
槽位摘要。 |
fallback_slot_id |
兜底标识。 |
active_slot_index |
当前选中槽位索引。 |
返回:新卡片。
结构:
summary: Dictionary,可包含 slot_index、slot_id、modified_time、is_compatible、compatibility_errors 与 metadata。