Dialogue Patch fixes
This commit is contained in:
		| @@ -23,36 +23,67 @@ namespace stardew_access.Patches | ||||
|                     // For Normal Character dialogues | ||||
|                     Dialogue dialogue = __instance.characterDialogue; | ||||
|                     string speakerName = dialogue.speaker.displayName; | ||||
|                     List<string> dialogues = dialogue.dialogues; | ||||
|                     int dialogueIndex = dialogue.currentDialogueIndex; | ||||
|                     string toSpeak = $"{speakerName} said, {dialogues[dialogueIndex]}"; | ||||
|                     string toSpeak = " "; | ||||
|                     bool hasResponses = false; | ||||
|  | ||||
|                     if (currentDialogue != toSpeak) | ||||
|                     if (__instance.responses.Count > 0) | ||||
|                         hasResponses = true; | ||||
|  | ||||
|                     if (currentDialogue != __instance.getCurrentString()) | ||||
|                     { | ||||
|                         toSpeak = __instance.getCurrentString(); | ||||
|                         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 | ||||
|                     string toSpeak = " "; | ||||
|                     bool hasResponses = false; | ||||
|  | ||||
|                     if (__instance.responses.Count > 0) | ||||
|                         hasResponses = true; | ||||
|  | ||||
|                     if (currentDialogue != __instance.getCurrentString()) { | ||||
|                         toSpeak = __instance.getCurrentString(); | ||||
|                         currentDialogue = toSpeak; | ||||
|                         ScreenReader.sayWithChecker(toSpeak, true); | ||||
|                     } | ||||
|  | ||||
|                     for (int i = 0; i < __instance.responses.Count; i++) | ||||
|                     { | ||||
|                         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); | ||||
|                         else | ||||
|                             ScreenReader.sayWithChecker(toSpeak, true); | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user