add templates
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { BaseGameValidator } from "../../../../shared/BaseGameValidator";
|
||||
|
||||
export class Exemplo2Validator extends BaseGameValidator {
|
||||
validatePhase(history, config, gameConfig, sceneRef) {
|
||||
const esperado = config?.textoEsperado || "SOBERANIA DIGITAL";
|
||||
const atual = sceneRef?.textoAtual ?? "";
|
||||
|
||||
if (atual === esperado) return this.success();
|
||||
|
||||
const msgErro =
|
||||
atual && typeof gameConfig?.mensagens?.textoErrado === "function"
|
||||
? gameConfig.mensagens.textoErrado(atual, esperado)
|
||||
: `Texto incorreto: "${atual}". O esperado é "${esperado}".`;
|
||||
|
||||
return this.failure(msgErro);
|
||||
}
|
||||
}
|
||||
|
||||
export function validationSolution(history, config, gameConfig, sceneRef) {
|
||||
const validator = new Exemplo2Validator();
|
||||
return validator.validate(history, config, gameConfig, sceneRef);
|
||||
}
|
||||
Reference in New Issue
Block a user