/// <summary> /// Permet d'ajouter le chiffre validé (via son id) au code d'essai /// </summary> /// <param name="id"></param> public void addNumber(int id) { //Si on appuie sur la gâchette de la main gauche, alors on valide l'entrée d'un chiffre du code // Les id 10, 11 et 12 correspondent aux boutons Corriger, Valider et Annuler (respectivement) if (tryCode.text.Length < 4 && unChiffreEnPlusPasPlus) { switch (idCurrentButton) { case 11: isLocked = tryUnlock(tryCode.text); unChiffreEnPlusPasPlus = false; break; case 12: tryCode.text = ""; unChiffreEnPlusPasPlus = false; break; case 10: tryCode.text = tryCode.text.Substring(0, tryCode.text.Length - 1); unChiffreEnPlusPasPlus = false; break; default: tryCode.text += id; unChiffreEnPlusPasPlus = false; break; } } if (tryCode.text.Length == 4) { switch (idCurrentButton) { case 11: isLocked = tryUnlock(tryCode.text); unChiffreEnPlusPasPlus = false; break; case 12: tryCode.text = ""; unChiffreEnPlusPasPlus = false; break; case 10: tryCode.text = tryCode.text.Substring(0, tryCode.text.Length - 1); unChiffreEnPlusPasPlus = false; break; } if (tryUnlock(tryCode.text)) { isLocked = false; screenText.color = Color.green; screenText.text = "True"; TextDisplay message = new TextDisplay(); message.EndGame(); } else { tryCode.text = ""; screenText.color = Color.red; screenText.text = "Wrong \ncode"; } } }