书架点击时锁定+只打乱一次
This commit is contained in:
parent
49f204ab0a
commit
2ae1063f22
@ -64,21 +64,22 @@ func _ready() -> void:
|
||||
if light_energy != 0.0:
|
||||
add_child(light2d)
|
||||
frame_changed.connect(_on_frame_changed)
|
||||
if Engine.is_editor_hint():
|
||||
_debug_mov_projection()
|
||||
else:
|
||||
debug_mov_onion_sprite2d.queue_free()
|
||||
_load_config()
|
||||
if autostart and animation:
|
||||
if autostart and animation and not Engine.is_editor_hint():
|
||||
# 制造一点错差
|
||||
frame = randi() % sprite_frames.get_frame_count(animation)
|
||||
if not Engine.is_editor_hint() or debug_playing:
|
||||
play()
|
||||
animation_changed.connect(_on_animation_start)
|
||||
animation_looped.connect(_on_animation_start)
|
||||
animation_finished.connect(_on_animation_finished)
|
||||
animation_looped.connect(_on_animation_finished)
|
||||
|
||||
if Engine.is_editor_hint():
|
||||
# stop()
|
||||
# frame = 0
|
||||
debug_playing = false
|
||||
_debug_mov_projection()
|
||||
else:
|
||||
debug_mov_onion_sprite2d.queue_free()
|
||||
|
||||
func _debug_mov_projection():
|
||||
_load_config()
|
||||
|
@ -81,7 +81,7 @@ script = ExtResource("1_0bbao")
|
||||
group_name = &"氛围_不受欢迎的存在"
|
||||
group_db = 0.0
|
||||
base_sound = ExtResource("11_scrw7")
|
||||
base_sound_db = -9.0
|
||||
base_sound_db = -12.0
|
||||
embellishments = Array[ExtResource("3_scrw7")]([])
|
||||
metadata/_custom_type_script = "uid://cy1ngx5no67v"
|
||||
|
||||
|
@ -30,8 +30,7 @@ signal sign_mark_offset_updated
|
||||
@export var interacted_sign_texture: Texture2D
|
||||
@export var one_shot := true
|
||||
@export var hide_if_one_shot_played := false
|
||||
# 首次进入 tree 就直接启用
|
||||
@export var on_first_enter_tree := false
|
||||
@export var on_ground_ready := false
|
||||
@export var cooldown_time := 0.5
|
||||
@export var lock_player_on_playing_dialogue = true
|
||||
@export var global_method := ""
|
||||
@ -100,12 +99,11 @@ func _ready() -> void:
|
||||
animation_player.animation_libraries_updated.connect(notify_property_list_changed)
|
||||
_check_sign_status()
|
||||
return
|
||||
SceneManager.ground_ready.connect(_on_ground_ready, CONNECT_ONE_SHOT)
|
||||
# setup default value
|
||||
ground_archive = ArchiveManager.archive.ground_archive()
|
||||
played = ground_archive.get_value(name, "played", false)
|
||||
played_time = 0.0
|
||||
if on_first_enter_tree:
|
||||
_do_trigger.call_deferred()
|
||||
if played:
|
||||
if GlobalConfig.DEBUG:
|
||||
print("Ambush has played, name=", name, " one_shot=", one_shot)
|
||||
@ -127,6 +125,11 @@ func _check_sign_status():
|
||||
sign_mark.display_sign = trigger_mode == "interact"
|
||||
|
||||
|
||||
func _on_ground_ready(_g):
|
||||
if on_ground_ready:
|
||||
_do_trigger.call_deferred()
|
||||
|
||||
|
||||
func _get_animation_player() -> AnimationPlayer:
|
||||
var node = get_parent()
|
||||
while node and not node is Ground2D:
|
||||
|
@ -16,7 +16,7 @@ var speed := 2.0
|
||||
var _tweeked_position := Vector2.ZERO
|
||||
|
||||
var zoom_tween: Tween
|
||||
var focus_offset := Vector2.ZERO
|
||||
var _focus_offset := Vector2.ZERO
|
||||
var shake_ignore_boundary := false
|
||||
|
||||
|
||||
@ -134,13 +134,13 @@ func focus_node(node: Node2D, duration := 0.0) -> void:
|
||||
focusing_node = null
|
||||
return
|
||||
if duration > 0.0:
|
||||
focus_offset = global_position - node.global_position
|
||||
_focus_offset = global_position - node.global_position
|
||||
if tween_focus and tween_focus.is_running():
|
||||
tween_focus.kill()
|
||||
tween_focus = create_tween()
|
||||
(
|
||||
tween_focus
|
||||
. tween_property(self, "focus_offset", Vector2.ZERO, duration)
|
||||
. tween_property(self, "_focus_offset", Vector2.ZERO, duration)
|
||||
. set_trans(Tween.TRANS_SINE)
|
||||
. set_ease(Tween.EASE_IN_OUT)
|
||||
)
|
||||
|
@ -99,14 +99,14 @@ func _on_interactable_bowl_interacted() -> void:
|
||||
await Util.wait(1)
|
||||
DialogueManager.show_dialogue_balloon(dialogue_c01, "c01_s12_鬼差来了")
|
||||
var tween = create_tween()
|
||||
var camera = SceneManager.get_camera_marker()
|
||||
var camera = SceneManager.get_camera_marker() as CameraFocusMarker
|
||||
tween.tween_interval(1.5)
|
||||
tween.tween_property(camera, "focus_offset", Vector2(-100, 0), 2.0)
|
||||
tween.tween_property(camera, "force_offset", Vector2(-100, 0), 2.0)
|
||||
SceneManager.get_player().set_facing_direction(Vector2.LEFT)
|
||||
await DialogueManager.dialogue_ended
|
||||
SceneManager.release_player()
|
||||
tween = create_tween()
|
||||
tween.tween_property(camera, "focus_offset", Vector2(0, 0), 2.0)
|
||||
tween.tween_property(camera, "force_offset", Vector2(0, 0), 2.0)
|
||||
|
||||
|
||||
var ghost_move_tween
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=36 format=3 uid="uid://bol5hl68pbpgq"]
|
||||
[gd_scene load_steps=35 format=3 uid="uid://bol5hl68pbpgq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_llw14"]
|
||||
[ext_resource type="Script" uid="uid://bh4h0e158t1oj" path="res://scene/ground/scene/c01/s12_书店外_诡异版.gd" id="2_krdvw"]
|
||||
@ -29,27 +29,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://b7gyapghy3tsy" path="res://asset/art/neutral_point_light.png" id="17_nta2f"]
|
||||
[ext_resource type="Texture2D" uid="uid://dol25yn3fixim" path="res://asset/art/fog_mask.png" id="19_7jjl5"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_48eje"]
|
||||
resource_name = "intro"
|
||||
tracks/0/type = "method"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimationPlayer")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"intro"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_38lx7"]
|
||||
_data = {
|
||||
&"intro": SubResource("Animation_48eje")
|
||||
}
|
||||
|
||||
[sub_resource type="AudioStreamSynchronized" id="AudioStreamSynchronized_mxf8g"]
|
||||
stream_count = 1
|
||||
@ -104,6 +84,9 @@ debug_global_data = Dictionary[String, Variant]({
|
||||
"player_x": 1500.0
|
||||
})
|
||||
debug_ground_data = Dictionary[String, Variant]({
|
||||
"AmbushIntro": {
|
||||
"played": false
|
||||
},
|
||||
"AmbushSuccess": {
|
||||
"played": false
|
||||
},
|
||||
@ -120,7 +103,7 @@ debug_ground_data = Dictionary[String, Variant]({
|
||||
"interacted_times": 0
|
||||
}
|
||||
})
|
||||
oneshot_animation = "intro"
|
||||
oneshot_animation = ""
|
||||
|
||||
[node name="BgmControl" type="Node" parent="Ground/AnimationPlayer" index="0"]
|
||||
script = ExtResource("3_p7n7n")
|
||||
@ -161,7 +144,11 @@ target_scene = "c01_s09"
|
||||
position = Vector2(1, 0)
|
||||
target_scene = "c01_s08"
|
||||
|
||||
[node name="portal_2" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_o7hfk")]
|
||||
[node name="AmbushIntro" parent="Ground/DeployLayer" index="2" instance=ExtResource("9_nqlku")]
|
||||
on_ground_ready = true
|
||||
hook_method = "intro"
|
||||
|
||||
[node name="portal_2" parent="Ground/DeployLayer" index="3" instance=ExtResource("4_o7hfk")]
|
||||
position = Vector2(995, 28)
|
||||
debug_note = "c01_s12 的 2 号门通往书店"
|
||||
portal_name = "2"
|
||||
@ -169,11 +156,11 @@ target_scene = "c01_s08"
|
||||
target_portal = "left"
|
||||
status = "opened"
|
||||
|
||||
[node name="背景" type="Sprite2D" parent="Ground/DeployLayer" index="3"]
|
||||
[node name="背景" type="Sprite2D" parent="Ground/DeployLayer" index="4"]
|
||||
position = Vector2(1786, 5)
|
||||
texture = ExtResource("4_c1x3p")
|
||||
|
||||
[node name="自动枯萎的花朵" parent="Ground/DeployLayer" index="4" node_paths=PackedStringArray("focus_node") instance=ExtResource("7_aq8vg")]
|
||||
[node name="自动枯萎的花朵" parent="Ground/DeployLayer" index="5" node_paths=PackedStringArray("focus_node") instance=ExtResource("7_aq8vg")]
|
||||
position = Vector2(-9, 87)
|
||||
focus_node = NodePath("../Ghost")
|
||||
total_num = 350
|
||||
@ -186,7 +173,7 @@ action_area = Vector2(3100, 40)
|
||||
move_speed = 100.0
|
||||
scatter_on_start = true
|
||||
|
||||
[node name="Ghost" parent="Ground/DeployLayer" index="5" instance=ExtResource("8_gk0gq")]
|
||||
[node name="Ghost" parent="Ground/DeployLayer" index="6" instance=ExtResource("8_gk0gq")]
|
||||
visible = false
|
||||
z_index = 10
|
||||
position = Vector2(1127, 28)
|
||||
@ -202,11 +189,11 @@ max_distance = 1500.0
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("10_1tspp")
|
||||
|
||||
[node name="飘动的寻人启事" parent="Ground/DeployLayer" index="6" instance=ExtResource("11_pwu7i")]
|
||||
[node name="飘动的寻人启事" parent="Ground/DeployLayer" index="7" instance=ExtResource("11_pwu7i")]
|
||||
z_index = 6
|
||||
position = Vector2(1021, -48)
|
||||
|
||||
[node name="陆仁舞刀" parent="Ground/DeployLayer" index="7" instance=ExtResource("14_ct084")]
|
||||
[node name="陆仁舞刀" parent="Ground/DeployLayer" index="8" instance=ExtResource("14_ct084")]
|
||||
position = Vector2(1748, 6)
|
||||
sprite_frames = ExtResource("13_lucm6")
|
||||
animation = &"陆仁擦刀"
|
||||
@ -218,12 +205,12 @@ action_configs = Array[Dictionary]([{
|
||||
"intro_loop": 1
|
||||
}])
|
||||
|
||||
[node name="其余小孩" parent="Ground/DeployLayer" index="8" instance=ExtResource("14_ct084")]
|
||||
[node name="其余小孩" parent="Ground/DeployLayer" index="9" instance=ExtResource("14_ct084")]
|
||||
position = Vector2(1911, 12)
|
||||
sprite_frames = ExtResource("14_7jjl5")
|
||||
animation = &"夜晚其余小孩杂耍"
|
||||
autoplay = "夜晚其余小孩杂耍"
|
||||
frame = 2
|
||||
frame = 1
|
||||
action_configs = Array[Dictionary]([{
|
||||
"animation_intro": "夜晚其余小孩杂耍到害怕过渡",
|
||||
&"animation_next": "夜晚其余小孩害怕",
|
||||
@ -231,12 +218,11 @@ action_configs = Array[Dictionary]([{
|
||||
"intro_loop": 1
|
||||
}])
|
||||
|
||||
[node name="举腿小孩" parent="Ground/DeployLayer" index="9" instance=ExtResource("14_ct084")]
|
||||
[node name="举腿小孩" parent="Ground/DeployLayer" index="10" instance=ExtResource("14_ct084")]
|
||||
position = Vector2(1822, 6)
|
||||
sprite_frames = ExtResource("14_7jjl5")
|
||||
animation = &"夜晚举腿小孩杂耍"
|
||||
autoplay = "夜晚举腿小孩杂耍"
|
||||
frame = 1
|
||||
action_configs = Array[Dictionary]([{
|
||||
"animation_intro": "夜晚举腿小孩杂耍到害怕过渡",
|
||||
"animation_next": "夜晚举腿小孩害怕",
|
||||
@ -244,7 +230,7 @@ action_configs = Array[Dictionary]([{
|
||||
"intro_loop": 1
|
||||
}])
|
||||
|
||||
[node name="举碗小孩" parent="Ground/DeployLayer" index="10" instance=ExtResource("14_ct084")]
|
||||
[node name="举碗小孩" parent="Ground/DeployLayer" index="11" instance=ExtResource("14_ct084")]
|
||||
position = Vector2(1792, 9)
|
||||
sprite_frames = ExtResource("13_lucm6")
|
||||
animation = &"杂戏团夜晚_小孩举碗呼吸"
|
||||
@ -273,7 +259,7 @@ enabled = false
|
||||
disable_prop_after_interacted = true
|
||||
prop_key = "prop_银元"
|
||||
|
||||
[node name="Fog" parent="Ground/DeployLayer" index="11" instance=ExtResource("15_pvvjq")]
|
||||
[node name="Fog" parent="Ground/DeployLayer" index="12" instance=ExtResource("15_pvvjq")]
|
||||
z_index = 10
|
||||
material = SubResource("ShaderMaterial_7jjl5")
|
||||
position = Vector2(3131, -50)
|
||||
|
@ -793,7 +793,7 @@ position = Vector2(29, -3)
|
||||
sprite_frames = ExtResource("34_1tart")
|
||||
animation = &"小婵_被霸凌"
|
||||
autoplay = "小婵_被霸凌"
|
||||
frame = 1
|
||||
frame = 4
|
||||
|
||||
[node name="f1" parent="Ground/DeployLayer/霸凌" instance=ExtResource("33_ycojw")]
|
||||
z_index = 10
|
||||
@ -801,7 +801,6 @@ position = Vector2(-11, 1)
|
||||
sprite_frames = ExtResource("34_1tart")
|
||||
animation = &"霸凌1"
|
||||
autoplay = "霸凌1"
|
||||
frame = 9
|
||||
|
||||
[node name="Sfx2D霸凌童谣" type="AudioStreamPlayer2D" parent="Ground/DeployLayer/霸凌/f1"]
|
||||
stream = ExtResource("46_qqdxs")
|
||||
@ -818,7 +817,6 @@ position = Vector2(23, 11)
|
||||
sprite_frames = ExtResource("34_1tart")
|
||||
animation = &"霸凌2"
|
||||
autoplay = "霸凌2"
|
||||
frame = 9
|
||||
|
||||
[node name="f3" parent="Ground/DeployLayer/霸凌" instance=ExtResource("33_ycojw")]
|
||||
z_index = 10
|
||||
@ -826,7 +824,6 @@ position = Vector2(57, 7)
|
||||
sprite_frames = ExtResource("34_1tart")
|
||||
animation = &"霸凌3"
|
||||
autoplay = "霸凌3"
|
||||
frame = 2
|
||||
|
||||
[node name="Ambush点火游戏阻挡右移" parent="Ground/DeployLayer/霸凌" instance=ExtResource("25_iyaiw")]
|
||||
position = Vector2(-116, -13)
|
||||
@ -1015,7 +1012,6 @@ position = Vector2(2229, 41)
|
||||
sprite_frames = ExtResource("34_1tart")
|
||||
animation = &"霸凌3-发抖"
|
||||
autoplay = "霸凌3-发抖"
|
||||
frame = 1
|
||||
|
||||
[node name="Pro小孩喊着火啦3" parent="Ground/DeployLayer/火灾" instance=ExtResource("33_ycojw")]
|
||||
z_index = 9
|
||||
@ -1074,7 +1070,7 @@ z_index = 5
|
||||
position = Vector2(17, -11)
|
||||
sprite_frames = ExtResource("39_rnk1v")
|
||||
animation = &"吕萍牵手动作"
|
||||
frame = 5
|
||||
frame = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/DeployLayer/火灾/牵手跑"]
|
||||
shape = SubResource("RectangleShape2D_vddfx")
|
||||
|
@ -264,7 +264,7 @@ range_item_cull_mask = 4
|
||||
texture = ExtResource("8_mrltr")
|
||||
|
||||
[node name="Closeup戏台" parent="Ground/DeployLayer" index="7" instance=ExtResource("10_2yvhw")]
|
||||
position = Vector2(320, 23)
|
||||
position = Vector2(305, -249)
|
||||
packed_scene = ExtResource("11_2yvhw")
|
||||
first_interact_os_key = "c02_一楼戏台"
|
||||
|
||||
@ -358,7 +358,7 @@ position = Vector2(-180, 5)
|
||||
sprite_frames = ExtResource("7_mrltr")
|
||||
animation = &"小蝉背对转头"
|
||||
autoplay = "小蝉背对呼吸帧"
|
||||
frame = 3
|
||||
frame = 5
|
||||
flip_h = true
|
||||
|
||||
[node name="Event2D小蝉哼歌" type="Node2D" parent="Ground/DeployLayer" index="18"]
|
||||
|
@ -59,12 +59,23 @@ func _on_button_pressed() -> void:
|
||||
button.disabled = true
|
||||
# 肉落下的声音,然后自动退出界面
|
||||
SceneManager.pop_debug_dialog_info("音效", "肉落下的声音(敲门游戏成功)")
|
||||
quitting = true
|
||||
await Util.wait(2)
|
||||
exit.emit(true)
|
||||
else:
|
||||
SceneManager.pop_debug_dialog_info("音效", "敲门:" + str(current_id))
|
||||
|
||||
|
||||
var quitting = false
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("escape") or event.is_action_pressed("cancel"):
|
||||
if quitting:
|
||||
# 禁止手动退出,需要 exit.emit(true)
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func failed():
|
||||
current_id = 0
|
||||
knock_wrong_sfx.play()
|
||||
|
@ -90,8 +90,8 @@ func _shuffle_books() -> void:
|
||||
selected_book = NON_SELECTED
|
||||
suffling = true
|
||||
rand_from_seed(Time.get_ticks_usec())
|
||||
# 猫 2 次
|
||||
var shuffle_times = 2
|
||||
# 打乱偶数次有可能复原,需要打乱奇数次;为降低难度,仅打乱一次
|
||||
var shuffle_times = 1
|
||||
var r_size = current_answer[0].size()
|
||||
for _i in range(shuffle_times):
|
||||
var col_1 = randi() % r_size
|
||||
@ -99,8 +99,6 @@ func _shuffle_books() -> void:
|
||||
selected_book = [0, col_1]
|
||||
_interchange_book(0, col_2, false)
|
||||
_relocate_books(0)
|
||||
# 其他 2 次
|
||||
shuffle_times = 2
|
||||
r_size = current_answer[1].size()
|
||||
for _i in range(shuffle_times):
|
||||
var col_1 = randi() % r_size
|
||||
@ -120,9 +118,13 @@ func _shuffle_books() -> void:
|
||||
suffling = false
|
||||
|
||||
|
||||
var press_mutex := Mutex.new()
|
||||
|
||||
|
||||
func _on_book_pressed(row: int, id: int) -> void:
|
||||
if gameover or row_correct_status[row]:
|
||||
return
|
||||
press_mutex.lock()
|
||||
var col = current_answer[row].find(id)
|
||||
if selected_book == NON_SELECTED:
|
||||
selected_book = [row, col]
|
||||
@ -133,6 +135,7 @@ func _on_book_pressed(row: int, id: int) -> void:
|
||||
_interchange_book(row, col)
|
||||
else:
|
||||
selected_book = [row, col]
|
||||
press_mutex.unlock()
|
||||
|
||||
|
||||
func _on_book_hover(hover: bool, row: int, btn: TextureButton) -> void:
|
||||
|
@ -220,7 +220,7 @@ scale = Vector2(1.18271, 1.36673)
|
||||
texture = ExtResource("11_dohnv")
|
||||
|
||||
[node name="Event_handnote_c02_二楼地图" type="Sprite2D" parent="Bag/Book/Event_handnote_chapter_stage"]
|
||||
position = Vector2(313.333, -143.333)
|
||||
position = Vector2(409, -175.5)
|
||||
texture = ExtResource("20_0me01")
|
||||
script = ExtResource("7_nfxph")
|
||||
event = &"handnote_c02_map_2"
|
||||
@ -228,7 +228,7 @@ hide_if_on_stage = Array[int]([0, 3])
|
||||
metadata/_custom_type_script = "uid://c5woj7mivdxrh"
|
||||
|
||||
[node name="Event_handnote_c02_hand_requireCoin" type="Sprite2D" parent="Bag/Book/Event_handnote_chapter_stage"]
|
||||
position = Vector2(590, -95)
|
||||
position = Vector2(685.667, -127.167)
|
||||
scale = Vector2(0.7, 0.7)
|
||||
texture = ExtResource("21_x45ak")
|
||||
script = ExtResource("7_nfxph")
|
||||
@ -242,7 +242,7 @@ scale = Vector2(1.03957, 1.62217)
|
||||
texture = ExtResource("11_dohnv")
|
||||
|
||||
[node name="Event_handnote_c02_shoe_giveToMouce" type="Sprite2D" parent="Bag/Book/Event_handnote_chapter_stage"]
|
||||
position = Vector2(220, -160)
|
||||
position = Vector2(315.667, -192.167)
|
||||
scale = Vector2(0.7, 0.7)
|
||||
texture = ExtResource("15_60qdw")
|
||||
script = ExtResource("7_nfxph")
|
||||
@ -256,7 +256,6 @@ scale = Vector2(1.19114, 1.20576)
|
||||
texture = ExtResource("11_dohnv")
|
||||
|
||||
[node name="Event_handnote_chapter_stage2" type="Sprite2D" parent="Bag/Book"]
|
||||
visible = false
|
||||
position = Vector2(340, 137)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
script = ExtResource("5_nk0pj")
|
||||
@ -339,7 +338,7 @@ hide_if_on_stage = Array[int]([0, 3])
|
||||
metadata/_custom_type_script = "uid://c5woj7mivdxrh"
|
||||
|
||||
[node name="Event_handnote_c02_二楼地图" type="Sprite2D" parent="Bag/Book/Event_handnote_chapter_stage2"]
|
||||
position = Vector2(313.333, -143.333)
|
||||
position = Vector2(409, -175.5)
|
||||
texture = ExtResource("20_0me01")
|
||||
script = ExtResource("7_nfxph")
|
||||
event = &"handnote_c02_map_2"
|
||||
|
Loading…
Reference in New Issue
Block a user