diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java index f59c23748..aa9aaa8b6 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java @@ -21,6 +21,7 @@ public class GameAreaDisplay extends UIComponent { private static final Logger logger = LoggerFactory.getLogger(GameAreaDisplay.class); private static final float Z_INDEX = 2f; // Dialog for displaying tower details + private static final String DEFAULT_STYLE = "default"; private Vector2[] towerPositions1; private Vector2[] towerPositions2; // Store the positions of the towers @@ -65,16 +66,13 @@ public void create() { addActors(); final Skin skin = new Skin(); - - - Image[] towers1 = new Image[2]; // Create an array for two towers Image[] towers2 = new Image[2]; // Create an array for two towers Image[] towers3 = new Image[3]; // Create an array for two towers // for (int i = 0; i < 2; i++) { // // Use "building1" for the first tower and "building2" for the second tower -// skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); +// skin.add(DEFAULT_STYLE, new Label.LabelStyle(new BitmapFont(), Color.WHITE)); // skin.add("building1", new Texture("images/towers/wallTower.png")); // // Load textures for building1 and building2 // towers1[i] = new Image(skin, "building1"); @@ -129,7 +127,7 @@ public void create() { // } // for (int i = 0; i < 2; i++) { // // Use "building1" for the first tower and "building2" for the second tower -// skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); +// skin.add(DEFAULT_STYLE, new Label.LabelStyle(new BitmapFont(), Color.WHITE)); // skin.add("building2", new Texture("images/towers/wallTower.png")); // towers2[i] = new Image(skin, "building2"); // towers2[i].setBounds(Gdx.graphics.getWidth() * 50f / 100f, Gdx.graphics.getHeight() * 80f / 100f, 100, 100); @@ -184,7 +182,7 @@ public void create() { // // for (int i = 0; i < 2; i++) { // // Use "building1" for the first tower and "building2" for the second tower -// skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); +// skin.add(DEFAULT_STYLE, new Label.LabelStyle(new BitmapFont(), Color.WHITE)); // skin.add("building3", new Texture("images/towers/mine_tower.png")); // // Load textures for building1 and building2 // towers3[i] = new Image(skin, "building3"); @@ -268,10 +266,10 @@ private Dialog createTowerDetailsDialog() { Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = new BitmapFont(); labelStyle.fontColor = Color.WHITE; - skin.add("default", labelStyle); + skin.add(DEFAULT_STYLE, labelStyle); // Create the dialog using the registered label style - Dialog dialog = new Dialog("Tower Details", skin,"default"); + Dialog dialog = new Dialog("Tower Details", skin,DEFAULT_STYLE); dialog.text("Health: 100"); // Set tower health here dialog.getContentTable().row(); dialog.text("Attack: 50"); // Set tower attack here @@ -280,7 +278,7 @@ private Dialog createTowerDetailsDialog() { return dialog; } private void addActors() { - title = new Label(this.gameAreaName, skin, "default"); + title = new Label(this.gameAreaName, skin, DEFAULT_STYLE); stage.addActor(title); }