Dialogue Patch fixes
parent
17d8c0d561
commit
8a288b76c5
|
@ -23,36 +23,67 @@ namespace stardew_access.Patches
|
||||||
// For Normal Character dialogues
|
// For Normal Character dialogues
|
||||||
Dialogue dialogue = __instance.characterDialogue;
|
Dialogue dialogue = __instance.characterDialogue;
|
||||||
string speakerName = dialogue.speaker.displayName;
|
string speakerName = dialogue.speaker.displayName;
|
||||||
List<string> dialogues = dialogue.dialogues;
|
string toSpeak = " ";
|
||||||
int dialogueIndex = dialogue.currentDialogueIndex;
|
bool hasResponses = false;
|
||||||
string toSpeak = $"{speakerName} said, {dialogues[dialogueIndex]}";
|
|
||||||
|
|
||||||
if (currentDialogue != toSpeak)
|
if (__instance.responses.Count > 0)
|
||||||
|
hasResponses = true;
|
||||||
|
|
||||||
|
if (currentDialogue != __instance.getCurrentString())
|
||||||
{
|
{
|
||||||
|
toSpeak = __instance.getCurrentString();
|
||||||
currentDialogue = toSpeak;
|
currentDialogue = toSpeak;
|
||||||
ScreenReader.say(toSpeak, true);
|
toSpeak = $"{speakerName} said {toSpeak}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.responses.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < __instance.responses.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == __instance.selectedResponse)
|
||||||
|
{
|
||||||
|
toSpeak += $" \t\n Selected response: {__instance.responses[i].responseText}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (__instance.isQuestion || __instance.responses.Count > 0)
|
}
|
||||||
|
|
||||||
|
if (toSpeak != " ")
|
||||||
|
{
|
||||||
|
if (hasResponses)
|
||||||
|
ScreenReader.sayWithChecker(toSpeak, false);
|
||||||
|
else
|
||||||
|
ScreenReader.sayWithChecker(toSpeak, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (__instance.isQuestion)
|
||||||
{
|
{
|
||||||
// For Dialogues with responses/answers like the dialogue when we click on tv
|
// For Dialogues with responses/answers like the dialogue when we click on tv
|
||||||
string toSpeak = " ";
|
string toSpeak = " ";
|
||||||
|
bool hasResponses = false;
|
||||||
|
|
||||||
|
if (__instance.responses.Count > 0)
|
||||||
|
hasResponses = true;
|
||||||
|
|
||||||
if (currentDialogue != __instance.getCurrentString()) {
|
if (currentDialogue != __instance.getCurrentString()) {
|
||||||
toSpeak = __instance.getCurrentString();
|
toSpeak = __instance.getCurrentString();
|
||||||
currentDialogue = toSpeak;
|
currentDialogue = toSpeak;
|
||||||
ScreenReader.sayWithChecker(toSpeak, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < __instance.responses.Count; i++)
|
for (int i = 0; i < __instance.responses.Count; i++)
|
||||||
{
|
{
|
||||||
if (i == __instance.selectedResponse)
|
if (i == __instance.selectedResponse)
|
||||||
{
|
{
|
||||||
toSpeak = $" \t\n Selected response: {__instance.responses[i].responseText}";
|
toSpeak += $" \t\n Selected response: {__instance.responses[i].responseText}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toSpeak != " ")
|
||||||
|
{
|
||||||
|
if (hasResponses)
|
||||||
ScreenReader.sayWithChecker(toSpeak, false);
|
ScreenReader.sayWithChecker(toSpeak, false);
|
||||||
|
else
|
||||||
|
ScreenReader.sayWithChecker(toSpeak, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue