diff --git a/asset/art/ui/chess.png b/asset/art/ui/chess.png index 93d37ee7..1c483845 100644 Binary files a/asset/art/ui/chess.png and b/asset/art/ui/chess.png differ diff --git a/asset/art/ui/journal.aseprite b/asset/art/ui/journal.aseprite index 2ea1c145..73b49ef1 100644 Binary files a/asset/art/ui/journal.aseprite and b/asset/art/ui/journal.aseprite differ diff --git a/scene/entity/ux/sign.gd b/scene/entity/ux/sign.gd index b731b12f..34eb1a9c 100644 --- a/scene/entity/ux/sign.gd +++ b/scene/entity/ux/sign.gd @@ -22,13 +22,11 @@ signal cancel # 同时只能有一个物品被激活交互态,其他物品进入等待队列 static var occupied: NodePath -# 使用互斥锁保证线程安全 +static var _pending_activate_sign := [] as Array[NodePath] +# 使用互斥锁保证线程安全。在操作 occupied 或 _pending_activate_sign 时需要先锁定,操作完成后解锁 static var mutex = Mutex.new() -static var _pending_callables: Array[Callable] -var own_callable var activated = false - # var sprite2d = Sprite2D.new() var base_scale = Vector2.ONE @@ -54,12 +52,16 @@ func _ready() -> void: func activate(_body: Node2D) -> void: # point_light.energy = 1.0 + if not is_node_ready(): + await ready + var path := get_path() mutex.lock() - if occupied and occupied != get_path(): - own_callable = activate.bind(_body) - _pending_callables.append(own_callable) + if occupied and occupied != path: + _pending_activate_sign.append(path) + mutex.unlock() + return else: - occupied = get_path() + occupied = path activated = true mutex.unlock() if activated and show_sign: @@ -71,13 +73,23 @@ func activate(_body: Node2D) -> void: func disactivate(_body: Node2D) -> void: - activated = false - if _unoccupy(): - while _pending_callables.size() > 0: - var callable = _pending_callables.pop_front() as Callable - if callable.is_valid(): - callable.call() + mutex.lock() + if activated: + if occupied == get_path(): + occupied = "" + while _pending_activate_sign.size() > 0: + var path = _pending_activate_sign.pop_front() + var _sign = get_node_or_null(path) + if _sign: + _sign.activate(null) break + else: + # make sure the sign is not in the pending list + _pending_activate_sign.erase(get_path()) + # double check. because the sign may be activated by other body + if activated: + disactivate(_body) + mutex.unlock() # point_light.energy = 0.0 if show_sign: create_tween().tween_property(self, "modulate:a", 0.0, 0.2) @@ -90,26 +102,3 @@ func _unhandled_input(event: InputEvent) -> void: elif event.is_action_pressed("cancel"): cancel.emit() get_viewport().set_input_as_handled() - - -func _exit_tree() -> void: - if _unoccupy(): - while _pending_callables.size() > 0: - var callable = _pending_callables.pop_front() as Callable - if callable.is_valid(): - callable.call() - break - cancel.emit() - - -func _unoccupy() -> bool: - var self_occupied = false - mutex.lock() - if occupied == get_path(): - occupied = "" - self_occupied = true - elif own_callable: - _pending_callables.erase(own_callable) - own_callable = null - mutex.unlock() - return self_occupied diff --git a/scene/ground/scene/c02/s02_走道.tscn b/scene/ground/scene/c02/s02_走道.tscn index 7f2e4bd8..fb8b62b3 100644 --- a/scene/ground/scene/c02/s02_走道.tscn +++ b/scene/ground/scene/c02/s02_走道.tscn @@ -60,7 +60,17 @@ inspection_note = "据闻奉贤县分水墩又有七人染受鼠疫,病状可 《申报》 民国五年一月十三日" -[node name="纸人" parent="Ground/DeployLayer" index="4" instance=ExtResource("5_nhtbp")] +[node name="鼠疫海报local" parent="Ground/DeployLayer" index="4" instance=ExtResource("12_0fckv")] +position = Vector2(387, -25) +entity_title = "鼠疫海报" +texture_cover = ExtResource("7_wdwbi") +inspection_note = "据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。 +有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。 + +《申报》 +民国五年一月十三日" + +[node name="纸人" parent="Ground/DeployLayer" index="5" instance=ExtResource("5_nhtbp")] position = Vector2(601, 44) texture = ExtResource("7_xsghn") flip_h = true @@ -72,11 +82,11 @@ collision_mask = 0 [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/DeployLayer/纸人/StaticBody2D"] shape = SubResource("RectangleShape2D_0xrg2") -[node name="Ambush" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_70vqn")] -position = Vector2(434, 60) +[node name="Ambush" parent="Ground/DeployLayer" index="6" instance=ExtResource("6_70vqn")] +position = Vector2(502, 56) hook_cg = "c02_胖子说话" -[node name="HdEntity" parent="Ground/DeployLayer" index="6" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("10_3c313")] +[node name="HdEntity" parent="Ground/DeployLayer" index="7" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("10_3c313")] position = Vector2(147, 75) sprite_name = "car" texture = ExtResource("11_x0h3x") @@ -88,16 +98,6 @@ position = Vector2(1, -28) [node name="CollisionShape2D" parent="Ground/DeployLayer/HdEntity/Area2D" index="0"] shape = SubResource("RectangleShape2D_3qhvr") -[node name="LocalInspectable" parent="Ground/DeployLayer" index="7" instance=ExtResource("12_0fckv")] -position = Vector2(387, -25) -entity_title = "鼠疫海报" -texture_cover = ExtResource("7_wdwbi") -inspection_note = "据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。 -有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。 - -《申报》 -民国五年一月十三日" - [node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"] texture = null diff --git a/scene/ground/scene/c02/s03_院子切换.tscn b/scene/ground/scene/c02/s03_院子切换.tscn index b1890515..0a5bbc6b 100644 --- a/scene/ground/scene/c02/s03_院子切换.tscn +++ b/scene/ground/scene/c02/s03_院子切换.tscn @@ -30,7 +30,7 @@ normal_texture = ExtResource("4_nef6w") [node name="Ground" parent="." instance=ExtResource("1_lheeb")] scene_config = SubResource("Resource_vdo00") -[node name="BGSprite2D" parent="Ground" index="0"] +[node name="BGSprite2D" parent="Ground" index="1"] texture = SubResource("CanvasTexture_41q0k") [node name="PortalLeft" parent="Ground/DeployLayer" index="0"] @@ -78,7 +78,7 @@ texture = ExtResource("7_icddm") position = Vector2(-12, -143) scale = Vector2(1.08, 1.08) -[node name="DirectionalLight2D" parent="Ground" index="5"] +[node name="DirectionalLight2D" parent="Ground" index="6"] color = Color(0.368627, 0.447059, 0.882353, 1) [editable path="Ground"] diff --git a/scene/journal/journal.gd b/scene/journal/journal.gd index bef8e884..01ef2361 100644 --- a/scene/journal/journal.gd +++ b/scene/journal/journal.gd @@ -38,6 +38,12 @@ var items_dict := {} func _ready() -> void: reload() + if GlobalConfig.DEBUG: + locked = false + display = true + else: + locked = true + display = false _toggle_display(false) diff --git a/scene/journal/journal.tscn b/scene/journal/journal.tscn index 1c5fa4f3..152b84fe 100644 --- a/scene/journal/journal.tscn +++ b/scene/journal/journal.tscn @@ -18,7 +18,7 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_y2537") -locked = true +tip_content = "哆莱米发索拉西123456789" [node name="JournalPage" type="TextureRect" parent="JournalRoot"] show_behind_parent = true diff --git a/scene/main.tscn b/scene/main.tscn index 9b3c7817..d13999a6 100644 --- a/scene/main.tscn +++ b/scene/main.tscn @@ -20,7 +20,7 @@ environment = ExtResource("9_jsof5") [node name="GroundLoader" parent="." instance=ExtResource("10_8rc5n")] position = Vector2(1, 0) ignore_archive = true -current_scene = "c01_s05" +current_scene = "c02_s02" [node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")] unique_name_in_owner = true @@ -97,3 +97,4 @@ scale = Vector2(0.24, 0.24) metadata/_edit_use_anchors_ = true [node name="Journal" parent="." instance=ExtResource("10_durpa")] +visible = false