diff --git a/scenes/phrases_menu_single_phrase.tscn b/scenes/phrases_menu_single_phrase.tscn index 4acdf84..0f4c406 100644 --- a/scenes/phrases_menu_single_phrase.tscn +++ b/scenes/phrases_menu_single_phrase.tscn @@ -22,6 +22,13 @@ offset_bottom = 16.0 clip_text = true text_overrun_behavior = 3 +[node name="LabelButton" type="TextureButton" parent="."] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 1.143 +offset_right = -48.032 +offset_bottom = 16.0 + [node name="RemoveButton" type="TextureButton" parent="."] layout_mode = 2 anchor_left = 1.036 @@ -32,4 +39,5 @@ offset_bottom = 16.0 texture_normal = ExtResource("2_cv30m") stretch_mode = 0 +[connection signal="pressed" from="LabelButton" to="." method="_on_label_button_pressed"] [connection signal="pressed" from="RemoveButton" to="." method="_on_remove_button_pressed"] diff --git a/src/global/CoreGameplayManager.gd b/src/global/CoreGameplayManager.gd index 2a14529..3a79223 100644 --- a/src/global/CoreGameplayManager.gd +++ b/src/global/CoreGameplayManager.gd @@ -56,6 +56,14 @@ func next_phrase() -> void: current_phrase = phrases_last_ts[phrases_last_ts_keys.min()] current_status = STATUS_PLEASE_REPEAT +func try_overwrite_next_phrase(p: String): + if p in PhrasesManager.phrases: + current_phrase = p + current_status = STATUS_PLEASE_REPEAT + else: + # if this didn't work, choose one automatically + next_phrase() + func cleanup_last_played_phrases(): var changed = false # remove phrases that don't exist anymore diff --git a/src/ui/phrases_menu_phrase.gd b/src/ui/phrases_menu_phrase.gd index 01b32e4..5779008 100644 --- a/src/ui/phrases_menu_phrase.gd +++ b/src/ui/phrases_menu_phrase.gd @@ -8,3 +8,6 @@ var text: String: func _on_remove_button_pressed() -> void: PhrasesManager.remove_phrase(text) + +func _on_label_button_pressed() -> void: + CoreGameplayManager.try_overwrite_next_phrase(text)