class_name AssembledArchive extends Resource @export var archive_id := 0 # TODO: 注意设置游戏起点 @export var entrance_portal := "left" @export var current_scene := "c01_s05": set(val): current_scene = val if val and val.length() != 7: printerr("[AssembledArchive] current_scene is not valid: " + val) return current_chapter = int(val.substr(1, 2)) current_section = int(val.substr(5)) # 尝试后台预先加载该场景 if GroundLoader.GROUND_SCENE_PATH_DICT.has(val): var path = GroundLoader.GROUND_SCENE_PATH_DICT[val] if GlobalConfig.DEBUG: print("[AssembledArchive] preload scene: " + path) ResourceLoader.load_threaded_request(path, "PackedScene") # current_chapter and current_section are derived from current_scene @export var current_chapter := 0 @export var current_section := 0 # player's info # 只有在 >=0 的情况下才会生效 @export var player_global_position_x := -100.0 @export var player_direction := Vector2(0, 0) # game total seconds @export var game_seconds_all := 0 @export var game_seconds_current := 0 # created time @export var created_time := "2024-12-24 00:00:00" # 全局参数 @export var global_data_dict := {} # 不同场景的地面物品状态存档 @export var ground_archives = {} # # true 为匿名,false 非匿名 # @export var npc_anonymous_states = {} # 玩家跑步锁定状态,默认为 true @export var player_running_locked := true # prop hud 显示道具 @export var prop_inventory: PropInventory @export var prop_inventory_xxdie: PropInventory @export var prop_inventory_xxxdie: PropInventory @export_group("八音盒", "bayinhe") @export var bayinhe_current_answer := [0, 0, 0, 0, 0, 0, 0, 0, 0] @export_enum("closed", "opened", "playing", "finished") var bayinhe_mode := "closed" func _init() -> void: if not prop_inventory: prop_inventory = PropInventory.new() if not prop_inventory_xxdie: prop_inventory_xxdie = PropInventory.new() if not prop_inventory_xxxdie: prop_inventory_xxxdie = PropInventory.new() prop_inventory_xxdie.owner = "小小蝶" prop_inventory_xxxdie.owner = "小小小蝶" prop_inventory.owner = "default" func ground_archive(scene_name := current_scene) -> GroundArchive: if not scene_name: printerr("getting GroundArchive: scene_name is null") return null if not ground_archives.has(scene_name): var g = GroundArchive.new() g.scene_name = scene_name ground_archives[scene_name] = g return ground_archives[scene_name] func set_global_entry(property: StringName, value) -> void: global_data_dict[property] = value func get_global_value(property: StringName) -> Variant: return global_data_dict.get(property)