Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/UQcsse3200/2024-studio-3 in…
Browse files Browse the repository at this point in the history
…to team1/debugging
  • Loading branch information
bhuynh3004 committed Oct 15, 2024
2 parents f1f3a8d + ab04717 commit af324e5
Show file tree
Hide file tree
Showing 34 changed files with 906 additions and 707 deletions.
Binary file modified source/core/assets/images/inventory_ui/chop_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/core/assets/images/inventory_ui/combine_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/core/assets/images/inventory_ui/cook_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/core/assets/images/inventory_ui/place_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/core/assets/images/inventory_ui/rotate_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/core/assets/images/inventory_ui/take_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ public class ForestGameArea extends GameArea {
"images/platecomponent/stackedplates/5plates.png",
"images/inventory_ui/slot.png",
"images/inventory_ui/null_image.png",
"images/inventory_ui/interact_key.png",
"images/inventory_ui/combine_key.png",
"images/inventory_ui/rotate_key.png",
"images/inventory_ui/chop_key.png",
"images/inventory_ui/place_key.png",
"images/inventory_ui/take_key.png",
"images/inventory_ui/submit_key.png",
"images/inventory_ui/dispose_key.png",
"images/inventory_ui/cook_key.png"
};
private static final String[] forestTextureAtlases = {
"images/Cutscenes/cutscene_badEnd.atlas",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.csse3200.game.GdxGame;
import com.csse3200.game.components.Component;
import com.csse3200.game.components.cutscenes.scenes.AnimatedScene;
import com.csse3200.game.components.cutscenes.scenes.Scene;
Expand Down Expand Up @@ -127,6 +128,7 @@ protected void nextCutscene() {
loadScene(currentSceneIndex);
} else {
logger.info("Cutscene finished. Triggering next event.");
ServiceLocator.getLevelService().setCurrLevel(GdxGame.LevelType.LEVEL_1);
ServiceLocator.getCutsceneScreen().getCutsceneScreenDisplay().getEntity().getEvents().trigger("cutsceneEnded");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.csse3200.game.GdxGame;
import com.csse3200.game.services.ServiceLocator;
import com.csse3200.game.ui.UIComponent;
import com.csse3200.game.components.maingame.TextDisplay;
import org.slf4j.Logger;
Expand Down Expand Up @@ -67,6 +69,7 @@ private void setupUI() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
logger.info("Backstory skipped.");
ServiceLocator.getLevelService().setCurrLevel(GdxGame.LevelType.LEVEL_1);
entity.getEvents().trigger("cutsceneEnded"); // Trigger skip
}
});
Expand Down Expand Up @@ -118,7 +121,7 @@ public void dispose() {
super.dispose();

if (table != null) {
table.clear(); // Clear the table safely
table.clear();
}
if (textDisplay != null && textDisplay.getTable() != null) {
textDisplay.getTable().clear(); // Clear the text display table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void initialiseAcceptableCustomers() {
levelFive.add("LEWIS");

acceptableCustomers = new HashMap<>();
acceptableCustomers.put(GdxGame.LevelType.LEVEL_0, levelOne);
acceptableCustomers.put(GdxGame.LevelType.LEVEL_1, levelOne);
acceptableCustomers.put(GdxGame.LevelType.LEVEL_2, levelTwo);
acceptableCustomers.put(GdxGame.LevelType.LEVEL_3, levelThree);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,70 @@
package com.csse3200.game.components.mainmenu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.csse3200.game.components.maingame.PauseMenuDisplay;
import com.csse3200.game.services.ServiceLocator;
import com.csse3200.game.ui.UIComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MainMenuBackground extends UIComponent{

private Table table;
private static final Logger logger = LoggerFactory.getLogger(PauseMenuDisplay.class);
private static final String[] backgroundTextures = {"images/Cutscenes/bg.png"};

private float screenWidth = Gdx.graphics.getWidth();
private float screenHeight = Gdx.graphics.getHeight();
private String image;

public MainMenuBackground() {
super();
}

@Override
public void create() {
super.create();
table = new Table();
table.setFillParent(true);
table.setVisible(true);
stage.addActor(table);
ServiceLocator.getResourceService().loadTextures(backgroundTextures);

setupBackground();
}

public void setupBackground() {
Texture texture = ServiceLocator.getResourceService().getAsset("images/Cutscenes/bg.png",
Texture.class);
Image image = new Image(texture);
image.setFillParent(true);
setImage("images/Cutscenes/bg.png");
table.add(image);
}

@Override
protected void draw(SpriteBatch batch) {
}

@Override
public void setStage(Stage mock) {
}

public void setTable(Table table) {
this.table = table;
}

public void setImage(String image){
this.image = image;
}

public String getImage(){
return this.image;
}

public String getImage(Table table){
return table.getChildren().get(0).toString();
}


public class MainMenuBackground extends UIComponent {

private Table table;
private static final Logger logger = LoggerFactory.getLogger(MainMenuBackground.class); // Updated to use MainMenuBackground.class
private static final String BACKGROUND_IMAGE_PATH = "images/Cutscenes/bg.png"; // Defined constant for repeated string
private static final String[] backgroundTextures = {BACKGROUND_IMAGE_PATH};

private String image;

public MainMenuBackground() {
super();
}

@Override
public void create() {
super.create();
table = new Table();
table.setFillParent(true);
table.setVisible(true);
stage.addActor(table);
ServiceLocator.getResourceService().loadTextures(backgroundTextures);

setupBackground();
}

public void setupBackground() {
Texture texture = ServiceLocator.getResourceService().getAsset(BACKGROUND_IMAGE_PATH, Texture.class); // Used constant for image path
Image bgImage = new Image(texture); // Renamed local variable to avoid conflict with the field 'image'
bgImage.setFillParent(true);
setImage(BACKGROUND_IMAGE_PATH);
table.add(bgImage);
}

@Override
protected void draw(SpriteBatch batch) {
// Method intentionally left empty (addressed empty method warning)
}

@Override
public void setStage(Stage mock) {
// Method intentionally left empty (addressed empty method warning)
}

public void setTable(Table table) {
this.table = table;
}

public void setImage(String image) {
this.image = image;
}

public String getImage() {
return this.image;
}

public String getImage(Table table) {
return table.getChildren().get(0).toString();
}
}

Loading

0 comments on commit af324e5

Please sign in to comment.