src/app/models/scenario-cabri.ts
constructor(cabri: CabriDataService, accountService: AccountService, globalService: GlobalService, page: any, cd: ChangeDetectorRef, ttsService: PlayTTSService)
|
| populateScenario |
populateScenario(randomize: boolean)
|
|
Populate feedbacks (this.feedbacks array) for all activities (first level - second additive level in scenario-"activityName" models)
Parameters :
Returns:
void
|
| remoteWaitingParticipant |
remoteWaitingParticipant(ready: any)
|
|
Await remote host participant (Contrôle à distance)
Returns:
void
|
| runMathiaSpeech |
runMathiaSpeech(content: any[])
|
|
Main method used to run TTS scenarios with callbacks
Parameters :
Returns:
any
|
| runMathiaSpeechCore |
runMathiaSpeechCore(tutorial: Tutorial)
|
|
Returns:
void
|
| inputMethodsTutorial |
inputMethodsTutorial()
|
|
TUTORIAL INPUT METHODS (AVEC MICRO)
Returns:
void
|
| inputMethodTutorialMessagesNoMic |
inputMethodTutorialMessagesNoMic()
|
|
TUTORIAL INPUT METHODS (VERSION PAS DE MICRO)
Returns:
void
|
| inputMethodChangeSTTNoMic |
inputMethodChangeSTTNoMic()
|
|
Runs a small series of messages when the user has no microphone and tries to switch in STT mode
Returns:
void
|
| nextPlayerSwitch |
nextPlayerSwitch()
|
|
Scenario for player switching between 2 answers in multi mode
Returns:
void
|
| nextPlayerSwitchEliminated |
nextPlayerSwitchEliminated()
|
|
Scenario for player switching after ia player has been eliminated in multi mode
Returns:
void
|
| eliminationChallengeMode |
eliminationChallengeMode()
|
|
played after badResponseMoonWithResult()
Returns:
void
|
| drawingRefused |
drawingRefused()
|
|
Scenario played when a drawing has been refused by user after the validation process
Returns:
void
|
| drawingRejected |
drawingRejected()
|
|
Scenario played when a drawing has been rejected automatically by OCR because not usable
Returns:
void
|
| sttFailure |
sttFailure()
|
|
Scenario played when STT content has been rejected automatically by because not usable
Returns:
void
|
| fromInputMethodsTutorial |
fromInputMethodsTutorial: |
| ttsService |
ttsService: |
import { AnswerAverage, AnswerExtreme, AnswerNeedsHelp, AnswerSpeed, AnswerStatus } from "./activity-answer";
import { ChangeDetectorRef } from "@angular/core";
import { Subject, firstValueFrom, ReplaySubject } from "rxjs";
import { AccountService } from "../services/account.service";
import { CabriDataService } from "../services/cabri-data.service";
import { GlobalService } from "../services/global.service";
import { PlayTTSService } from "../services/play-tts.service";
import { Scenario } from "./scenario";
import { ScenarioPhrase } from "./scenario-phrase";
import { Tutorial } from "./tutorial";
import { AppUtils } from "../app-utils";
export class ScenarioCabri extends Scenario {
// to detect if the inputMethodsTutorial has been played to adjust the transition in the next scenario:
fromInputMethodsTutorial: boolean;
constructor(
cabri: CabriDataService,
accountService: AccountService,
globalService: GlobalService,
page: any,
cd: ChangeDetectorRef,
public ttsService: PlayTTSService
) {
super(accountService, globalService, page, cd, ttsService);
this.appName = "Oups";
this.cabriService = cabri;
}
/**
* Populate feedbacks (this.feedbacks array) for all activities (first level - second additive level in scenario-"activityName" models)
* @param randomize true => randomize phrases order to increase variation
* false => get phrases by descending order -> pro = better for phrases follow up / cons = phrases are always read in the same order
*/
populateScenario(randomize?: boolean) {
// note: le nom du joueur doit être appelé avec #playerName
this.feedbacks = new Array();
// SUCCESS 1ST TRY
// SLOW
this.addFeedbacks({ status: AnswerStatus.VALID1ST, speed: AnswerSpeed.SLOW }, 2, [
$localize`Oui ! Mieux vaut bien réfléchir avant de répondre ! Continue comme ça !`,
$localize`Un petit pas pour toi, un grand pas pour ton apprentissage ! Bravo !`,
$localize`Doucement mais sûrement ! Bravo !`
]);
// NORMAL
this.addFeedbacks({ success: true }, 1, [
$localize`Quelle giga-réponse ! Bravo !`,
$localize`Youpi ! Une nouvelle constellation en vue !`,
$localize`Vers l’infini et au-delà ! Bien joué !`,
$localize`Méga-boulonique cette réponse !`,
$localize`Oui ! Bravo !`,
$localize`Waouh ! Quelle réponse inter-sidérale !`,
$localize`Super ! Tu as trouvé la solution !`,
$localize`Bravo ! Tu as gagné une #award !`,
$localize`Quelle cosmo-réponse ! Bien joué !`,
$localize`Wahou ! Toutes les planètes s’alignent sur ton passage !`
]);
// FAST
this.addFeedbacks({ status: AnswerStatus.VALID1ST, speed: AnswerSpeed.FAST }, 2, [
$localize`Rapide comme l’éclair ! Tu as gagné une #award !`,
$localize`Supra-luminique ! Une #award en plus !`,
$localize`Wahou ! Tu réfléchis plus vite que la lumière !`,
$localize`Aussi rapide qu’une étoile filante !`,
$localize`Tes processeurs fonctionnent à plein régime !`,
$localize`Vitesse lumière !`,
$localize`Tu m’impressionnes #playerName ! Bravo !`,
$localize`Lumino-fantastique !`,
$localize`Quelle cosmo-réponse !`,
$localize`Wahou ! Toutes les planètes s’alignent sur ton passage !`,
$localize`Par Toutatis ! Quelle maîtrise !`,
$localize`Supra-luminique !`
]);
// PROGRESSION ABOVE AVERAGE
this.addFeedbacks({ status: AnswerStatus.VALID1ST, progressionAverage: AnswerAverage.ABOVE }, 3, [
$localize`Super ! Continue comme ça et tu devrais y arriver sans soucis !`
]);
// PROGRESSION BELOW AVERAGE
this.addFeedbacks({ status: AnswerStatus.VALID1ST, progressionAverage: AnswerAverage.BELOW }, 3, [
$localize`Bien joué #playerName ! Tu vois ? Tu peux y arriver !`
]);
// PROGRESSION NO ERRORS TILL THEN
this.addFeedbacks({ status: AnswerStatus.VALID1ST, progressionExtreme: AnswerExtreme.ALLGOOD }, 3, [
$localize`Sans faute jusqu’ici ! Joli !`,
$localize`Wahou ! Rien ne t’arrête !`,
$localize`Quelle série ! Et une #award en plus !`,
$localize`Incroyable ! Jusqu’où iras-tu comme ça ?`,
$localize`Epoustouflant !`
]);
// PROGRESSION ONLY ERRORS TILL THEN
this.addFeedbacks({ status: AnswerStatus.VALID1ST, progressionExtreme: AnswerExtreme.ALLBAD }, 3, [
$localize`Oui #playerName ! Bravo ! Tu vois, avec persévérance on y arrive toujours !`
]);
// PROGRESSION NO ERRORS TILL THEN - FAST ANSWER
this.addFeedbacks({ status: AnswerStatus.VALID1ST, speed: AnswerSpeed.FAST, progressionExtreme: AnswerExtreme.ALLGOOD }, 4, [
$localize`Tu es lancé comme une fusée vers le sans faute !`,
$localize`Oui ! Attention ! Tu vas passer le mur du son !`,
$localize`Quel enchaînement ! Quelle vitesse !`,
$localize`Wahou ! Tu m’impressionnes #playerName ! Continue comme ça !`,
$localize`Incroyable ! Si tu continues tu vas t’envoler !`,
$localize`Oui bravo ! Plus rien ne t’arrête !`,
$localize`Youhou ! C’est trop facile pour toi !`
]);
// SUCCESS 2ND TRY
this.addFeedbacks({ status: AnswerStatus.VALID2ND }, 2, [
$localize`Bravo #playerName ! Beau rattrapage !`,
$localize`Avec persévérance, on arrive à tout ! Même toucher les étoiles !`,
$localize`Bravo ! Bien rattrapé !`,
$localize`Un petit pas pour toi, un grand pas pour ton apprentissage ! Bravo !`,
$localize`Youpi ! Tu as trouvé la solution !`,
$localize`Bravo ! Quel beau rattrapage !`,
$localize`Super ! Tu as bien redressé la barre moussaillon !`,
$localize`Vers l’infini et au-delà ! Quelle trajectoire maîtrisée !`,
$localize`Bravo ! Tu as remis le cap dans la bonne direction !`,
$localize`Oui ! Bravo ! Bravo ! Bravooo !`,
$localize`Super-luminique ! Voilà une #award pour te récompenser de tes efforts !`
]);
this.addFeedbacks({ status: AnswerStatus.VALID2ND, progressionExtreme: AnswerExtreme.ALLBAD }, 3, [
$localize`Oui #playerName ! Tu as su perséverer ! Je suis très fier de toi ! Continue !`
]);
this.addFeedbacks({ status: AnswerStatus.VALID2ND, progressionExtreme: AnswerExtreme.ALLGOOD }, 3, [
$localize`Ouf ! J’ai cru que tu allais t’arrêter en si bon chemin ! Bravo, bien rattrapé !`
]);
// ERRORS
// FIRST ERROR - retry with help
this.addFeedbacks({ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.YES, speed: AnswerSpeed.SLOW }, 3, [
$localize`Dommage, c’est presque ça ! Regardons de plus près...`
]);
// don’t know the answer
this.addFeedbacks(
{ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.IGNORE },
3,
[$localize`Voici un peu d’aide `, $localize`Je vais essayer de t’aider.`],
2
);
this.addFeedbacks({ status: AnswerStatus.ERROR2ND, needsHelp: AnswerNeedsHelp.IGNORE }, 3, [
$localize`C’est pas grave, peut-être la prochaine fois ! `,
$localize`Désolé #playerName. Je ne peux pas t’aider une deuxième fois. C’est la règle du jeu.`
]);
this.addFeedbacks({ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.YES }, 2, [
$localize`Tu t’es trompé mais ce n’est pas grave, c’est comme ça qu’on apprend !`,
$localize`Oups... La fusée bug ! Je vais te donner un petit coup de main !`,
$localize`Oups ! Ce n’est pas ça. Laisse moi t’aider !`,
$localize`Oups... Notre fusée s’éloigne du but ! Voyons avec un peu d’aide !`,
$localize`Oups... J’aimerais pouvoir te dire que tu as trouvé, mais ce n’est pas ça !`,
$localize`Oups ! Ce n’est pas ça ! Voici un peu d’aide !`,
$localize`Tu y es presque, nous allons réessayer avec un peu d’aide !`,
$localize`Oups, ce n’est pas ça ! Réessayons ensemble avec un peu d’aide.`,
$localize`Oups, mauvaise réponse ! Servons-nous de l’aide et essayons a nouveau !`,
$localize`Sauve qui peut ! Le vaisseau part à la dérive, reprenons vite la barre !`,
$localize`Appel à la base ! Nous avons besoin d’aide par ici !`,
$localize`Oups ! Laisse-moi te donner un coup de main pour rattraper cette petite erreur !`
]);
this.addFeedbacks({ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.YES, speed: AnswerSpeed.FAST }, 3, [
$localize`Oula ! Pas si vite, ce n’est pas ça ! Voyons ça de plus près...`,
$localize`Tu devrais aller plus doucement...`,
$localize`Oula ! Non... Ralentissons un peu !`
]);
// FIRST ERROR - retry without help
this.addFeedbacks({ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.NO }, 2, [
$localize`Oups... La fusée bug ! Essaye encore !`,
$localize`Tu y es presque, je te laisse une chance de te corriger !`,
$localize`Oups, ce n’est pas la bonne réponse... Essaye encore !`,
$localize`Tu t’es trompé mais ce n’est pas grave, c’est comme ça qu’on apprend ! Essaye encore !`,
$localize`Ouloulou ! Ce n’est pas ça... Essaye encore !`,
$localize`Oups ! Ce n’est pas ça. Essayons à nouveau !`,
$localize`Oups... J’aimerais pouvoir te dire que tu as trouvé, mais ce n’est pas ça ! Essaye encore !`,
$localize`Oups ! Ce n’est pas ça ! Essaye encore une fois !`,
$localize`Tu y es presque, je te laisse une chance de te corriger !`,
$localize`Sauve qui peut ! Le vaisseau part à la dérive, reprenons vite la barre !`,
$localize`Appel à la base ! Il y a des turbulences sur le chemin ! Reprenons le cap !`
]);
this.addFeedbacks({ status: AnswerStatus.ERROR1ST, needsHelp: AnswerNeedsHelp.NO, speed: AnswerSpeed.FAST }, 3, [
$localize`Oula non ! Tu as répondu un peu vite ! Essaye encore !`,
$localize`Pas si vite, ce n’est pas ça ! Essaye encore !`,
$localize`Oups ! Essaye encore ! En allant plus doucement peut-être ?`,
$localize`Et si nous ralentissions un petit peu ? Ok ? Reprenons !`,
$localize`Oula ! Tu devrais aller moins vite ! Essaye encore !`,
$localize`Ce n’est pas ça ! Essaye encore, et n’hésite pas à prendre ton temps avant de répondre !`
]);
// SECOND ERROR - failed
// don’t know the answer
this.addFeedbacks({ status: AnswerStatus.ERROR2ND, needsHelp: AnswerNeedsHelp.IGNORE }, 3, [
$localize`Tu n’as pas la réponse. Peut-être tu l’auras la prochaine fois !`,
$localize`Désolé #playerName. Je ne peux pas t’aider une deuxième fois. C’est la règle du jeu.`
]);
this.addFeedbacks({ status: AnswerStatus.ERROR2ND }, 2, [
$localize`Dommage, tu y étais presque !`,
$localize`Oups... La fusée bug !`,
$localize`Tu t’es trompé mais ce n’est pas grave, c’est comme ça qu’on apprend !`,
$localize`Oups... J’aimerais pouvoir te dire que tu as trouvé, mais ce n’est pas ça !`,
$localize`Non, ce n’est pas ça.`,
$localize`Oups ! Ce n’est pas ça !`
// $localize`Tonnerre de Brest ! Ce n’est pas ça...`
]);
// console.error("feedbacks unshuffled = ", this.feedbacks);
if (randomize) {
AppUtils.shuffleArray(this.feedbacks);
// console.error("feedbacks shuffled = ", this.feedbacks);
}
}
/**
* Await remote host participant (Contrôle à distance)
*/
async remoteWaitingParticipant(ready: Subject<boolean>) {
this.cabriService.remoteWaitingScreen = true;
let pageDiv;
if (window.document.getElementById("page-div")) {
pageDiv = window.document.getElementById("page-div");
}
if (pageDiv) {
pageDiv.style.opacity = "0";
}
await this.timeOut(500);
this.detectChanges();
await this.page.stopLoader();
const waitParticipant: Array<any> = [
new ScenarioPhrase(
[$localize`Sur une autre tablette, appuie sur l’icône de manette dans la barre d’outils pour commencer l’activité.`],
async () => {
await firstValueFrom(ready);
this.cabriService.remoteWaitingScreen = false;
if (pageDiv) {
pageDiv.style.opacity = "1";
}
}
).disableSkipButton()
];
await this.runMathiaSpeech(waitParticipant);
}
/**
* Main method used to run TTS scenarios with callbacks
* @param content scenario sequence array
* @param globalBubble not in use here
* @param fromToolbar obsolete?
*/
runMathiaSpeech(content: Array<any>): Promise<void> {
const p = new Promise<void>((resolve, reject) => {
console.log("runMathiaSpeech entered");
this.globalService.mathiaSpeechRunning = true;
// this.cabriService.allowInputMethodChange = false;
let lastElement;
const contentClone = content.slice(0);
contentClone.reverse().forEach(element => {
const current = new Tutorial();
current.phrase = element.phrase;
if (element.phraseTTS) {
current.phraseTTS = element.phraseTTS;
}
if (element.onlySpeech) {
current.onlySpeech = element.onlySpeech;
}
if (element.randomSpeechMode) {
current.randomSpeechMode = element.randomSpeechMode;
}
if (element.textBubble) {
current.textBubble = element.textBubble;
}
if (element.buttons) {
current.buttons = element.buttons;
}
if (element.disableSkip) {
current.disableSkip = element.disableSkip;
}
if (element.isFeedback) {
current.isFeedback = element.isFeedback;
}
if (element.buttonText) {
current.buttonText = element.buttonText;
}
if (element.shootingStar) {
current.shootingStar = element.shootingStar;
}
if (element.normalStar) {
current.normalStar = element.normalStar;
}
if (element.moon) {
current.moon = element.moon;
}
if (element.keepBubble) {
current.keepBubble = element.keepBubble;
}
// array read in reverse so the first tutorial is the end and need to resolve
if (!lastElement) {
current.callback = async () => {
if (element.callback) {
if (typeof element.callback === "function" && !this.lockCallback) {
try {
await element.callback();
} catch( e ){
console.error("catch callback", e);
}
}
}
this.globalService.mathiaSpeechRunning = false;
this.skipSequence = false;
if(!element.keepBubble){
this.page.award = null;
}
this.detectChanges();
resolve();
};
} else {
current.callback = async () => {
if (element.callback) {
if (typeof element.callback === "function" && !this.lockCallback) {
try {
await element.callback();
} catch( e ){
console.error("catch callback2", e);
}
}
}
};
}
current.next = lastElement;
lastElement = current;
});
if (this.lockCallback) {
// console.error("rejected by lockCallback");
reject();
} else {
this.runMathiaSpeechCore(lastElement);
}
});
this.currentRunMathiaSpeechPromise.push({promise: p, scenario: content});
return p;
}
/**
* @ignore
*/
runMathiaSpeechCore(tutorial: Tutorial): void {
// if (this.globalService.onActivityPage) {
if (tutorial) {
if (Array.isArray(tutorial.phrase) && tutorial.phrase.length > 1) {
if (tutorial.randomSpeechMode) {
// select random index from tutorial.phrase array
const randomIndex = Math.floor(Math.random() * tutorial.phrase.length);
// console.log("random index = " + randomIndex);
tutorial.phrase = tutorial.phrase[randomIndex];
if (tutorial.phraseTTS) {
tutorial.phraseTTS = tutorial.phraseTTS[randomIndex];
}
} else {
// increment index of tutorial.phrase array
this.mscPhraseArrayIndex++;
if (this.mscPhraseArrayIndex >= tutorial.phrase.length) {
this.mscPhraseArrayIndex = 0;
}
// console.log("tutorial.phrase = ", tutorial.phrase);
// console.log("this.mscPhraseArrayIndex = " + this.mscPhraseArrayIndex);
tutorial.phrase = tutorial.phrase[this.mscPhraseArrayIndex];
if (tutorial.phraseTTS) {
tutorial.phraseTTS = tutorial.phraseTTS[this.mscPhraseArrayIndex];
}
}
} else if (Array.isArray(tutorial.phrase) && tutorial.phrase.length === 1) {
tutorial.phrase = tutorial.phrase[0];
if (tutorial.phraseTTS) {
tutorial.phraseTTS = tutorial.phraseTTS[0];
}
}
if (tutorial.textBubble === true) {
if (tutorial.buttons === true) {
this.page.mathiaSpeechButtonText = tutorial.buttonText;
this.page.award = "validation_misc";
console.log("this.page.mathiaSpeechButtonText = " + this.page.mathiaSpeechButtonText);
} else {
this.page.award = "simpleMessage";
}
if (tutorial.disableSkip) {
this.page.award = "simpleMessageNoSkip";
}
if(tutorial.isFeedback){
this.page.award_style = "feedback";
} else {
this.page.award_style = "";
}
if (tutorial.shootingStar) {
this.page.award = "simpleMessageShootingStar";
}
if (tutorial.normalStar) {
this.page.award = "simpleMessageNormalStar";
}
if (tutorial.moon) {
this.page.award = "simpleMessageMoon";
}
} else {
this.page.award = "none";
}
this.page?.eventMessage?.next(tutorial.phrase);
this.lastPhrase = tutorial.phrase;
if (!tutorial.onlySpeech) {
this.page.displayCM = true;
}
if (!this.skipSequence && this.cd) {
this.detectChanges();
}
if (!this.skipSequence && !this.lockCallback) {
this.ttsService.playTTSEventProtected(tutorial, async () => {
tutorial.callback().then(() => {
this.page.mathiaSpeechButtonText = null;
if (!this.page.menuOpen && !this.globalService.appIdle) {
if (!tutorial.keepBubble) {
this.page.award = null;
}
this.page?.eventMessage?.next(tutorial.phrase);
this.detectChanges();
return this.runMathiaSpeechCore(tutorial.next);
} else {
if (!tutorial.keepBubble) {
this.page.award = null;
}
this.page?.eventMessage?.next(tutorial.phrase);
this.detectChanges();
this.tutoCallbackSave = tutorial.next;
}
});
});
} else if (this.skipSequence === true && !this.lockCallback) {
tutorial.callback().then(async () => {
this.page.mathiaSpeechButtonText = null;
if (!this.page.menuOpen && !this.globalService.appIdle) {
if (!tutorial.keepBubble) {
this.page.award = null;
}
this.page?.eventMessage?.next(tutorial.phrase);
this.detectChanges();
return this.runMathiaSpeechCore(tutorial.next);
} else {
if (!tutorial.keepBubble) {
this.page.award = null;
}
this.page?.eventMessage?.next(tutorial.phrase);
this.detectChanges();
this.tutoCallbackSave = tutorial.next;
}
});
}
}
// }
}
/**
* TUTORIAL INPUT METHODS (AVEC MICRO)
* Lors du clic sur "Tutoriel" en début d’activité.
* Explique les différents modes de réponses en prenant en compte si 1 ou plusieurs joueurs présents
* Prends aussi en compte si drawing ou autres input methods désactivées
*/
async inputMethodsTutorial() {
// detecting if all or only one input method is allowed in the activity (for scenario customization):
const allInputsMethodsAllowed = this.cabriService.numpadAllowed && this.cabriService.drawingAllowed && this.cabriService.sttAllowed;
const inputsMethodsAllowed = [this.cabriService.numpadAllowed, this.cabriService.drawingAllowed, this.cabriService.sttAllowed];
const inputsMethodsAllowedCount = inputsMethodsAllowed.filter((inputMethod) => inputMethod).length;
// allow all input methods temporarily for tutorial:
const numpadAllowedOriginalValue = this.cabriService.numpadAllowed;
const drawingAllowedOriginalValue = this.cabriService.drawingAllowed;
const sttAllowedOriginalValue = this.cabriService.sttAllowed;
this.cabriService.numpadAllowed = true;
this.cabriService.drawingAllowed = true;
this.cabriService.sttAllowed = true;
const inputMethodTutorialMessages = new Array();
if (this.page.currentTeam.length > 1) {
// MULTI
const players: any = this.page.currentTeam.map(student => student.name).join(" ! ") + " ! ";
inputMethodTutorialMessages.push(new ScenarioPhrase(players + $localize` Bienvenue à bord ! `).setRandomMode());
inputMethodTutorialMessages.push(new ScenarioPhrase($localize`Avant de commencer, je vais vous montrer comment piloter notre fusée !`));
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Pour me donner votre réponse, utilisez les trois boulons... Oups... Les boutons, en haut de l’écran.`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Vous les voyez ?`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Le gros bouton du milieu, c’est le micro. Si vous appuyez dessus...`, () => {
this.globalService.fakeMicOn = true;
this.cd.detectChanges();
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Hop ! Il s’allume ! Vous pouvez ensuite me répondre directement en parlant.`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Par contre je suis un petit robot qui apprend à parler`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`S’il vous plaît, parlez-moi lentement et sans crier, sinon j’aurai du mal à comprendre !`, () => {
this.globalService.fakeMicOn = false;
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Si je n’ai pas compris, il y a le cosmo clavier, à gauche.`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Si vous appuyez dessus il s’affiche dans notre poste de pilotage. Regardez !`, async () => {
this.page.hideBubble();
// numpad on
if (!this.skipSequence) {
this.page.toggleNumpad(true, true);
}
await this.timeOut(3000);
// numpad off:
if (!this.skipSequence) {
this.page.toggleNumpad(false);
}
})
);
if (this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id)) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Enfin, le dernier bouton, à droite, c’est l’astro ardoise`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Elle vous permet de dessiner le résultat sur l’écran`, async () => {
// draw on
this.page.hideBubble();
if (!this.skipSequence) {
this.page.toggleDraw(true);
}
await this.timeOut(3000);
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase(
$localize`Une fois que vous avez fini de dessiner, appuyez sur le bouton valider pour me donner votre résultat.`,
async () => {
// draw off
if (!this.skipSequence || this.cabriService.cabriInputDrawStatus) {
this.page.toggleDraw(false);
}
await this.timeOut(1000);
}
)
);
}
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Voilà, je crois que nous avons fait le tour de notre vaisseau spatial !`, () => {
// END
this.cabriService.numpadAllowed = numpadAllowedOriginalValue;
this.cabriService.drawingAllowed = drawingAllowedOriginalValue;
this.cabriService.sttAllowed = sttAllowedOriginalValue;
this.page.inputMethodTutorialDone = true;
this.fromInputMethodsTutorial = true;
this.page.fromInitInputMethod = false;
this.page.cabri.toggleOperationWrapperPosition("down");
this.page.initInputMethod();
})
);
if (!allInputsMethodsAllowed) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Dans l’activité que vous allez maintenant faire, il n’y a pas tous les modes de réponse.`)
);
if (inputsMethodsAllowedCount === 1) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`C’est normal ! Utilisez celui qui est disponible !`)
);
} else {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`C’est normal ! Utilisez ceux qui sont disponibles !`)
);
}
}
} else {
// SOLO
inputMethodTutorialMessages.push(
new ScenarioPhrase(this.page.currentUser.name + " ! " + $localize`Bienvenue à bord ! `)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Avant de commencer, je vais te montrer comment piloter notre fusée !`)
);
if (this.page.currentTeam[0].isGar){
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Il y a le cosmo clavier, à gauche.`)
);
} else {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Pour me donner ta réponse, utilise les trois boulons... Oups... les boutons, en haut de l’écran.`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Tu les vois ?`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Le gros bouton du milieu, c’est le micro. Si tu appuies dessus...`, () => {
this.globalService.fakeMicOn = true;
this.cd.detectChanges();
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Hop ! Il s’allume ! Tu peux ensuite me répondre directement en parlant.`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Par contre je suis un petit robot qui apprend à parler`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`S’il te plaît, parle-moi lentement et sans crier, sinon j’aurai du mal à comprendre !`, () => {
this.globalService.fakeMicOn = false;
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Si je n’ai pas compris, il y a le cosmo clavier, à gauche.`)
);
}
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Si tu appuies dessus il s’affiche dans notre poste de pilotage. Regarde !`, async () => {
this.page.hideBubble();
// numpad on
if (!this.skipSequence) {
this.page.toggleNumpad(true, true);
}
await this.timeOut(3000);
// numpad off:
if (!this.skipSequence) {
this.page.toggleNumpad(false);
}
})
);
if (this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id)) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Enfin, le dernier bouton, à droite, c’est l’astro ardoise`)
);
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Elle te permet de dessiner le résultat sur l’écran`, async () => {
// draw on
this.page.hideBubble();
if (!this.skipSequence) {
this.page.toggleDraw(true);
}
await this.timeOut(3000);
})
);
inputMethodTutorialMessages.push(
new ScenarioPhrase(
$localize`Une fois que tu as fini de dessiner, appuie sur le bouton valider pour me donner ton résultat.`,
async () => {
// draw off
if (!this.skipSequence || this.cabriService.cabriInputDrawStatus) {
this.page.toggleDraw(false);
}
await this.timeOut(1000);
}
)
);
}
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Voilà, je crois que nous avons fait le tour de notre vaisseau spatial !`, () => {
// END or TEAM
this.cabriService.numpadAllowed = numpadAllowedOriginalValue;
this.cabriService.drawingAllowed = drawingAllowedOriginalValue;
this.cabriService.sttAllowed = sttAllowedOriginalValue;
this.page.inputMethodTutorialDone = true;
this.fromInputMethodsTutorial = true;
this.page.fromInitInputMethod = false;
this.page.cabri.toggleOperationWrapperPosition("down");
this.page.initInputMethod();
})
);
if (!allInputsMethodsAllowed) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`Dans l’activité que tu vas maintenant faire, il n’y a pas tous les modes de réponse.`)
);
if (inputsMethodsAllowedCount === 1) {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`C’est normal ! Utilise celui qui est disponible !`)
);
} else {
inputMethodTutorialMessages.push(
new ScenarioPhrase($localize`C’est normal ! Utilise ceux qui sont disponibles !`)
);
}
}
}
await this.runMathiaSpeech(inputMethodTutorialMessages);
}
/**
* TUTORIAL INPUT METHODS (VERSION PAS DE MICRO)
* Lancé lors du clic sur "Tutoriel" en début d’activité.
* Explique les différents modes de réponses en prenant en compte si 1 ou plusieurs joueurs présents
* Prends aussi en compte si drawing ou autres input methods désactivées
*/
async inputMethodTutorialMessagesNoMic() {
// detecting if all or only one input method is allowed in the activity (for scenario customization):
const allInputsMethodsAllowed = this.cabriService.numpadAllowed && this.cabriService.drawingAllowed && this.cabriService.sttAllowed;
const inputsMethodsAllowed = [this.cabriService.numpadAllowed, this.cabriService.drawingAllowed, this.cabriService.sttAllowed];
const inputsMethodsAllowedCount = inputsMethodsAllowed.filter((inputMethod) => inputMethod).length;
// allow all input methods temporarily for tutorial:
const numpadAllowedOriginalValue = this.cabriService.numpadAllowed;
const drawingAllowedOriginalValue = this.cabriService.drawingAllowed;
const sttAllowedOriginalValue = this.cabriService.sttAllowed;
this.cabriService.numpadAllowed = true;
this.cabriService.drawingAllowed = true;
this.cabriService.sttAllowed = true;
const inputMethodTutorialMessagesNoMic = new Array();
if (this.page.currentTeam.length > 1) {
// MULTI
const players: any = this.page.currentTeam.map(student => student.name).join(" ! ") + " ! ";
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase(players + $localize` Bienvenue à bord ! `)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Avant de commencer, je vais vous montrer comment répondre à mes questions !`)
);
if (this.page.currentTeam[0].isGar){
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Vous pouvez me donner les réponses grâce au cosmo clavier`)
);
} else {
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Si vous voulez utiliser un micro pour me répondre, branchez le et appuyez sur le bouton du micro`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Celui-ci !`, async () => {
this.globalService.fakeMicOn = true;
this.detectChanges();
await this.timeOut(3000);
this.globalService.fakeMicOn = false;
this.detectChanges();
})
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Si vous n’avez pas de micro, vous pouvez me donner les réponses grâce au cosmo clavier`)
);
}
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Pour l’activer, appuyez sur son icône. C’est celle-ci ! Hop !`, async () => {
this.page.hideBubble();
// numpad on
this.page.toggleNumpad(true, true);
await this.timeOut(5000);
// numpad off:
this.page.toggleNumpad(false);
})
);
if (this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id)) {
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Vous pouvez aussi me donner les réponses en dessinant les nombres sur l’ardoise magique`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`C’est l’icône de droite`, async () => {
// draw on
this.page.hideBubble();
this.page.toggleDraw(true);
// await this.timeOut(3000);
})
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Cette ardoise vous permet de dessiner le nombre qui correspond au résultat de l’opération`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Une fois le nombre dessiné dans ce cadre, appuyez sur valider pour me donner votre dessin !`, () => {
this.page.toggleDraw(false);
})
);
}
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Maintenant que vous savez piloter, commençons nos aventures !`, async () => {
console.log("INPUT METHOD SET TO STT FAILED --> SWITCHING TO NUMPAD");
this.page.inputMethodTutorialDone = true;
this.cabriService.numpadAllowed = numpadAllowedOriginalValue;
this.cabriService.drawingAllowed = drawingAllowedOriginalValue;
this.cabriService.sttAllowed = sttAllowedOriginalValue;
this.cabriService.inputMethod = "numpad";
console.log("%csetInputMethod set to : " + this.cabriService.inputMethod, "background: green; color: yellow");
if (!this.page.fromInitInputMethod) {
this.cabriService.allowInputMethodChange = true;
} else {
this.page.fromInitInputMethod = false;
}
await this.timeOut(1000);
})
);
} else {
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase(this.page.currentUser.name + " ! " + $localize`Bienvenue à bord ! `)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Avant de commencer, je vais te montrer comment répondre à mes questions !`)
);
if (this.page.currentTeam[0].isGar){
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Tu peux me donner les réponses grâce au cosmo clavier`)
);
} else {
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Si tu veux utiliser un micro pour me répondre, branche le et appuie sur le bouton du micro`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Celui-ci !`, async () => {
this.globalService.fakeMicOn = true;
this.detectChanges();
await this.timeOut(3000);
this.globalService.fakeMicOn = false;
this.detectChanges();
})
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Si tu n’as pas de micro, tu peux me donner les réponses grâce au cosmo clavier`)
);
}
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Pour l’activer, appuie sur son icône. C’est celle-ci regarde ! Hop !`, async () => {
this.page.hideBubble();
// numpad on
this.page.toggleNumpad(true, true);
await this.timeOut(3000);
// numpad off:
this.page.toggleNumpad(false);
})
);
if (this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id)) {
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Tu peux aussi me donner les réponses en dessinant les nombres sur l’ardoise magique`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`C’est l’icône de droite`, async () => {
// draw on
this.page.hideBubble();
this.page.toggleDraw(true);
// await this.timeOut(3000);
})
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Cette ardoise te permet de dessiner le nombre qui correspond au résultat de l’opération`)
);
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Une fois le nombre dessiné dans ce cadre, appuie sur valider pour me donner ton dessin !`, () => {
this.page.toggleDraw(false);
})
);
}
inputMethodTutorialMessagesNoMic.push(
new ScenarioPhrase($localize`Maintenant que tu sais tout, commençons nos aventures !`, async () => {
this.page.award = "none";
this.detectChanges();
console.log("INPUT METHOD SET TO STT FAILED --> SWITCHING TO NUMPAD");
this.page.inputMethodTutorialDone = true;
this.cabriService.numpadAllowed = numpadAllowedOriginalValue;
this.cabriService.drawingAllowed = drawingAllowedOriginalValue;
this.cabriService.sttAllowed = sttAllowedOriginalValue;
this.cabriService.inputMethod = "numpad";
this.detectChanges();
console.log("%csetInputMethod set to : " + this.cabriService.inputMethod, "background: green; color: yellow");
if (!this.page.fromInitInputMethod) {
this.cabriService.allowInputMethodChange = true;
} else {
this.page.fromInitInputMethod = false;
}
await this.timeOut(1000);
})
);
}
await this.runMathiaSpeech(inputMethodTutorialMessagesNoMic)
}
/**
* Runs a small series of messages when the user has no microphone and tries to switch in STT mode
* Explains to the user why mathIA can’t use STT, what are the other inputMethods available
* and invites the user to plug a mic if (s)he wants to use STT
* TODO: adapt for all activities (some code is only present in calcul mental)
*/
async inputMethodChangeSTTNoMic() {
if (this.page.activityRestarted) {
this.cabriService.allowInputMethodChange = true;
if (!this.page.fromInitInputMethod) {
this.cabriService.allowInputMethodChange = false;
// await this.timeOut(500);
this.page.setInputMethod("numpad");
this.page.cabri.showOperationAndWrapper();
this.ttsService.playTTSEventProtected(this.page.readCurrentOperation(this.page.setOperationMode), () => {
this.cabriService.allowInputMethodChange = true;
});
} else {
this.page.fromInitInputMethod = false;
}
} else {
const inputMethodChangeSTTNoMic = new Array();
if (this.page.currentTeam[0].isGar){
const drawingAllowed = this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id);
inputMethodChangeSTTNoMic.push(
new ScenarioPhrase($localize`Tu peux me donner les réponses grâce au cosmo clavier
${drawingAllowed ? "ou à l’ardoise magique " : ""}!`)
);
}else {
inputMethodChangeSTTNoMic.push(
new ScenarioPhrase($localize`Oups ! On dirait que tu n’as pas de micro branché.`)
);
inputMethodChangeSTTNoMic.push(
new ScenarioPhrase($localize`Si tu veux en utiliser un pour me parler, branche le et appuie sur le bouton du micro`)
);
const drawingAllowed = this.page.checkIfDrawAllowed(this.cabriService.currentActivity?.id);
inputMethodChangeSTTNoMic.push(
new ScenarioPhrase($localize`Sinon, tu peux me donner les réponses grâce au cosmo clavier
${drawingAllowed ? "ou à l’ardoise magique " : ""}!`)
);
}
inputMethodChangeSTTNoMic.push(
new ScenarioPhrase($localize`Ok ! Reprenons nos aventures !`, async () => {
this.page.award = "none";
console.log("INPUT METHOD SET TO STT FAILED --> SWITCHING TO NUMPAD");
this.cabriService.allowInputMethodChange = true;
this.globalService.mathiaSpeechRunning = false;
this.detectChanges();
if (!this.page.fromInitInputMethod) {
this.cabriService.allowInputMethodChange = false;
await this.timeOut(500);
this.page.setInputMethod("numpad");
this.page.cabri.showOperationAndWrapper();
this.ttsService.playTTSEventProtected(this.page.readCurrentOperation(this.page.setOperationMode), () => {
this.cabriService.allowInputMethodChange = true;
});
} else {
this.page.fromInitInputMethod = false;
}
})
);
await this.runMathiaSpeech(inputMethodChangeSTTNoMic);
}
}
/**
* Scenario for player switching between 2 answers in multi mode
*/
async nextPlayerSwitch() {
const nbPlayers = this.page.currentTeam.length + 1;
const nextPlayerContent: Array<any> = [
new ScenarioPhrase([
$localize`Maintenant c’est à ${this.page.currentUser.name}:playerName: de piloter ! Vas-y ${this.page.currentUser.name} !`,
$localize`Maintenant à toi ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`A ton tour ${this.page.currentUser.name}:playerName: !`,
$localize`A toi ${this.page.currentUser.name}:playerName: !`,
$localize`Ok, à ton tour ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`${this.page.currentUser.name}:playerName: ? Tu es toujours là ? Ok, à toi de jouer !`,
$localize`On forme une bonne équipe tous les ${nbPlayers}, non ? Continuons ! A toi ${this.page.currentUser.name}:playerName: !`,
$localize`A ${this.page.currentUser.name}:playerName: maintenant !`,
$localize`${this.page.currentUser.name}:playerName:, à toi !`,
$localize`Quel voyage ! A toi ${this.page.currentUser.name}:playerName: !`,
$localize`Et maintenant c’est à... Mince j’ai oublié ! Olala... A oui ! C’est à ${this.page.currentUser.name}:playerName: !`,
$localize`Maintenant c’est à ${this.page.currentUser.name}:playerName: de piloter ! Vas-y ${this.page.currentUser.name}:playerName: !`,
$localize`Maintenant à toi ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`A ton tour ${this.page.currentUser.name}:playerName: !`,
$localize`A toi ${this.page.currentUser.name}:playerName: !`,
$localize`Ok, à ton tour ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`${this.page.currentUser.name}:playerName: ? Tu es toujours là ? Ok, à toi de jouer !`,
$localize`On forme une bonne équipe tous les ${nbPlayers}, non ? Continuons ! A toi ${this.page.currentUser.name}:playerName: !`,
$localize`A ${this.page.currentUser.name}:playerName: maintenant !`,
$localize`${this.page.currentUser.name}:playerName:, à toi !`,
$localize`Quel voyage ! A toi ${this.page.currentUser.name}:playerName: !`
]).setRandomMode()
];
await this.runMathiaSpeech(nextPlayerContent);
}
/**
* Scenario for player switching after ia player has been eliminated in multi mode
*/
async nextPlayerSwitchEliminated() {
const nextPlayerContent: Array<any> = [
new ScenarioPhrase([
$localize`Maintenant c’est à ${this.page.currentUser.name}:playerName: de piloter ! Vas-y ${this.page.currentUser.name}:playerName: !`,
$localize`Maintenant à toi ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`A ton tour ${this.page.currentUser.name}:playerName: !`,
$localize`A toi ${this.page.currentUser.name}:playerName: !`,
$localize`Ok, à ton tour ${this.page.currentUser.name}:playerName: ! Vas-y !`,
$localize`${this.page.currentUser.name}:playerName: ? Tu es toujours là ? Ok, à toi de jouer !`,
$localize`A ${this.page.currentUser.name}:playerName: de prendre le relais !`,
$localize`${this.page.currentUser.name}:playerName:, à toi maintenant !`,
$localize`Quel voyage plein d’embûches ! A toi ${this.page.currentUser.name}:playerName: !`
]).setRandomMode()
];
await this.runMathiaSpeech(nextPlayerContent);
}
/**
* played after badResponseMoonWithResult()
* Joueur éliminé
*/
async eliminationChallengeMode() {
// TODO: message conditioning solo/multi:
const speechSequence = [
new ScenarioPhrase([
$localize`Désolé ${this.page.currentUser.name}:playerName:, ta route s’arrête ici pour cette expédition !`,
$localize`On dirait qu’il faut que tu retournes t’entraîner ${this.page.currentUser.name}:playerName: ! Désolé !`,
$localize`Désolé ${this.page.currentUser.name}:playerName:, tu vas devoir rentrer à la base !`,
$localize`Tu vas devoir t’arrêter là ${this.page.currentUser.name}:playerName: ! Désolé !`,
$localize`Tu pilotes bien ${this.page.currentUser.name}:playerName:, mais tu manques encore d’entrainement. Il faudra revenir lors d’une prochaine expédition.`,
$localize`Tu vas devoir rentrer à la base pour t’entraîner ${this.page.currentUser.name}:playerName:. Désolé !`,
$localize`Une comète a endommagé le bouclier cosmique ! Retour à la base pour toi ${this.page.currentUser.name}:playerName: !`
]).setRandomMode(),
new ScenarioPhrase([
$localize`C’est la dure loi du mode défi !`,
$localize`Le mode défi est vraiment impitoyable !`,
$localize`C’est la dure loi du mode défi !`,
$localize`Aucune erreur n’est tolérée lors du défi !`,
$localize`Le défi demande une concentration extrème !`,
$localize`Toute sortie est définitive en mode défi !`,
$localize`Le mode défi n’accepte aucune erreur de trajectoire !`
]).setRandomMode()
];
await this.runMathiaSpeech(speechSequence);
}
/**
* Scenario played when a drawing has been refused by user after the validation process
*/
async drawingRefused() {
let speechSequence;
if (this.page.goodResult.toString().length > 1) {
speechSequence = [
new ScenarioPhrase([
$localize`Oups, j’ai dû me tromper ! Tu peux redessiner le nombre s’il te plaît ?`
// "Oups, d’accord ! Tu peux redessiner le nombre s’il te plaît ?",
// "Désolé, je n’ai pas réussi à reconnaître ce nombre. Tu peux le redessiner s’il te plaît ?"
]).setRandomMode(),
new ScenarioPhrase([
$localize`Essaie de bien séparer les chiffres entre eux !`
// "Sépare bien les chiffres pour que je puisse les lire !",
// "Essaie d’espacer les chiffres un peu plus !",
// "Applique toi bien pour écrire !",
// "Il ne faut rien dessiner d’autre que des chiffres, bien espacés !"
]).setRandomMode()
];
} else {
speechSequence = [
new ScenarioPhrase([
$localize`Oups, j’ai dû me tromper !`
// "Oups, d’accord ! Tu peux redessiner le nombre s’il te plaît ?",
// "Désolé, je n’ai pas réussi à reconnaître ce nombre. Tu peux le redessiner s’il te plaît ?"
]).setRandomMode(),
new ScenarioPhrase([
$localize`Tu peux redessiner le nombre s’il te plaît ?`
// "Sépare bien les chiffres pour que je puisse les lire !",
// "Essaie d’espacer les chiffres un peu plus !",
// "Essaie de bien séparer les chiffres entre eux !",
// "Applique toi bien pour écrire !",
// "Il ne faut rien dessiner d’autre que des chiffres, bien espacés !"
]).setRandomMode()
];
}
await this.runMathiaSpeech(speechSequence);
}
/**
* Scenario played when a drawing has been rejected automatically by OCR because not usable
*/
async drawingRejected() {
let speechSequence;
if (this.page.goodResult.toString().length > 1) {
speechSequence = [
new ScenarioPhrase([
$localize`Désolé, je n’ai pas réussi à reconnaître ce nombre. Tu peux le redessiner s’il te plaît ?`
// "Ouille ! Je n’arrive pas à lire ce nombre... Tu peux le redessiner s’il te plaît ?",
// "Désolé, je n’ai pas réussi à lire ce nombre. Tu peux le redessiner s’il te plaît ?",
// "Oups, je n’arrive pas à lire ta réponse ! Tu peux redessiner le nombre s’il te plaît ?",
// "Désolé, je n’ai pas réussi à lire ta réponse. Tu peux redessiner le nombre s’il te plaît ?"
]).setRandomMode(),
new ScenarioPhrase([
$localize`Essaie de bien séparer les chiffres entre eux !`
// "Sépare bien les chiffres pour que je puisse les lire !",
// "Essaie d’espacer les chiffres un peu plus !",
// "Applique toi bien pour écrire !",
// "Il ne faut rien dessiner d’autre que des chiffres, bien espacés !"
]).setRandomMode()
];
} else {
speechSequence = [
new ScenarioPhrase([
$localize`Désolé, je n’ai pas réussi à reconnaître ce nombre`
// "Ouille ! Je n’arrive pas à lire ce nombre... Tu peux le redessiner s’il te plaît ?",
// "Désolé, je n’ai pas réussi à lire ce nombre. Tu peux le redessiner s’il te plaît ?",
// "Oups, je n’arrive pas à lire ta réponse ! Tu peux redessiner le nombre s’il te plaît ?",
// "Désolé, je n’ai pas réussi à lire ta réponse. Tu peux redessiner le nombre s’il te plaît ?"
]).setRandomMode(),
new ScenarioPhrase([
$localize`Tu peux le redessiner s’il te plaît ?`
// "Sépare bien les chiffres pour que je puisse les lire !",
// "Essaie d’espacer les chiffres un peu plus !",
// "Essaie de bien séparer les chiffres entre eux !",
// "Applique toi bien pour écrire !",
// "Il ne faut rien dessiner d’autre que des chiffres, bien espacés !"
]).setRandomMode()
];
}
await this.runMathiaSpeech(speechSequence);
}
/**
* Scenario played when STT content has been rejected automatically by because not usable
*/
async sttFailure() {
let speechSequence;
speechSequence = [
new ScenarioPhrase([
$localize`:tts:Oups ! J’ai dû mal comprendre ! Tu peux répéter s’il te plaît ?`,
$localize`:tts:Désolé je n’ai pas bien compris, tu peux répéter s’il te plaît ?`,
]).setRandomMode()
];
await this.runMathiaSpeech(speechSequence);
}
}