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
|
import time
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
||||||
|
# Keep track of whether dialog instructions have been shown
|
||||||
|
dialogUsageInstructions = False
|
||||||
|
|
||||||
class Speech:
|
class Speech:
|
||||||
"""Handles text-to-speech functionality."""
|
"""Handles text-to-speech functionality."""
|
||||||
|
|
||||||
@@ -193,14 +196,16 @@ def _show_dialog_sequence(speech, dialog_config, sounds):
|
|||||||
entry_index += 1
|
entry_index += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Show dialog with appropriate controls (only on first entry)
|
# Show dialog with appropriate controls (only on first dialog of the game)
|
||||||
if entry_index == 0:
|
global dialogUsageInstructions
|
||||||
|
if not dialogUsageInstructions and entry_index == 0:
|
||||||
if allow_skip:
|
if allow_skip:
|
||||||
control_text = "\nPress any key to repeat, enter for next, or escape to skip all."
|
control_text = "\nPress any key to repeat, enter for next, or escape to skip all."
|
||||||
else:
|
else:
|
||||||
control_text = "\nPress any key to repeat or enter for next."
|
control_text = "\nPress any key to repeat or enter for next."
|
||||||
|
dialogUsageInstructions = True
|
||||||
else:
|
else:
|
||||||
control_text = "" # No instructions after first entry
|
control_text = "" # No instructions after first dialog
|
||||||
|
|
||||||
speech.speak(formatted_text + control_text)
|
speech.speak(formatted_text + control_text)
|
||||||
|
|
||||||
@@ -222,11 +227,8 @@ def _show_dialog_sequence(speech, dialog_config, sounds):
|
|||||||
entry_index += 1
|
entry_index += 1
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# Repeat current entry (include instructions only on first entry)
|
# Repeat current entry (no instructions when repeating)
|
||||||
repeat_text = formatted_text
|
speech.speak(formatted_text)
|
||||||
if entry_index == 0:
|
|
||||||
repeat_text += control_text
|
|
||||||
speech.speak(repeat_text)
|
|
||||||
|
|
||||||
|
|
||||||
def _format_dialog_entry(entry):
|
def _format_dialog_entry(entry):
|
||||||
|
Reference in New Issue
Block a user