Allow selecting a phrase from the list for the currently asked phrase
This commit is contained in:
parent
18cc93cad5
commit
83d213e135
3 changed files with 19 additions and 0 deletions
|
@ -22,6 +22,13 @@ offset_bottom = 16.0
|
||||||
clip_text = true
|
clip_text = true
|
||||||
text_overrun_behavior = 3
|
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="."]
|
[node name="RemoveButton" type="TextureButton" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
anchor_left = 1.036
|
anchor_left = 1.036
|
||||||
|
@ -32,4 +39,5 @@ offset_bottom = 16.0
|
||||||
texture_normal = ExtResource("2_cv30m")
|
texture_normal = ExtResource("2_cv30m")
|
||||||
stretch_mode = 0
|
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"]
|
[connection signal="pressed" from="RemoveButton" to="." method="_on_remove_button_pressed"]
|
||||||
|
|
|
@ -56,6 +56,14 @@ func next_phrase() -> void:
|
||||||
current_phrase = phrases_last_ts[phrases_last_ts_keys.min()]
|
current_phrase = phrases_last_ts[phrases_last_ts_keys.min()]
|
||||||
current_status = STATUS_PLEASE_REPEAT
|
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():
|
func cleanup_last_played_phrases():
|
||||||
var changed = false
|
var changed = false
|
||||||
# remove phrases that don't exist anymore
|
# remove phrases that don't exist anymore
|
||||||
|
|
|
@ -8,3 +8,6 @@ var text: String:
|
||||||
|
|
||||||
func _on_remove_button_pressed() -> void:
|
func _on_remove_button_pressed() -> void:
|
||||||
PhrasesManager.remove_phrase(text)
|
PhrasesManager.remove_phrase(text)
|
||||||
|
|
||||||
|
func _on_label_button_pressed() -> void:
|
||||||
|
CoreGameplayManager.try_overwrite_next_phrase(text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue