archive&config CURRENT_VERSION=6; 去除current_chapter,替换为 event;_setup_bully_or_burning 仅在get_chapter_stage<3

This commit is contained in:
cakipaul 2025-07-14 12:43:33 +08:00
parent c5c86582a9
commit bbb46473f2
6 changed files with 27 additions and 19 deletions

View File

@ -15,7 +15,7 @@ static var user_root_dir := "user://data/" # must end with "/"
static var archive_dir := "user://data/archives/"
static var archive_prefix := "save"
const CURRENT_VERSION = 5
const CURRENT_VERSION = 6
var archives := {}
var autosave_timer := Timer.new()
@ -36,7 +36,7 @@ func _ready() -> void:
# 在 debug or editor 模式下,直接保证有 archive
if GlobalConfig.DEBUG or Engine.is_editor_hint():
if archives.size() == 0:
create_and_use_new_archive()
create_and_use_new_archive(0)
else:
# debug 模式下默认使用 0 号存档
GlobalConfigManager.config.current_selected_archive_id = 0
@ -279,12 +279,11 @@ func set_chapter_if_greater(c: int) -> void:
if c < 1 or c > 6:
printerr("[ArchiveManager] set_chapter_if_greater: invalid chapter value: " + str(c))
return
if archive.current_chapter >= c:
if EventManager.get_chapter_stage() >= c:
return
# 进入下一章
print("[ArchiveManager] set_chapter_if_greater: " + str(c))
archive.current_chapter = c
# 笔记也进入下一章
EventManager.set_stage_if_greater("handnote_chapter_stage", c)
EventManager.set_stage_if_greater("current_chapter_stage", c)
func unlock_memory(id: int) -> void:

View File

@ -16,8 +16,6 @@ class_name AssembledArchive extends Resource
if GlobalConfig.DEBUG:
print("[AssembledArchive] current_scene: " + current_scene)
ResourceLoader.load_threaded_request(path, "PackedScene")
# 0:未开始游戏1:序章2-5:一四章6:结尾
@export var current_chapter := 0
# player's info
# 只有在 >=0 的情况下才会生效
@export var player_global_position_x := -100.0

View File

@ -25,7 +25,8 @@ func _set_config(val: GlobalConfig) -> void:
print_rich("[color=orange]Debug mode enabled[/color]")
# set up window
if config.window_fullscreen:
get_window().mode = Window.MODE_FULLSCREEN
get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN
# get_window().mode = Window.MODE_FULLSCREEN
else:
get_window().mode = Window.MODE_WINDOWED
get_window().always_on_top = config.window_top
@ -87,7 +88,9 @@ func print_global_info():
@warning_ignore("integer_division")
var minute := (archive.game_seconds % 3600) / 60
var second := archive.game_seconds % 60
var round_info = "r" + str(config.game_rounds) + "_c" + str(archive.current_chapter)
# 0:未开始游戏1:序章2-5:一四章6:结尾
var chapter := EventManager.get_chapter_stage()
var round_info = "r" + str(config.game_rounds) + "_c" + str(chapter)
var game_time_info = "game:" + str(hour) + ":" + str(minute) + ":" + str(second)
# get ticks since game app run
var ticks = Time.get_ticks_msec()

View File

@ -1,8 +1,13 @@
@tool
extends Node
signal stage_updated(event_name: StringName, stage: int)
func get_chapter_stage() -> int:
return get_stage("current_chapter_stage")
func get_stage(event_name: StringName) -> int:
if not ArchiveManager.archive or ArchiveManager.archive.event_stage == null:
printerr("[EventManager] Archive or event_stage is null.")
@ -21,8 +26,12 @@ func set_stage(event_name: StringName, stage := 1) -> void:
print("[EventManager] Stage updated: %s, stage: %s" % [event_name, stage])
stage_updated.emit(event_name, stage)
# 如果是 handnote_ 事件,玩家进行记笔记动作
if SceneManager.get_player().character.begins_with("吕萍"):
if event_name == &"handnote_chapter_stage":
if (
SceneManager.is_node_ready()
and SceneManager.get_player()
and SceneManager.get_player().character.begins_with("吕萍")
):
if event_name == &"current_chapter_stage":
# 章节更新
pass
elif event_name.begins_with("handnote_"):

View File

@ -118,7 +118,7 @@ func _on_ground_ready() -> void:
bully_layer = $"../DeployLayer/霸凌"
burning_layer = $"../DeployLayer/火灾"
if EventManager.get_stage(&"c02_ball_game_stage") >= 3:
if EventManager.get_stage(&"c02_ball_game_stage") >= 3 and EventManager.get_chapter_stage() < 3:
_setup_bully_or_burning(true)
@ -203,10 +203,9 @@ func eavesdrop() -> void:
func _setup_bully_or_burning(reenter_scene := false):
if not ArchiveManager.get_global_value(&"c02_eavesdrop_finished"):
# 弹珠游戏结束后就开始霸凌,此时禁止偷听。第一章结束后(火灾结束),第二章再偷听
$"../DeployLayer/Ambush偷听对话".enabled = false
eavesdrop_window.visible = false
# 弹珠游戏结束后就开始霸凌,此时禁止偷听。第一章结束后(火灾结束),第二章再偷听
$"../DeployLayer/Ambush偷听对话".enabled = false
eavesdrop_window.visible = false
if EventManager.get_stage(&"c02_burning_end_stage") == 2:
# 火灾演出完全结束
burning_layer.visible = false

View File

@ -81,7 +81,7 @@ position = Vector2(340, 137)
scale = Vector2(0.2, 0.2)
script = ExtResource("5_nk0pj")
chapter = 2
event = &"handnote_chapter_stage"
event = &"current_chapter_stage"
hide_if_on_stage = Array[int]([0, 3])
metadata/_custom_type_script = "uid://c5woj7mivdxrh"
@ -261,7 +261,7 @@ scale = Vector2(0.2, 0.2)
script = ExtResource("5_nk0pj")
chapter = 3
slices_path = "res://asset/art/ui/note/c03_slices/"
event = &"handnote_chapter_stage"
event = &"current_chapter_stage"
hide_if_on_stage = Array[int]([0, 3])
metadata/_custom_type_script = "uid://c5woj7mivdxrh"