Ajout d'un message quand le mot saisi est trop court

This commit is contained in:
JonathanMM 2022-01-12 08:54:13 +01:00
parent dec9ccfe09
commit 136af6028e
2 changed files with 5 additions and 1 deletions

View file

@ -79,6 +79,10 @@ export default class Gestionnaire {
public verifierMot(mot: string, skipAnimation: boolean = false): void {
mot = this._dictionnaire.nettoyerMot(mot);
//console.debug(mot + " => " + (this._dictionnaire.estMotValide(mot) ? "Oui" : "non"));
if (mot.length !== this._motATrouver.length) {
NotificationMessage.ajouterNotification("Le mot proposé est trop court");
return;
}
if (mot[0] !== this._motATrouver[0]) {
NotificationMessage.ajouterNotification("Le mot proposé doit commencer par la même lettre que le mot recherché");
return;

View file

@ -76,8 +76,8 @@ export default class Input {
private validerMot(): void {
if (this._estBloque) return;
let mot = this._motSaisi;
this._gestionnaire.verifierMot(mot);
if (mot.length === this._longueurMot) {
this._gestionnaire.verifierMot(mot);
this._motSaisi = "";
}
}