Fix TTS calls
This commit is contained in:
parent
79ca532d63
commit
1f83933177
4 changed files with 58 additions and 25 deletions
|
|
@ -7,22 +7,22 @@ signal auctioneer_bark
|
||||||
func _on_great_buy_button_down() -> void:
|
func _on_great_buy_button_down() -> void:
|
||||||
auctioneer_bark.emit()
|
auctioneer_bark.emit()
|
||||||
$GreatBuy.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
$GreatBuy.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
||||||
turn_manager.speak("Great buy!", bark_speed)
|
turn_manager.speak_bark("Great buy!", bark_speed)
|
||||||
|
|
||||||
func _on_investment_piece_button_down() -> void:
|
func _on_investment_piece_button_down() -> void:
|
||||||
auctioneer_bark.emit()
|
auctioneer_bark.emit()
|
||||||
$InvestmentPiece.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
$InvestmentPiece.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
||||||
turn_manager.speak("Investment piece!", bark_speed)
|
turn_manager.speak_bark("Investment piece!", bark_speed)
|
||||||
|
|
||||||
func _on_stunning_message_button_down() -> void:
|
func _on_stunning_message_button_down() -> void:
|
||||||
auctioneer_bark.emit()
|
auctioneer_bark.emit()
|
||||||
$StunningMessage.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
$StunningMessage.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
||||||
turn_manager.speak("Stunning message!", bark_speed)
|
turn_manager.speak_bark("Stunning message!", bark_speed)
|
||||||
|
|
||||||
func _on_innovative_artist_button_down() -> void:
|
func _on_innovative_artist_button_down() -> void:
|
||||||
auctioneer_bark.emit()
|
auctioneer_bark.emit()
|
||||||
$InnovativeArtist.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
$InnovativeArtist.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
||||||
turn_manager.speak("Innovative artist!", bark_speed)
|
turn_manager.speak_bark("Innovative artist!", bark_speed)
|
||||||
|
|
||||||
|
|
||||||
func _on_great_buy_button_release() -> void:
|
func _on_great_buy_button_release() -> void:
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
var intro_msg := "You have %s paintings. Sell them fast for at least $%s or face the consequences!" % [PAINTINGS_TOTAL, target_sales]
|
var intro_msg := "You have %s paintings. Sell them fast for at least $%s or face the consequences!" % [PAINTINGS_TOTAL, target_sales]
|
||||||
intro_msg += "\nHit the gavel and input the starting price to begin!"
|
intro_msg += "\nHit the gavel and input the starting price to begin!"
|
||||||
turn_manager.speak(intro_msg)
|
turn_manager.speak_sentence(intro_msg)
|
||||||
|
|
||||||
#build out the initialization process, which should:
|
#build out the initialization process, which should:
|
||||||
# -- generate paintings and assign values
|
# -- generate paintings and assign values
|
||||||
|
|
@ -80,10 +80,10 @@ func destroy_painting():
|
||||||
cancel_bidding()
|
cancel_bidding()
|
||||||
get_painting_display().move_painting_to_pile(%PaintingPileDiscard)
|
get_painting_display().move_painting_to_pile(%PaintingPileDiscard)
|
||||||
next_painting()
|
next_painting()
|
||||||
turn_manager.speak("Oh nooooooo! Took too long!\nTry to make it up on the next painting!")
|
turn_manager.speak_sentence("Oh nooooooo! Took too long!\nTry to make it up on the next painting!")
|
||||||
else:
|
else:
|
||||||
turn_manager.restart_turn()
|
turn_manager.restart_turn()
|
||||||
turn_manager.speak("Oops! Took too long! Quickly, try again!")
|
turn_manager.speak_sentence("Oops! Took too long! Quickly, try again!")
|
||||||
|
|
||||||
|
|
||||||
func sell_painting():
|
func sell_painting():
|
||||||
|
|
@ -91,7 +91,7 @@ func sell_painting():
|
||||||
move_painting_to_bidders_pile()
|
move_painting_to_bidders_pile()
|
||||||
paintings[current_painting_idx].sold_for = current_bid
|
paintings[current_painting_idx].sold_for = current_bid
|
||||||
current_bid_display.set_text("Sold for $%s!" % [current_bid])
|
current_bid_display.set_text("Sold for $%s!" % [current_bid])
|
||||||
turn_manager.speak("Sold for $%s!" % [current_bid])
|
turn_manager.speak_sentence("Sold for $%s!" % [current_bid])
|
||||||
print("Congrats on selling your painting for $%s! You have made $%s so far." % [current_bid, get_total_sales()])
|
print("Congrats on selling your painting for $%s! You have made $%s so far." % [current_bid, get_total_sales()])
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -122,11 +122,11 @@ func end_auction():
|
||||||
#add in logic for displaying/transitioning to score screen
|
#add in logic for displaying/transitioning to score screen
|
||||||
if get_total_sales() >= target_sales:
|
if get_total_sales() >= target_sales:
|
||||||
#add context specific score text?
|
#add context specific score text?
|
||||||
turn_manager.speak("Congratulations! The auction house will run another day.")
|
turn_manager.speak_sentence("Congratulations! The auction house will run another day.")
|
||||||
emit_signal("won")
|
emit_signal("won")
|
||||||
else:
|
else:
|
||||||
#add context specific score text?
|
#add context specific score text?
|
||||||
turn_manager.speak("You have failed. We must find a new auctioneer.")
|
turn_manager.speak_sentence("You have failed. We must find a new auctioneer.")
|
||||||
emit_signal("lost")
|
emit_signal("lost")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,8 +159,6 @@ class PaintingInfo:
|
||||||
var is_sold: bool:
|
var is_sold: bool:
|
||||||
get(): return sold_for > 0
|
get(): return sold_for > 0
|
||||||
|
|
||||||
>> >> >> > wip_astra137
|
|
||||||
|
|
||||||
# OTHER THINGS TO ADD:
|
# OTHER THINGS TO ADD:
|
||||||
# UI elements for score
|
# UI elements for score
|
||||||
# Bark manager
|
# Bark manager
|
||||||
|
|
|
||||||
30
main.tscn
30
main.tscn
|
|
@ -195,9 +195,9 @@ size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="PaintingPiles" type="HBoxContainer" parent="."]
|
[node name="PaintingPiles" type="HBoxContainer" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
offset_left = 142.0
|
offset_left = 86.0
|
||||||
offset_top = 242.0
|
offset_top = 280.0
|
||||||
offset_right = 759.0
|
offset_right = 847.0
|
||||||
offset_bottom = 310.0
|
offset_bottom = 310.0
|
||||||
theme_override_constants/separation = 24
|
theme_override_constants/separation = 24
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
@ -222,6 +222,30 @@ size_flags_horizontal = 3
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile6" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile7" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile8" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile9" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile10" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="PaintingPile11" parent="PaintingPiles" instance=ExtResource("4_1u8w0")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[connection signal="timer_timeout" from="TurnManager" to="GameManager" method="_on_turn_manager_timer_timeout"]
|
[connection signal="timer_timeout" from="TurnManager" to="GameManager" method="_on_turn_manager_timer_timeout"]
|
||||||
[connection signal="button_down" from="BarkButtons/GreatBuy" to="BarkButtons" method="_on_great_buy_button_down"]
|
[connection signal="button_down" from="BarkButtons/GreatBuy" to="BarkButtons" method="_on_great_buy_button_down"]
|
||||||
[connection signal="button_up" from="BarkButtons/GreatBuy" to="BarkButtons" method="_on_great_buy_button_release"]
|
[connection signal="button_up" from="BarkButtons/GreatBuy" to="BarkButtons" method="_on_great_buy_button_release"]
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ class_name TurnManager extends Node2D
|
||||||
signal timer_timeout
|
signal timer_timeout
|
||||||
|
|
||||||
@export var turn_timer := 7.0
|
@export var turn_timer := 7.0
|
||||||
@export var tts_number_speed = 7.0
|
@export var _tts_number_speed := 7.0
|
||||||
@export var tts_sentence_speed = 5.0
|
@export var _tts_sentence_speed := 5.0
|
||||||
@export var tts_volume = 75
|
@export var tts_volume := 75
|
||||||
@export var tts_pitch = 1.0
|
@export var tts_pitch := 1.0
|
||||||
|
|
||||||
@export var desk: Desk
|
@export var desk: Desk
|
||||||
@export var captions: CaptionLabel
|
@export var captions: CaptionLabel
|
||||||
|
|
@ -26,8 +26,19 @@ func _ready() -> void:
|
||||||
print('voices available: ', _voices.size())
|
print('voices available: ', _voices.size())
|
||||||
|
|
||||||
|
|
||||||
func speak(text: String, speed := tts_number_speed) -> void:
|
func speak_number(text: String) -> void:
|
||||||
print('tts: ', text)
|
captions.display_caption(text)
|
||||||
|
if not _voices.is_empty():
|
||||||
|
DisplayServer.tts_speak(text, _voices[0], tts_volume, tts_pitch, _tts_number_speed)
|
||||||
|
|
||||||
|
|
||||||
|
func speak_sentence(text: String) -> void:
|
||||||
|
captions.display_caption(text)
|
||||||
|
if not _voices.is_empty():
|
||||||
|
DisplayServer.tts_speak(text, _voices[0], tts_volume, tts_pitch, _tts_sentence_speed)
|
||||||
|
|
||||||
|
|
||||||
|
func speak_bark(text: String, speed: float) -> void:
|
||||||
captions.display_caption(text)
|
captions.display_caption(text)
|
||||||
if not _voices.is_empty():
|
if not _voices.is_empty():
|
||||||
DisplayServer.tts_speak(text, _voices[0], tts_volume, tts_pitch, speed)
|
DisplayServer.tts_speak(text, _voices[0], tts_volume, tts_pitch, speed)
|
||||||
|
|
@ -36,13 +47,13 @@ func speak(text: String, speed := tts_number_speed) -> void:
|
||||||
func _speak_ask_proposed(amount):
|
func _speak_ask_proposed(amount):
|
||||||
var speech_variance = randf()
|
var speech_variance = randf()
|
||||||
if speech_variance < 0.45:
|
if speech_variance < 0.45:
|
||||||
speak('%s' % [amount])
|
speak_number('%s' % [amount])
|
||||||
elif speech_variance > 0.45 and speech_variance < 0.65:
|
elif speech_variance > 0.45 and speech_variance < 0.65:
|
||||||
speak('Do I hear %s?' % [amount])
|
speak_number('Do I hear %s?' % [amount])
|
||||||
elif speech_variance > 0.65 and speech_variance < 0.8:
|
elif speech_variance > 0.65 and speech_variance < 0.8:
|
||||||
speak('%s, anybody?' % [amount])
|
speak_number('%s, anybody?' % [amount])
|
||||||
else:
|
else:
|
||||||
speak('Can I get a %s?' % [amount])
|
speak_number('Can I get a %s?' % [amount])
|
||||||
|
|
||||||
|
|
||||||
func _handle_ask_accepted():
|
func _handle_ask_accepted():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue