From 23e72ddd235cc24aaf29d0ccefc123ac84697f79 Mon Sep 17 00:00:00 2001 From: LBF38 Date: Tue, 3 Jan 2023 03:15:58 +0100 Subject: [PATCH] Cleaned assetNames --- .../org/enstabretagne/Utils/assetNames.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/duelinvaders/src/main/java/org/enstabretagne/Utils/assetNames.java b/duelinvaders/src/main/java/org/enstabretagne/Utils/assetNames.java index 2686f01..7f8d81a 100644 --- a/duelinvaders/src/main/java/org/enstabretagne/Utils/assetNames.java +++ b/duelinvaders/src/main/java/org/enstabretagne/Utils/assetNames.java @@ -6,7 +6,8 @@ /** * Classe contenant les noms des assets du jeu - * Cela permet d'éviter les risques de fautes de frappe et centralise l'ensemble des noms d'assets du jeu + * Cela permet d'éviter les risques de fautes de frappe et centralise l'ensemble + * des noms d'assets du jeu * * @author LBF38, MathieuDFS, jufch * @since 0.2.0 @@ -22,18 +23,20 @@ public static class textures { public static final String BACKGROUND = "background.png"; public static final String EXPLOSION_PLAYER = "explosion_player.png"; public static final String EXPLOSION_FINAL = "explosion_final.png"; - public static final ArrayList EXPLOSIONS = new ArrayList(); - static { - for (int i = 1; i <= Constant.NUMBER_OF_EXPLOSIONS; i++) { - EXPLOSIONS.add("explosion" + i + ".png"); + public static final ArrayList EXPLOSIONS = new ArrayList() { + { + for (int i = 1; i <= Constant.NUMBER_OF_EXPLOSIONS; i++) { + add("explosion" + i + ".png"); + } } - } - public static final ArrayList LIFES = new ArrayList(); - static { - for (int i = 1; i <= 3; i++) { - LIFES.add("life" + i + ".png"); + }; + public static final ArrayList LIFES = new ArrayList() { + { + for (int i = 1; i <= 3; i++) { + add("life" + i + ".png"); + } } - } + }; public static final String FIRE = "fire.png"; public static final String SMOKE = "smoke.png"; } @@ -54,18 +57,20 @@ public static class sounds { public static final String START_CLAIRON = "autre/claironStart.wav"; public static final String DEFEAT_CLAIRON = "autre/claironDefeat.wav"; public static final String VICTORY_CLAIRON = "autre/claironVictory.wav"; - public static final ArrayList AMBIENT_SOUNDS = new ArrayList(); - static { - for (int i = 1; i < Constant.NUMBER_OF_AMBIENT_SOUND + 1; i++) { - AMBIENT_SOUNDS.add("ambiance/ambientSound" + i + ".wav"); + public static final ArrayList AMBIENT_SOUNDS = new ArrayList() { + { + for (int i = 1; i < Constant.NUMBER_OF_AMBIENT_SOUND + 1; i++) { + add("ambiance/ambientSound" + i + ".wav"); + } } - } + }; public static final String CANNON_SHOT = "Tir/canon.wav"; - public static final ArrayList LASER_SOUNDS = new ArrayList<>(); - static { - for (int i = 1; i <= Constant.NUMBER_OF_LASER_SOUNDS; i++) { - LASER_SOUNDS.add("Tir/laser" + i + ".wav"); + public static final ArrayList LASER_SOUNDS = new ArrayList<>() { + { + for (int i = 1; i <= Constant.NUMBER_OF_LASER_SOUNDS; i++) { + add("Tir/laser" + i + ".wav"); + } } - } + }; } }