public void TestGetValueInvalide() { StringTable st = StringTable.GetInstance(); Assert.AreNotEqual(st.GetValue(Language.English, "ID_TOTAL_TIME"), "Temps total"); }
public void TestItemsManquants3() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(ErrorCode.MISSING_FIELD, st.Parse(@" ==> Temps total---Total time ==>Vie--- Life")); }
public void TestGetValueValide() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(st.GetValue(Language.French, "ID_TOTAL_TIME"), "Temps total"); }
public void TestItemManquant2() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(ErrorCode.MISSING_FIELD, st.Parse(@"ID_TOTAL_TIME==>Temps totalTotal timeID_LIFE==>VieLife")); }
public void TestContenueIncorrect() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(ErrorCode.MISSING_FIELD, st.Parse("sdgsfgsdfgsfdg")); }
public void TestFichierCorrect() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(ErrorCode.OK, st.Parse(File.ReadAllText("Data/st.txt"))); }
public void TestFichierVide() { StringTable st = StringTable.GetInstance(); Assert.AreEqual(ErrorCode.MISSING_FIELD, st.Parse("")); }
/// <summary> /// Méthode qui est appelée une fois par frame pour dessiner tout les objets à l'écran. /// </summary> public void Draw() { // Update Camera position view.Center = new Vector2f(((1f / 11f) * hero.Position.X + (10f / 11f) * GAME_WIDTH / 2), ((1f / 11f) * hero.Position.Y + (10f / 11f) * GAME_HEIGHT / 2)); window.SetView(view); // Parcourez les listes appropriées pour faire afficher les éléments demandés. foreach (var projectile in projectiles) { projectile.Draw(window); } foreach (var star in stars) { star.Draw(window); } foreach (var wall in walls) { wall.Draw(window); } foreach (var particle in fragmentParticles) { particle.Draw(window); } foreach (var particle in smokeParticles) { particle.Draw(window); } foreach (var character in enemies) { character.Draw(window); } hero.Draw(window); #region Draw Text if (!GameIsRunning) { PauseScreen pauseScreen = new PauseScreen(0, 0, 4); pauseScreen.Draw(window); // Pause text text.DisplayedString = $"{StringTable.GetInstance().GetValue(CurrentLanguage, "ID_PAUSE")}"; text.Position = new Vector2f(Game.GAME_WIDTH / 2 - (text.DisplayedString.Length * text.CharacterSize) / 2, GAME_HEIGHT / 2 - text.CharacterSize); window.Draw(text); // Start prompt text if (controller.ControllerIsPluggedIn()) { text.DisplayedString = $"{StringTable.GetInstance().GetValue(CurrentLanguage, "ID_START_PROMPT")}"; } else { text.DisplayedString = $"{StringTable.GetInstance().GetValue(CurrentLanguage, "ID_START_KEYBOARD_PROMPT")}"; } text.CharacterSize = 18; text.Position = new Vector2f(Game.GAME_WIDTH / 2 - (text.DisplayedString.Length * text.CharacterSize) / 2, GAME_HEIGHT / 2 + text.CharacterSize); window.Draw(text); // Debug enemy spawning text text.DisplayedString = $"{StringTable.GetInstance().GetValue(CurrentLanguage, "ID_CONTROL_DEBUG")}"; text.Position = new Vector2f(Game.GAME_WIDTH / 2 - (text.DisplayedString.Length * text.CharacterSize) / 2, GAME_HEIGHT / 2 + text.CharacterSize * 2 + 5); window.Draw(text); // How to use bomb text text.DisplayedString = $"{StringTable.GetInstance().GetValue(CurrentLanguage, "ID_CONTROL_BOMB")}"; text.Position = new Vector2f(Game.GAME_WIDTH / 2 - (text.DisplayedString.Length * text.CharacterSize) / 2, GAME_HEIGHT / 2 + text.CharacterSize * 3 + 10); window.Draw(text); text.CharacterSize = 25; } // Temps total float timeElapsed = Stopwatch.ElapsedMilliseconds; timeElapsed /= 1000; timeElapsed = (float)Math.Round(timeElapsed, 2); text.DisplayedString = string.Format("{1} = {0,-5}", timeElapsed, StringTable.GetInstance().GetValue(CurrentLanguage, "ID_TOTAL_TIME")); text.Position = new Vector2f(0, GAME_HEIGHT + 5); window.Draw(text); // Points de vie text.DisplayedString = string.Format("{1} = {0,-4}", hero.life, StringTable.GetInstance().GetValue(CurrentLanguage, "ID_LIFE")); text.Position = new Vector2f(GAME_WIDTH - text.DisplayedString.Length * text.CharacterSize, -text.CharacterSize - 5); window.Draw(text); // Number of bombs text.DisplayedString = string.Format("{1} = {0,-4}", hero.nbBombs, StringTable.GetInstance().GetValue(CurrentLanguage, "ID_BOMBS")); text.Position = new Vector2f(Game.GAME_WIDTH / 2 - (text.DisplayedString.Length * text.CharacterSize) / 2, -text.CharacterSize - 5); window.Draw(text); // Score text.DisplayedString = string.Format("{1} = {0,-4}", score.GetScore(), StringTable.GetInstance().GetValue(CurrentLanguage, "ID_SCORE")); text.Position = new Vector2f(0, -text.CharacterSize - 5); window.Draw(text); // FPS framesPerSecond++; if (fps.Elapsed > TimeSpan.FromMilliseconds(1000)) { fpsTemp = framesPerSecond; fps.Restart(); framesPerSecond = 0; } text.Position = new Vector2f(GAME_WIDTH - 250, GAME_HEIGHT + 5); text.DisplayedString = string.Format("{1} = {0,-4}", fpsTemp, "FPS"); window.Draw(text); #endregion }