Dialogue instructions only show once per game now following the same pattern as display_text.
This commit is contained in:
18
speech.py
18
speech.py
@@ -13,6 +13,9 @@ import textwrap
|
||||
import time
|
||||
from sys import exit
|
||||
|
||||
# Keep track of whether dialog instructions have been shown
|
||||
dialogUsageInstructions = False
|
||||
|
||||
class Speech:
|
||||
"""Handles text-to-speech functionality."""
|
||||
|
||||
@@ -193,14 +196,16 @@ def _show_dialog_sequence(speech, dialog_config, sounds):
|
||||
entry_index += 1
|
||||
continue
|
||||
|
||||
# Show dialog with appropriate controls (only on first entry)
|
||||
if entry_index == 0:
|
||||
# Show dialog with appropriate controls (only on first dialog of the game)
|
||||
global dialogUsageInstructions
|
||||
if not dialogUsageInstructions and entry_index == 0:
|
||||
if allow_skip:
|
||||
control_text = "\nPress any key to repeat, enter for next, or escape to skip all."
|
||||
else:
|
||||
control_text = "\nPress any key to repeat or enter for next."
|
||||
dialogUsageInstructions = True
|
||||
else:
|
||||
control_text = "" # No instructions after first entry
|
||||
control_text = "" # No instructions after first dialog
|
||||
|
||||
speech.speak(formatted_text + control_text)
|
||||
|
||||
@@ -222,11 +227,8 @@ def _show_dialog_sequence(speech, dialog_config, sounds):
|
||||
entry_index += 1
|
||||
break
|
||||
else:
|
||||
# Repeat current entry (include instructions only on first entry)
|
||||
repeat_text = formatted_text
|
||||
if entry_index == 0:
|
||||
repeat_text += control_text
|
||||
speech.speak(repeat_text)
|
||||
# Repeat current entry (no instructions when repeating)
|
||||
speech.speak(formatted_text)
|
||||
|
||||
|
||||
def _format_dialog_entry(entry):
|
||||
|
Reference in New Issue
Block a user