跳转至

GFStorageAsyncOperation

API Reference / Standard / 类索引

  • 路径:addons/gf/standard/utilities/storage/gf_storage_async_operation.gd
  • 模块:Standard
  • 继承:RefCounted
  • API:public
  • 类别:运行时句柄 (runtime_handle)
  • 首次版本:unreleased

单次异步存储请求句柄。 句柄由 GFStorageUtility 分配唯一请求 ID,并且只接受一个终态。调用方应先 检查 is_completed(),再决定是否等待 completed 信号。

成员概览

类型 名称 签名
信号 completed signal completed(result: GFStorageAsyncResult)
常量 OPERATION_SAVE const OPERATION_SAVE: StringName = &"save"
常量 OPERATION_LOAD const OPERATION_LOAD: StringName = &"load"
方法 get_request_id func get_request_id() -> int:
方法 get_operation func get_operation() -> StringName:
方法 get_file_name func get_file_name() -> String:
方法 is_pending func is_pending() -> bool:
方法 is_completed func is_completed() -> bool:
方法 get_result func get_result() -> GFStorageAsyncResult:

信号

completed

  • API:public
  • 首次版本:unreleased
signal completed(result: GFStorageAsyncResult)

请求进入终态时发出一次。

参数:

名称 说明
result 与当前请求 ID 匹配的隔离结果。

常量

OPERATION_SAVE

  • API:public
  • 首次版本:unreleased
const OPERATION_SAVE: StringName = &"save"

异步写入请求。

OPERATION_LOAD

  • API:public
  • 首次版本:unreleased
const OPERATION_LOAD: StringName = &"load"

异步读取请求。

方法

get_request_id

  • API:public
  • 首次版本:unreleased
func get_request_id() -> int:

获取 Utility 内唯一请求 ID。

返回:大于零的请求 ID。

get_operation

  • API:public
  • 首次版本:unreleased
func get_operation() -> StringName:

获取请求类型。

返回:OPERATION_SAVEOPERATION_LOAD

get_file_name

  • API:public
  • 首次版本:unreleased
func get_file_name() -> String:

获取规范化存储文件名。

返回:请求实际使用的文件名。

is_pending

  • API:public
  • 首次版本:unreleased
func is_pending() -> bool:

检查请求是否等待终态。

返回:已配置且未完成时返回 true。

is_completed

  • API:public
  • 首次版本:unreleased
func is_completed() -> bool:

检查请求是否已有终态。

返回:已完成时返回 true。

get_result

  • API:public
  • 首次版本:unreleased
func get_result() -> GFStorageAsyncResult:

获取终态结果副本。

返回:已完成结果;等待中返回 null。