diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index 2a4b447..13e540a 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -17,7 +17,7 @@ var board_was_completed: bool = false var current_context : int = NAVIGATE var selection_state : SelectionState -@onready var instructions := $instructions_panel/HBoxContainer/cards_remaining +#@onready var instructions := $instructions_panel/HBoxContainer/cards_remaining @onready var dropzone : Control = %CardZone @onready var notezone : Control = %NoteZone @@ -32,6 +32,7 @@ func _ready() -> void: _delayed_ready.call_deferred() + # We need to wait for our room further up our parent hierarchy to actually make itself known # for interactables to do things with it, e.g. CardBoard needs to register itself func _delayed_ready() ->void: @@ -40,17 +41,31 @@ func _delayed_ready() ->void: board_room.card_board = self +## Updates prompt label based on the interaction type and collected state +func _show_prompt() -> void: + var overrides : Array[StringName] = [&"menu_back"] + P.left_bottom(P.pick(&"ui_cancel"), overrides) + P.instruction(I18n.get_memento_prompt(mementos_collected)) + P.performed.connect(_perform) + + +func _hide_prompt(): + P.performed.disconnect(_perform) + P.clear() + + func play(): + _show_prompt() check_board_completion() await closed print("CardBoard.gd: closing") _finalize_board_state() + _hide_prompt() var mementos_collected: int = 0: set(mementos): mementos_collected = mementos - instructions.text = I18n.get_memento_prompt(mementos_collected) var selection: Draggable = null: @@ -302,7 +317,7 @@ func give_lore_feedback(): fitting_card_count += int(child.card_id == child.get_attached_note().parent_id) if float(fitting_card_count) / float(total_card_count) < 0.2: - instructions.text = "You can move on, but you may not have understood Lisa." + P.instruction("You can move on, but you may not have understood Lisa.") if not unfitting: if State.speech_language == 2: $AnimationPlayer.play("unfitting_de") @@ -310,7 +325,7 @@ func give_lore_feedback(): $AnimationPlayer.play("unfitting") unfitting = true elif fitting_card_count < total_card_count: - instructions.text = TranslationServer.translate("You may leave the room, but Lisa only agrees with %d of the %d connections.") % [fitting_card_count, total_card_count] + P.instruction(TranslationServer.translate("You may leave the room, but Lisa only agrees with %d of the %d connections.") % [fitting_card_count, total_card_count]) if not incomplete: if State.speech_language == 2: $AnimationPlayer.play("incomplete_de") @@ -318,7 +333,7 @@ func give_lore_feedback(): $AnimationPlayer.play("incomplete") incomplete = true else: - instructions.text = "Lisa would like you to leave her room and move on." + P.instruction("Lisa would like you to leave her room and move on.") if not complete: if State.speech_language == 2: $AnimationPlayer.play("complete_de") @@ -387,13 +402,13 @@ func handle_drop(draggable: Draggable) -> int: return Draggable.DropResult.ACCEPTED +func _perform(action : StringName) -> void: + match action: + &"ui_cancel": closed.emit() + + # Takes the inputs for control inputs func _input(event : InputEvent) -> void: - if event.is_action_pressed("ui_cancel"): - print("CardBoard.gd: ui_cancel") - closed.emit() - get_viewport().set_input_as_handled() - if selection and not selection.is_dragged and event is InputEventMouseMotion and not event.is_action_pressed("mouse_left"): var candidate := _nearest_hovered(_sort_by_proximity_and_depth(notes)) if not candidate: diff --git a/src/logic-scenes/board/physics-board.tscn b/src/logic-scenes/board/physics-board.tscn index ca58cfb..3becb63 100644 --- a/src/logic-scenes/board/physics-board.tscn +++ b/src/logic-scenes/board/physics-board.tscn @@ -176,32 +176,6 @@ custom_minimum_size = Vector2(400, 0) layout_mode = 2 mouse_filter = 1 -[node name="instructions_panel" type="PanelContainer" parent="."] -z_index = 100 -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 0 -mouse_filter = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="instructions_panel"] -layout_mode = 2 -mouse_filter = 2 - -[node name="VSeparator2" type="VSeparator" parent="instructions_panel/HBoxContainer"] -custom_minimum_size = Vector2(15, 0) -layout_mode = 2 - -[node name="cards_remaining" type="Label" parent="instructions_panel/HBoxContainer"] -layout_mode = 2 -size_flags_vertical = 0 -text = "Collect all four Mementos to fill the mind-board. " -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="VSeparator" type="VSeparator" parent="instructions_panel/HBoxContainer"] -custom_minimum_size = Vector2(15, 0) -layout_mode = 2 - [node name="Timer" type="Timer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."] diff --git a/src/logic-scenes/interactable/interactable.gd b/src/logic-scenes/interactable/interactable.gd index af61a42..e116a5b 100644 --- a/src/logic-scenes/interactable/interactable.gd +++ b/src/logic-scenes/interactable/interactable.gd @@ -180,7 +180,6 @@ func interact() -> void: ## Updates prompt label based on the interaction type and collected state func _show_prompt() -> void: - var overrides : Array[StringName] = [] if playable is StoryPlayable: P.interaction(I18n.get_scene_caption(playable.scene_id))