Integrate per-save identity and interaction UI
This commit is contained in:
parent
ac82a28f3b
commit
4fda6e97f6
58 changed files with 3471 additions and 461 deletions
|
|
@ -1,6 +1,8 @@
|
|||
class_name PlayerAppearanceStore
|
||||
extends Node
|
||||
|
||||
signal appearance_changed
|
||||
|
||||
const FORMAT_VERSION: int = 1
|
||||
var _snapshot: Dictionary = CharacterCustomizationCatalog.default_snapshot()
|
||||
var _loaded: bool = false
|
||||
|
|
@ -70,11 +72,42 @@ func save_snapshot(value: Dictionary) -> bool:
|
|||
_snapshot = value.duplicate(true)
|
||||
if _save_atomic():
|
||||
_loaded = true
|
||||
if _snapshot != previous:
|
||||
appearance_changed.emit()
|
||||
return true
|
||||
_snapshot = previous
|
||||
return false
|
||||
|
||||
|
||||
func restore_from_save_data(
|
||||
value: Variant,
|
||||
persist_to_profile_file: bool = true,
|
||||
) -> bool:
|
||||
if (
|
||||
typeof(value) != TYPE_DICTIONARY
|
||||
or not CharacterCustomizationCatalog.validate_snapshot(value)
|
||||
):
|
||||
return false
|
||||
var sanitized: Dictionary = (
|
||||
CharacterCustomizationCatalog.sanitized_snapshot(value)
|
||||
)
|
||||
if persist_to_profile_file:
|
||||
return save_snapshot(sanitized)
|
||||
var previous: Dictionary = _snapshot.duplicate(true)
|
||||
_snapshot = sanitized
|
||||
_loaded = true
|
||||
if _snapshot != previous:
|
||||
appearance_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func reset_to_defaults(persist_to_profile_file: bool = true) -> bool:
|
||||
return restore_from_save_data(
|
||||
CharacterCustomizationCatalog.default_snapshot(),
|
||||
persist_to_profile_file,
|
||||
)
|
||||
|
||||
|
||||
func is_loaded() -> bool:
|
||||
return _loaded
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue