Merge remote-tracking branch 'origin/demo'

This commit is contained in:
cakipaul 2025-07-11 23:39:10 +08:00
commit 8185e85464
21 changed files with 88 additions and 108 deletions

View File

@ -1,4 +1,4 @@
[gd_resource type="SpriteFrames" load_steps=853 format=3 uid="uid://b7fhheih1hbvf"] [gd_resource type="SpriteFrames" load_steps=845 format=3 uid="uid://b7fhheih1hbvf"]
[ext_resource type="Texture2D" uid="uid://dvq64espa37lx" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx1.png" id="1_ekv0l"] [ext_resource type="Texture2D" uid="uid://dvq64espa37lx" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx1.png" id="1_ekv0l"]
[ext_resource type="Texture2D" uid="uid://dcp4gk5lib4bl" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx2.png" id="2_fq076"] [ext_resource type="Texture2D" uid="uid://dcp4gk5lib4bl" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx2.png" id="2_fq076"]
@ -371,16 +371,12 @@
[ext_resource type="Texture2D" uid="uid://ybj4hg6cvh4a" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/20.png" id="183_kirv5"] [ext_resource type="Texture2D" uid="uid://ybj4hg6cvh4a" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/20.png" id="183_kirv5"]
[ext_resource type="Texture2D" uid="uid://15ij6tgncpfn" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/21.png" id="184_30nqm"] [ext_resource type="Texture2D" uid="uid://15ij6tgncpfn" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/21.png" id="184_30nqm"]
[ext_resource type="Texture2D" uid="uid://cc0eb4ycclo1f" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右5.png" id="184_jrug8"] [ext_resource type="Texture2D" uid="uid://cc0eb4ycclo1f" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右5.png" id="184_jrug8"]
[ext_resource type="Texture2D" uid="uid://cp71rayg8ynfr" path="res://asset/art/gif/c01_书店/小蝶拿报纸/0.png" id="184_tsskx"]
[ext_resource type="Texture2D" uid="uid://cjgj5oq5e2qt6" path="res://asset/art/gif/c01_书店/小蝶拿报纸/1.png" id="185_adpbv"]
[ext_resource type="Texture2D" uid="uid://bdbx3uylvnn78" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右6.png" id="185_in30h"] [ext_resource type="Texture2D" uid="uid://bdbx3uylvnn78" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右6.png" id="185_in30h"]
[ext_resource type="Texture2D" uid="uid://dtt8xb0gkufps" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/22.png" id="185_ncltk"] [ext_resource type="Texture2D" uid="uid://dtt8xb0gkufps" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/22.png" id="185_ncltk"]
[ext_resource type="Texture2D" uid="uid://emtd3r72ewhv" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右7.png" id="186_ecyns"] [ext_resource type="Texture2D" uid="uid://emtd3r72ewhv" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右7.png" id="186_ecyns"]
[ext_resource type="Texture2D" uid="uid://lc6luwpq22il" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/23.png" id="186_if2a6"] [ext_resource type="Texture2D" uid="uid://lc6luwpq22il" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/23.png" id="186_if2a6"]
[ext_resource type="Texture2D" uid="uid://jk7vua3s68q0" path="res://asset/art/gif/c01_书店/小蝶拿报纸/2.png" id="186_xaqjo"]
[ext_resource type="Texture2D" uid="uid://x0xakx6gceq3" path="res://asset/art/animation/c00_过道小猫/过道小猫1.png" id="186_yiibj"] [ext_resource type="Texture2D" uid="uid://x0xakx6gceq3" path="res://asset/art/animation/c00_过道小猫/过道小猫1.png" id="186_yiibj"]
[ext_resource type="Texture2D" uid="uid://lsx7qqkkka0b" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/24.png" id="187_7hrrj"] [ext_resource type="Texture2D" uid="uid://lsx7qqkkka0b" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/24.png" id="187_7hrrj"]
[ext_resource type="Texture2D" uid="uid://cwakyp1uwatvc" path="res://asset/art/gif/c01_书店/小蝶拿报纸/3.png" id="187_exmgj"]
[ext_resource type="Texture2D" uid="uid://1untb3vqajxc" path="res://asset/art/animation/c00_过道小猫/过道小猫2.png" id="187_qhkmm"] [ext_resource type="Texture2D" uid="uid://1untb3vqajxc" path="res://asset/art/animation/c00_过道小猫/过道小猫2.png" id="187_qhkmm"]
[ext_resource type="Texture2D" uid="uid://b6y8ggopkh8me" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/25.png" id="188_f1lc0"] [ext_resource type="Texture2D" uid="uid://b6y8ggopkh8me" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/25.png" id="188_f1lc0"]
[ext_resource type="Texture2D" uid="uid://dqdnrlwq5wreh" path="res://asset/art/gif/c01_书店/小蝶拿报纸/4.png" id="188_glo3y"] [ext_resource type="Texture2D" uid="uid://dqdnrlwq5wreh" path="res://asset/art/gif/c01_书店/小蝶拿报纸/4.png" id="188_glo3y"]
@ -430,13 +426,9 @@
[ext_resource type="Texture2D" uid="uid://cxein2tgxbmpd" path="res://asset/art/gif/c01_书店/小蝶拿报纸/22.png" id="206_dlydb"] [ext_resource type="Texture2D" uid="uid://cxein2tgxbmpd" path="res://asset/art/gif/c01_书店/小蝶拿报纸/22.png" id="206_dlydb"]
[ext_resource type="Texture2D" uid="uid://coiloe2kfxt3f" path="res://asset/art/gif/c01_公寓过道/小蝶探头/11.png" id="206_jtaix"] [ext_resource type="Texture2D" uid="uid://coiloe2kfxt3f" path="res://asset/art/gif/c01_公寓过道/小蝶探头/11.png" id="206_jtaix"]
[ext_resource type="Texture2D" uid="uid://q5kqwixoexgc" path="res://asset/art/gif/c01_公寓过道/小蝶探头/12.png" id="207_rf1ax"] [ext_resource type="Texture2D" uid="uid://q5kqwixoexgc" path="res://asset/art/gif/c01_公寓过道/小蝶探头/12.png" id="207_rf1ax"]
[ext_resource type="Texture2D" uid="uid://cf16ivik5eico" path="res://asset/art/gif/c01_书店/小蝶拿报纸/23.png" id="207_xewty"]
[ext_resource type="Texture2D" uid="uid://l1mfvgty8v12" path="res://asset/art/gif/c01_公寓过道/小蝶探头/13.png" id="208_ku7j2"] [ext_resource type="Texture2D" uid="uid://l1mfvgty8v12" path="res://asset/art/gif/c01_公寓过道/小蝶探头/13.png" id="208_ku7j2"]
[ext_resource type="Texture2D" uid="uid://du6u3l6v6ip88" path="res://asset/art/gif/c01_书店/小蝶拿报纸/24.png" id="208_yjsfv"]
[ext_resource type="Texture2D" uid="uid://b5u6lc238aqah" path="res://asset/art/gif/c01_公寓过道/小蝶探头/14.png" id="209_37eje"] [ext_resource type="Texture2D" uid="uid://b5u6lc238aqah" path="res://asset/art/gif/c01_公寓过道/小蝶探头/14.png" id="209_37eje"]
[ext_resource type="Texture2D" uid="uid://clo66qwjl0naq" path="res://asset/art/gif/c01_书店/小蝶拿报纸/25.png" id="209_253oi"]
[ext_resource type="Texture2D" uid="uid://m8ecqan6e2qk" path="res://asset/art/gif/c01_公寓过道/小蝶探头/15.png" id="210_ave4u"] [ext_resource type="Texture2D" uid="uid://m8ecqan6e2qk" path="res://asset/art/gif/c01_公寓过道/小蝶探头/15.png" id="210_ave4u"]
[ext_resource type="Texture2D" uid="uid://cuwflapilvolw" path="res://asset/art/gif/c01_书店/小蝶拿报纸/26.png" id="210_mlkjm"]
[ext_resource type="Texture2D" uid="uid://duw51q2gu7cyu" path="res://asset/art/gif/c01_公寓过道/小蝶探头/16.png" id="211_o38qq"] [ext_resource type="Texture2D" uid="uid://duw51q2gu7cyu" path="res://asset/art/gif/c01_公寓过道/小蝶探头/16.png" id="211_o38qq"]
[ext_resource type="Texture2D" uid="uid://bt2wosw7pdhmj" path="res://asset/art/gif/c01_公寓过道/小蝶探头/17.png" id="212_ddhdg"] [ext_resource type="Texture2D" uid="uid://bt2wosw7pdhmj" path="res://asset/art/gif/c01_公寓过道/小蝶探头/17.png" id="212_ddhdg"]
[ext_resource type="Texture2D" uid="uid://cespji827yo4y" path="res://asset/art/animation/c02_吕萍_蹲下来查看/1.png" id="213_mydup"] [ext_resource type="Texture2D" uid="uid://cespji827yo4y" path="res://asset/art/animation/c02_吕萍_蹲下来查看/1.png" id="213_mydup"]
@ -1892,18 +1884,6 @@ animations = [{
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("184_tsskx")
}, {
"duration": 1.0,
"texture": ExtResource("185_adpbv")
}, {
"duration": 1.0,
"texture": ExtResource("186_xaqjo")
}, {
"duration": 1.0,
"texture": ExtResource("187_exmgj")
}, {
"duration": 1.0,
"texture": ExtResource("188_glo3y") "texture": ExtResource("188_glo3y")
}, { }, {
"duration": 1.0, "duration": 1.0,
@ -1959,18 +1939,6 @@ animations = [{
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("206_dlydb") "texture": ExtResource("206_dlydb")
}, {
"duration": 1.0,
"texture": ExtResource("207_xewty")
}, {
"duration": 2.0,
"texture": ExtResource("208_yjsfv")
}, {
"duration": 2.0,
"texture": ExtResource("209_253oi")
}, {
"duration": 1.0,
"texture": ExtResource("210_mlkjm")
}], }],
"loop": false, "loop": false,
"name": &"c01_小小蝶_书店递报纸", "name": &"c01_小小蝶_书店递报纸",

View File

@ -155,6 +155,7 @@ func get_prop_hud() -> PropHud:
func toggle_hud_display(display_hud: bool) -> void: func toggle_hud_display(display_hud: bool) -> void:
var prop_hud = get_prop_hud() as PropHud var prop_hud = get_prop_hud() as PropHud
if prop_hud: if prop_hud:
print("[hud] toggle_hud_display:", display_hud)
if display_hud: if display_hud:
prop_hud.display_hud() prop_hud.display_hud()
else: else:
@ -189,6 +190,7 @@ func has_prop(prop_key: String) -> bool:
func enable_prop_item_silently(prop_key: String) -> void: func enable_prop_item_silently(prop_key: String) -> void:
var prop_hud = get_prop_hud() var prop_hud = get_prop_hud()
if prop_hud: if prop_hud:
print("[prop] enable_prop_item_silently prop:", prop_key)
prop_hud.enable_prop_item(prop_key, false) prop_hud.enable_prop_item(prop_key, false)
else: else:
printerr("enable_prop_item_silently: PropHud node not found") printerr("enable_prop_item_silently: PropHud node not found")
@ -197,6 +199,7 @@ func enable_prop_item_silently(prop_key: String) -> void:
func enable_prop_item(prop_key: String) -> void: func enable_prop_item(prop_key: String) -> void:
var prop_hud = get_prop_hud() var prop_hud = get_prop_hud()
if prop_hud: if prop_hud:
print("[prop] enable_prop_item prop:", prop_key)
prop_hud.enable_prop_item(prop_key) prop_hud.enable_prop_item(prop_key)
else: else:
printerr("enable_prop_item PropHud node not found") printerr("enable_prop_item PropHud node not found")
@ -206,6 +209,7 @@ func enable_prop_item(prop_key: String) -> void:
func enable_important_item(prop_key: String, display_inspector = true) -> void: func enable_important_item(prop_key: String, display_inspector = true) -> void:
var prop_hud = get_prop_hud() var prop_hud = get_prop_hud()
if prop_hud: if prop_hud:
print("[prop] enable_important_item prop:", prop_key)
prop_hud.enable_important_item(prop_key, display_inspector) prop_hud.enable_important_item(prop_key, display_inspector)
else: else:
printerr("enable_important_item PropHud node not found") printerr("enable_important_item PropHud node not found")
@ -214,6 +218,7 @@ func enable_important_item(prop_key: String, display_inspector = true) -> void:
func disable_prop_item(prop_key: String) -> void: func disable_prop_item(prop_key: String) -> void:
var prop_hud = get_prop_hud() var prop_hud = get_prop_hud()
if prop_hud: if prop_hud:
print("[prop] disable_prop_item prop:", prop_key)
prop_hud.disable_prop_item(prop_key) prop_hud.disable_prop_item(prop_key)
else: else:
printerr("disable_prop_item PropHud node not found") printerr("disable_prop_item PropHud node not found")
@ -327,7 +332,9 @@ func _jump_back_to_index_and_quit_main() -> void:
await get_tree().process_frame await get_tree().process_frame
get_tree().change_scene_to_packed(packed_index_page) get_tree().change_scene_to_packed(packed_index_page)
# 防止游戏卡死 reset pause counter # 防止游戏卡死 reset pause counter
pause_counter = 0 if pause_counter_arr.size() > 0:
printerr("checkout_index_page: pause_counter_arr is not empty, resetting pause counter")
pause_counter_arr.clear()
get_tree().paused = false get_tree().paused = false
@ -339,7 +346,9 @@ func enter_main_scene() -> void:
await get_tree().process_frame await get_tree().process_frame
get_tree().change_scene_to_packed.call_deferred(main_scene) get_tree().change_scene_to_packed.call_deferred(main_scene)
# get_tree().change_scene_to_file.call_deferred("uid://dygvcmykn02n8") # get_tree().change_scene_to_file.call_deferred("uid://dygvcmykn02n8")
pause_counter = 0 if pause_counter_arr.size() > 0:
printerr("enter_main_scene: pause_counter_arr is not empty, resetting pause counter")
pause_counter_arr.clear()
get_tree().paused = false get_tree().paused = false
@ -381,16 +390,20 @@ func show_settings() -> void:
#### 游戏场景树暂停计数器设置、memory、bag 等菜单都会导致 pause #### 游戏场景树暂停计数器设置、memory、bag 等菜单都会导致 pause
var pause_counter := 0 ## 目前有(5类): settings, panel, bag, note, memory
var pause_counter_arr: Array[String] = []
var pause_counter_mutex := Mutex.new() var pause_counter_mutex := Mutex.new()
func toggle_pause_counter(plus := true) -> void: func toggle_pause_counter(plus := true, from := "") -> void:
# 若不 lock会导致快速切换菜单时出现并发问题pause_counter 成为负数) # 若不 lock会导致快速切换菜单时出现并发问题pause_counter 成为负数)
pause_counter_mutex.lock() pause_counter_mutex.lock()
pause_counter += 1 if plus else -1 if plus:
print("SceneTree pause_counter: ", pause_counter) pause_counter_arr.append(from)
get_tree().paused = pause_counter > 0 else:
pause_counter_arr.erase(from)
print("SceneTree pause_counter_arr: ", pause_counter_arr)
get_tree().paused = len(pause_counter_arr) > 0
pause_counter_mutex.unlock() pause_counter_mutex.unlock()

View File

@ -279,8 +279,7 @@ func _on_freeze_changed(count: int, is_add: bool):
# 非首次 freeze 不改变动画状态,因为在动画演出中可能多次 freeze 与 release # 非首次 freeze 不改变动画状态,因为在动画演出中可能多次 freeze 与 release
func _on_first_frozen() -> void: func _on_first_frozen() -> void:
if GlobalConfig.DEBUG: print("player _on_first_frozen. current_status=", current_status)
print("player _on_first_frozen. current_status=", current_status)
# reset status to idle or stay # reset status to idle or stay
velocity = Vector2.ZERO velocity = Vector2.ZERO
current_status = PlayerAnimationConfig.MOVEMENT_IDLE current_status = PlayerAnimationConfig.MOVEMENT_IDLE
@ -372,8 +371,7 @@ func walk_to_x(global_pos_x: float) -> Tween:
func walk_to(global_pos: Vector2) -> Tween: func walk_to(global_pos: Vector2) -> Tween:
var tween = create_tween() var tween = create_tween()
velocity = Vector2.ZERO velocity = Vector2.ZERO
if GlobalConfig.DEBUG: print("player walk_to:", global_pos, " from:", global_position)
print("walk_to:", global_pos, " from:", global_position)
# 不同距离下,行走时长略做自适应 # 不同距离下,行走时长略做自适应
var time_cost = absf(global_pos.distance_to(global_position) / 50.0) var time_cost = absf(global_pos.distance_to(global_position) / 50.0)
# 忽略过小的位移 # 忽略过小的位移
@ -406,8 +404,7 @@ func toggle_pause_state(pause := true) -> void:
func _after_walk_to() -> void: func _after_walk_to() -> void:
current_status = PlayerAnimationConfig.MOVEMENT_IDLE current_status = PlayerAnimationConfig.MOVEMENT_IDLE
_play_animation() _play_animation()
if GlobalConfig.DEBUG: print("player walk_to end. unlock player")
print("walk_to end. unlock player")
SceneManager.unlock_player() SceneManager.unlock_player()

View File

@ -57,8 +57,8 @@ func freeze(duration := 0.0) -> void:
_freeze_requests += 1 _freeze_requests += 1
var f_requests = _freeze_requests var f_requests = _freeze_requests
_request_mutex.unlock() _request_mutex.unlock()
print("[Lock] Freeze applied: ", _freeze_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("[Lock] Freeze applied: ", _freeze_requests)
print("freeze from: ", _get_stack_info()) print("freeze from: ", _get_stack_info())
freeze_changed.emit(f_requests, true) freeze_changed.emit(f_requests, true)
@ -77,8 +77,8 @@ func release() -> void:
_freeze_requests = 0 _freeze_requests = 0
var f_requests = _freeze_requests var f_requests = _freeze_requests
_request_mutex.unlock() _request_mutex.unlock()
print("[Lock] Release applied: ", _freeze_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("[Lock] Release applied: ", _freeze_requests)
print("release from: ", _get_stack_info()) print("release from: ", _get_stack_info())
freeze_changed.emit(f_requests, false) freeze_changed.emit(f_requests, false)
@ -90,8 +90,8 @@ func hold(duration := 0.0) -> void:
_request_mutex.lock() _request_mutex.lock()
_hold_requests += 1 _hold_requests += 1
_request_mutex.unlock() _request_mutex.unlock()
print("[Lock] Hold applied: ", _hold_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("[Lock] Hold applied: ", _hold_requests)
print("hold from: ", _get_stack_info()) print("hold from: ", _get_stack_info())
hold_changed.emit(_hold_requests, true) hold_changed.emit(_hold_requests, true)
@ -110,8 +110,8 @@ func unhold() -> void:
_hold_requests = 0 _hold_requests = 0
var h_requests = _hold_requests var h_requests = _hold_requests
_request_mutex.unlock() _request_mutex.unlock()
print("[Lock] Unhold applied: ", _hold_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("[Lock] Unhold applied: ", _hold_requests)
print("unhold from: ", _get_stack_info()) print("unhold from: ", _get_stack_info())
hold_changed.emit(h_requests, true) hold_changed.emit(h_requests, true)
@ -143,8 +143,8 @@ func lock_all(duration := 0.0) -> void:
var h_requests = _hold_requests var h_requests = _hold_requests
var f_requests = _freeze_requests var f_requests = _freeze_requests
_request_mutex.unlock() _request_mutex.unlock()
prints("[Lock] LockAll applied (hold, freeze): ", _hold_requests, _freeze_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
prints("[Lock] LockAll applied (hold, freeze): ", _hold_requests, _freeze_requests)
print("lock_all from: ", _get_stack_info()) print("lock_all from: ", _get_stack_info())
hold_changed.emit(h_requests, true) hold_changed.emit(h_requests, true)
freeze_changed.emit(f_requests, true) freeze_changed.emit(f_requests, true)
@ -177,8 +177,8 @@ func unlock_all() -> void:
_request_mutex.unlock() _request_mutex.unlock()
hold_changed.emit(h_requests, false) hold_changed.emit(h_requests, false)
freeze_changed.emit(f_requests, false) freeze_changed.emit(f_requests, false)
prints("[Lock] UnlockAll applied (hold, freeze): ", _hold_requests, _freeze_requests)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
prints("[Lock] UnlockAll applied (hold, freeze): ", _hold_requests, _freeze_requests)
print("unlock_all from: ", _get_stack_info()) print("unlock_all from: ", _get_stack_info())

View File

@ -206,7 +206,7 @@ func apply_dialogue_line() -> void:
if audio_stream_player.playing: if audio_stream_player.playing:
audio_stream_player.stop() audio_stream_player.stop()
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
printerr("Dialogue no audio found! audio_path = %s audio_import_path = %s" % [audio_path, audio_import_path]) print_rich("[color=orange]Dialogue no audio found! audio_path = %s audio_import_path = %s" % [audio_path, audio_import_path])
# if dialogue_label.is_typing: # if dialogue_label.is_typing:
# await dialogue_label.finished_typing # await dialogue_label.finished_typing

View File

@ -33,7 +33,7 @@ func display() -> void:
if current_child.has_signal("exit"): if current_child.has_signal("exit"):
current_child.connect("exit", _exit) current_child.connect("exit", _exit)
elif GlobalConfig.DEBUG: elif GlobalConfig.DEBUG:
print("[特写界面] no exit signal, packed_scene:", packed_scene) print_rich("[color=orange][特写界面] no exit signal, packed_scene:", packed_scene)
func _exit(arg = null): func _exit(arg = null):

View File

@ -139,8 +139,8 @@ var interact_mutex = Mutex.new()
func is_key_matched(key) -> bool: func is_key_matched(key) -> bool:
return ( return (
# 第一个 prop_key 若空,则表示不需要匹配 # prop_key 皆空,则表示不需要匹配
not prop_key (not prop_key and not prop_key2 and not prop_key3)
or ( or (
# 只要有一个 prop_key 匹配即可 # 只要有一个 prop_key 匹配即可
(prop_key and key == prop_key) (prop_key and key == prop_key)
@ -150,6 +150,14 @@ func is_key_matched(key) -> bool:
) )
func check_if_disable_prop(key) -> void:
# prop_key 若空, 则表示不需要匹配, 也就不需要 disable 当前道具
if not disable_prop_after_interacted or (not prop_key and not prop_key2 and not prop_key3):
return
if key:
SceneManager.disable_prop_item(key)
func _pre_interacted() -> void: func _pre_interacted() -> void:
SceneManager.lock_player(0, action_key) SceneManager.lock_player(0, action_key)
if icount == 0 and first_interact_os_key: if icount == 0 and first_interact_os_key:
@ -177,8 +185,7 @@ func _on_interacted() -> void:
return return
if not mute_when_interacted: if not mute_when_interacted:
sfx_success.play() sfx_success.play()
if disable_prop_after_interacted and key: check_if_disable_prop(key)
SceneManager.disable_prop_item(key)
interacted_times += 1 interacted_times += 1
if interacted_texture: if interacted_texture:
texture = interacted_texture texture = interacted_texture

View File

@ -121,8 +121,7 @@ func _interacted():
else: else:
SceneManager.enable_prop_item(prop_key) SceneManager.enable_prop_item(prop_key)
triggered.emit() triggered.emit()
if GlobalConfig.DEBUG: print("pickable triggered! prop_key=", prop_key, ",as_important_item=", as_important_item)
print("pickable triggered! name=", name)
_check_display() _check_display()

View File

@ -95,8 +95,7 @@ func _ready() -> void:
ground_archive = ArchiveManager.archive.ground_archive() ground_archive = ArchiveManager.archive.ground_archive()
icount = ground_archive.get_value(name, "icount", 0) icount = ground_archive.get_value(name, "icount", 0)
status = ground_archive.get_value(name, "status", status) status = ground_archive.get_value(name, "status", status)
if GlobalConfig.DEBUG: print("Portal read status [", name, "] status=", status)
print("Portal read status [", name, "] status=", status)
_check_sign_mark_and_texture() _check_sign_mark_and_texture()
area2d.body_entered.connect(_reset) area2d.body_entered.connect(_reset)
area2d.body_exited.connect(_on_cancel) area2d.body_exited.connect(_on_cancel)
@ -198,8 +197,7 @@ func _on_interacted() -> void:
before_pre_transport_wait.emit() before_pre_transport_wait.emit()
if pre_transport_wait_time > 0.0: if pre_transport_wait_time > 0.0:
await get_tree().create_timer(pre_transport_wait_time).timeout await get_tree().create_timer(pre_transport_wait_time).timeout
if GlobalConfig.DEBUG: prints("[portal] transition to scene:", target_scene, target_portal, "immediately=", immediately)
print("传送前往", target_scene, target_portal, " immediately=", immediately)
var ground_loader = SceneManager.get_ground_loader() as GroundLoader var ground_loader = SceneManager.get_ground_loader() as GroundLoader
if ground_loader: if ground_loader:
if immediately: if immediately:

View File

@ -142,9 +142,9 @@ func align_activation() -> bool:
activated, activated,
"[/color]", "[/color]",
" occupied:[color=khaki]", " occupied:[color=khaki]",
_get_name_from_path(occupied), Sign.get_name_from_path(occupied),
"[/color] touching:[color=coral]", "[/color] touching:[color=coral]",
_get_name_from_paths(_touching_sign_arr), Sign.get_name_from_paths(_touching_sign_arr),
"[/color]" "[/color]"
) )
return activated return activated
@ -193,7 +193,7 @@ func _try_activate() -> bool:
return activated return activated
func _get_name_from_path(path: NodePath) -> String: static func get_name_from_path(path: NodePath) -> String:
if not path: if not path:
return "" return ""
# return -2 idx # return -2 idx
@ -206,12 +206,12 @@ func _get_name_from_path(path: NodePath) -> String:
return "" return ""
func _get_name_from_paths(paths: Array[NodePath]) -> String: static func get_name_from_paths(paths: Array[NodePath]) -> String:
if len(paths) == 0: if len(paths) == 0:
return "" return ""
var names = [] var names = []
for path in paths: for path in paths:
names.append(_get_name_from_path(path)) names.append(Sign.get_name_from_path(path))
return ", ".join(names) return ", ".join(names)
@ -225,8 +225,7 @@ func _unhandled_input(event: InputEvent) -> void:
if activated: if activated:
if event.is_action_pressed("interact"): if event.is_action_pressed("interact"):
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
if GlobalConfig.DEBUG: print("Sign interacted:", get_parent().name)
print("Sign interacted:", get_parent().name)
interacted.emit() interacted.emit()
if is_inside_tree(): if is_inside_tree():
# grab focus 放在 emit 后面,避免在 emit 时 prop hud 失去 focus # grab focus 放在 emit 后面,避免在 emit 时 prop hud 失去 focus
@ -235,8 +234,7 @@ func _unhandled_input(event: InputEvent) -> void:
grab_focus() grab_focus()
elif event.is_action_pressed("cancel"): elif event.is_action_pressed("cancel"):
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
if GlobalConfig.DEBUG: print("Sign cancel:", get_parent().name)
print("Sign cancel:", get_parent().name)
cancel.emit() cancel.emit()
release_focus() release_focus()

View File

@ -180,8 +180,7 @@ func move_player_to_portal(portal_name: String) -> void:
elif portal_name == "right": elif portal_name == "right":
mov_player.set_facing_direction(Vector2.LEFT) mov_player.set_facing_direction(Vector2.LEFT)
reset_player_y() reset_player_y()
if GlobalConfig.DEBUG: print("[ground] move player to portal:", portal_name, portal_node.global_position)
print("move player to portal:", portal_name, portal_node.global_position)
elif mov_player: elif mov_player:
printerr(scene_name, " portal not found: ", node_path) printerr(scene_name, " portal not found: ", node_path)
else: else:

View File

@ -128,9 +128,8 @@ func transition_to_scene(scene_name: String, portal: String, wait_time := 1.4) -
# 先发送,再暂停,允许 sfx 等节点执行 ease out # 先发送,再暂停,允许 sfx 等节点执行 ease out
SceneManager.ground_transition_pre_paused.emit() SceneManager.ground_transition_pre_paused.emit()
ground.process_mode = Node.PROCESS_MODE_DISABLED ground.process_mode = Node.PROCESS_MODE_DISABLED
if GlobalConfig.DEBUG: # print reenter lock status
# print reenter lock status print("GroundLoader transition_to_scene: reenter lock status: ", ground.reenter_lock)
print("GroundLoader transition_to_scene: reenter lock status: ", ground.reenter_lock)
var scene_path = GROUND_SCENE_PATH_DICT.get(scene_name) var scene_path = GROUND_SCENE_PATH_DICT.get(scene_name)
if scene_path: if scene_path:
current_scene = scene_name current_scene = scene_name
@ -214,14 +213,13 @@ func _add_ground():
else: else:
# move player to portal # move player to portal
ground.move_player_to_portal(entrance_portal) ground.move_player_to_portal(entrance_portal)
if GlobalConfig.DEBUG:
print(
"GroundLoader add_ground finished:",
ground.scene_name,
" player.pos=",
ground.get_player().global_position
)
add_child(ground) add_child(ground)
print(
"GroundLoader add_ground finished:",
ground.scene_name,
" player.pos=",
ground.get_player().global_position
)
# ready 后,再整体重置 camera 位置 # ready 后,再整体重置 camera 位置
if not Engine.is_editor_hint(): if not Engine.is_editor_hint():
ground.get_camera().reset_position_immediately() ground.get_camera().reset_position_immediately()

View File

@ -11,8 +11,7 @@ extends Control
func _ready(): func _ready():
if GlobalConfig.DEBUG: print("Index Page Ready")
print("Index Page Ready")
newgame_btn.pressed.connect(_on_newgame_pressed) newgame_btn.pressed.connect(_on_newgame_pressed)
resume_btn.pressed.connect(_on_resume_pressed) resume_btn.pressed.connect(_on_resume_pressed)
quit_btn.pressed.connect(_on_quit_pressed) quit_btn.pressed.connect(_on_quit_pressed)
@ -37,8 +36,7 @@ func _on_newgame_pressed():
func _on_resume_pressed(): func _on_resume_pressed():
sfx_click.global_play() sfx_click.global_play()
# 继续一号存档 # 继续一号存档
if GlobalConfig.DEBUG: print("Resume Game")
print("Resume")
if ArchiveManager.archives.has(1): if ArchiveManager.archives.has(1):
# 设置 current_selected_archive_id 后,存档会自动加载 # 设置 current_selected_archive_id 后,存档会自动加载
GlobalConfigManager.config.current_selected_archive_id = 1 GlobalConfigManager.config.current_selected_archive_id = 1

View File

@ -95,7 +95,7 @@ func _ready():
# return # return
return_btn.pressed.connect(_on_return_btn_pressed) return_btn.pressed.connect(_on_return_btn_pressed)
return_btn.grab_focus() return_btn.grab_focus()
SceneManager.toggle_pause_counter(true) SceneManager.toggle_pause_counter(true, "settings")
# open # open
$"Sfx打开".play() $"Sfx打开".play()
# # resize # # resize
@ -200,5 +200,5 @@ func _unhandled_key_input(event: InputEvent) -> void:
func exit_settings() -> void: func exit_settings() -> void:
$"Sfx关闭".global_play() $"Sfx关闭".global_play()
SceneManager.toggle_pause_counter(false) SceneManager.toggle_pause_counter(false, "settings")
queue_free() queue_free()

View File

@ -8,7 +8,7 @@ extends CanvasLayer
func _ready(): func _ready():
layer = GlobalConfig.CANVAS_LAYER_UX_PANEL layer = GlobalConfig.CANVAS_LAYER_UX_PANEL
SceneManager.toggle_pause_counter(true) SceneManager.toggle_pause_counter(true, "bag")
_load_item_buttons() _load_item_buttons()
# fisplay first item # fisplay first item
var hud = SceneManager.get_prop_hud() var hud = SceneManager.get_prop_hud()
@ -76,5 +76,5 @@ func _unhandled_input(event: InputEvent) -> void:
func quit() -> void: func quit() -> void:
SceneManager.toggle_pause_counter(false) SceneManager.toggle_pause_counter(false, "bag")
queue_free() queue_free()

View File

@ -3,7 +3,7 @@ class_name Memory extends CanvasLayer
func _ready() -> void: func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_UX_PANEL layer = GlobalConfig.CANVAS_LAYER_UX_PANEL
SceneManager.toggle_pause_counter(true) SceneManager.toggle_pause_counter(true, "memory")
update_display() update_display()
@ -19,7 +19,7 @@ func _unhandled_input(event: InputEvent) -> void:
func quit() -> void: func quit() -> void:
SceneManager.toggle_pause_counter(false) SceneManager.toggle_pause_counter(false, "memory")
queue_free() queue_free()

View File

@ -3,7 +3,7 @@ extends CanvasLayer
func _ready() -> void: func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_UX_PANEL layer = GlobalConfig.CANVAS_LAYER_UX_PANEL
SceneManager.toggle_pause_counter(true) SceneManager.toggle_pause_counter(true, "note")
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
@ -18,5 +18,5 @@ func _unhandled_input(event: InputEvent) -> void:
func quit() -> void: func quit() -> void:
SceneManager.toggle_pause_counter(false) SceneManager.toggle_pause_counter(false, "note")
queue_free() queue_free()

View File

@ -11,7 +11,7 @@ extends CanvasLayer
func _ready() -> void: func _ready() -> void:
$SfxOpen.play() $SfxOpen.play()
layer = GlobalConfig.CANVAS_LAYER_UX_PANEL layer = GlobalConfig.CANVAS_LAYER_UX_PANEL
SceneManager.toggle_pause_counter(true) SceneManager.toggle_pause_counter(true, "panel")
continue_btn.pressed.connect(_continue) continue_btn.pressed.connect(_continue)
note_btn.pressed.connect(SceneManager.show_note) note_btn.pressed.connect(SceneManager.show_note)
settings_btn.pressed.connect(SceneManager.show_settings) settings_btn.pressed.connect(SceneManager.show_settings)
@ -27,7 +27,7 @@ func _quit_game() -> void:
func _continue(): func _continue():
$SfxClose.global_play() $SfxClose.global_play()
SceneManager.toggle_pause_counter(false) SceneManager.toggle_pause_counter(false, "panel")
queue_free() queue_free()

View File

@ -223,7 +223,7 @@ func _update_prop_display_with_texture():
var player = SceneManager.get_player() var player = SceneManager.get_player()
if player: if player:
player.set_catty_light(key == "prop_小猫玩具完整") player.set_catty_light(key == "prop_小猫玩具完整")
print("[PropHud] current display prop:", key)
# 选中标记 select_mark; 如果被 free 掉,则重新创建 # 选中标记 select_mark; 如果被 free 掉,则重新创建
if select_mark and is_instance_valid(select_mark): if select_mark and is_instance_valid(select_mark):
var parent = select_mark.get_parent() var parent = select_mark.get_parent()
@ -319,6 +319,7 @@ func _on_prop_inspected(id := 0) -> void:
prop_key = inventory.current_item_key() prop_key = inventory.current_item_key()
if prop_key: if prop_key:
sfx_inspect.play() sfx_inspect.play()
print("[PropHud] inspect prop:", prop_key)
inspect_item(prop_key, false) inspect_item(prop_key, false)

View File

@ -215,6 +215,7 @@ offset_right = 65.0
offset_bottom = 65.0 offset_bottom = 65.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2
texture = ExtResource("7_53yeo") texture = ExtResource("7_53yeo")
[node name="RightMargin" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] [node name="RightMargin" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]

View File

@ -62,7 +62,7 @@ func _hide():
func _post_hide(): func _post_hide():
status = STATUS_HIDDEN status = STATUS_HIDDEN
scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE
locking = false holding = false
origin_texture.texture = null origin_texture.texture = null
full_texture.texture = null full_texture.texture = null
texture_cover = null texture_cover = null
@ -96,7 +96,7 @@ func pop_standard_inspection(
content_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT content_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
if status != STATUS_HIDDEN: if status != STATUS_HIDDEN:
_hide() _hide()
locking = true holding = true
status = STATUS_INSPECTING_COVER status = STATUS_INSPECTING_COVER
visible = true visible = true
full_texture.texture = cover_texture full_texture.texture = cover_texture
@ -115,14 +115,17 @@ func pop_standard_inspection(
_blink_label() _blink_label()
var locking = false: var _lock_mutex := Mutex.new()
var holding = false:
set(val): set(val):
if val != locking: _lock_mutex.lock()
locking = val if val != holding:
holding = val
if val: if val:
SceneManager.lock_player() SceneManager.hold_player()
else: else:
SceneManager.unlock_player() SceneManager.unhold_player()
_lock_mutex.unlock()
var balloon var balloon
@ -136,7 +139,7 @@ func pop_prop_inspection(
# STATUS_INSPECTING_PROP 状态下不 hide跳过重复 lock # STATUS_INSPECTING_PROP 状态下不 hide跳过重复 lock
if status != STATUS_HIDDEN and status != STATUS_INSPECTING_PROP: if status != STATUS_HIDDEN and status != STATUS_INSPECTING_PROP:
_hide() _hide()
locking = true holding = true
status = STATUS_INSPECTING_PROP status = STATUS_INSPECTING_PROP
visible = true visible = true
var tween = create_tween() var tween = create_tween()