feat: 两级存档系统——无限组/槽,建组建槽/自动档/两级浏览/读档还原/删除组与槽/游戏内加载(D8 完成)
This commit is contained in:
@@ -60,6 +60,48 @@ func get_join_date_text() -> String:
|
||||
return ""
|
||||
return "%d年%d月%d日" % [join_year, join_month, join_day]
|
||||
|
||||
## 序列化为字典(D8 存档用,枚举转 int)。
|
||||
func to_dict() -> Dictionary:
|
||||
var roots_data: Array[int] = []
|
||||
for r in roots:
|
||||
roots_data.append(int(r))
|
||||
return {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"age": age,
|
||||
"aptitude": int(aptitude),
|
||||
"roots": roots_data,
|
||||
"is_heavenly": is_heavenly,
|
||||
"join_year": join_year,
|
||||
"join_month": join_month,
|
||||
"join_day": join_day,
|
||||
"realm_index": realm_index,
|
||||
"sub_realm_index": sub_realm_index,
|
||||
"cultivation_exp": cultivation_exp,
|
||||
"hunger_days": hunger_days,
|
||||
}
|
||||
|
||||
## 从字典还原(D8 读档用)。
|
||||
## @param data: to_dict 产生的字典
|
||||
static func from_dict(data: Dictionary) -> Disciple:
|
||||
var d := Disciple.new()
|
||||
d.id = int(data["id"])
|
||||
d.name = str(data["name"])
|
||||
d.age = int(data["age"])
|
||||
d.aptitude = int(data["aptitude"]) as Aptitude
|
||||
d.roots = []
|
||||
for r in data["roots"]:
|
||||
d.roots.append(int(r) as SpiritRoot)
|
||||
d.is_heavenly = bool(data["is_heavenly"])
|
||||
d.join_year = int(data["join_year"])
|
||||
d.join_month = int(data["join_month"])
|
||||
d.join_day = int(data["join_day"])
|
||||
d.realm_index = int(data["realm_index"])
|
||||
d.sub_realm_index = int(data["sub_realm_index"])
|
||||
d.cultivation_exp = float(data["cultivation_exp"])
|
||||
d.hunger_days = int(data["hunger_days"])
|
||||
return d
|
||||
|
||||
## 本层修炼进度文本,如 "1234 / 2000"(当前修为 / 本层门槛)。
|
||||
## 练气圆满(13 层)返回"练气圆满";非练气期返回空串。
|
||||
func get_cultivation_progress_text() -> String:
|
||||
|
||||
Reference in New Issue
Block a user