-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/t3branch' into t3branch
# Conflicts: # source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java
- Loading branch information
Showing
11 changed files
with
476 additions
and
48 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
source/core/src/main/com/csse3200/game/screens/HelpScreen/HelpContinueButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.csse3200.game.screens.HelpScreen; | ||
|
||
|
||
import com.badlogic.gdx.audio.Sound; | ||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
import com.badlogic.gdx.scenes.scene2d.Actor; | ||
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.components.maingame.MainGamePauseDisplay; | ||
import com.csse3200.game.entities.Entity; | ||
import com.csse3200.game.entities.factories.PauseMenuFactory; | ||
import com.csse3200.game.services.ServiceLocator; | ||
|
||
import com.csse3200.game.ui.ButtonFactory; | ||
import com.csse3200.game.ui.UIComponent; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Displays a button in the pause menu to resume the game and put away the pause menu. | ||
*/ | ||
public class HelpContinueButton extends UIComponent { | ||
private static final Logger logger = LoggerFactory.getLogger(com.csse3200.game.components.pausemenu.PauseMenuContinueButton.class); | ||
private static final float Z_INDEX = 2f; | ||
private Table table; | ||
private Table table1; | ||
private GdxGame game; | ||
private final String[] sounds = { | ||
"sounds/ui/Open_Close/NA_SFUI_Vol1_Close_01.ogg" | ||
}; | ||
private Sound closeSound; | ||
|
||
@Override | ||
public void create() { | ||
super.create(); | ||
addActors(); | ||
loadSounds(); | ||
} | ||
|
||
private void addActors() { | ||
table = new Table(); | ||
table.center(); | ||
table.setFillParent(true); | ||
ButtonFactory buttonFactory = new ButtonFactory(); | ||
// TextButton pauseMenuBtn = buttonFactory.createButton("Continue"); | ||
TextButton pauseMenuBtn = new TextButton("Continue", skin); | ||
|
||
// Triggers an event when the button is pressed. | ||
pauseMenuBtn.addListener( | ||
new ChangeListener() { | ||
@Override | ||
public void changed(ChangeEvent changeEvent, Actor actor) { | ||
logger.debug("Continue button clicked"); | ||
closeSound.play(0.4f); | ||
entity.dispose(); | ||
NextButtonMenu.nextMenu(game); | ||
|
||
} | ||
}); | ||
|
||
table.add(pauseMenuBtn); | ||
stage.addActor(table); | ||
|
||
} | ||
|
||
@Override | ||
public void draw(SpriteBatch batch) { | ||
// draw is handled by the renderer component | ||
} | ||
|
||
@Override | ||
public float getZIndex() { | ||
return Z_INDEX; | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
table.clear(); | ||
super.dispose(); | ||
} | ||
|
||
public void loadSounds() { | ||
ServiceLocator.getResourceService().loadSounds(sounds); | ||
ServiceLocator.getResourceService().loadAll(); | ||
closeSound = ServiceLocator.getResourceService().getAsset(sounds[0], Sound.class); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
source/core/src/main/com/csse3200/game/screens/HelpScreen/NextButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.csse3200.game.screens.HelpScreen; | ||
|
||
|
||
|
||
import com.badlogic.gdx.audio.Sound; | ||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
import com.badlogic.gdx.scenes.scene2d.Actor; | ||
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.entities.Entity; | ||
import com.csse3200.game.entities.factories.PauseMenuFactory; | ||
import com.csse3200.game.services.ServiceLocator; | ||
import com.csse3200.game.ui.UIComponent; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Displays a button to pause the game and bring up a pause menu. | ||
*/ | ||
public class NextButton extends UIComponent { | ||
private static final Logger logger = LoggerFactory.getLogger(com.csse3200.game.screens.HelpScreen.NextButton.class); | ||
private static final float Z_INDEX = 2f; | ||
private Table table; | ||
private GdxGame game; | ||
private final String[] sounds = { | ||
"sounds/ui/Open_Close/NA_SFUI_Vol1_Open_01.ogg" | ||
}; | ||
private Sound openSound; | ||
|
||
|
||
public NextButton(GdxGame screenSwitchHandle) { | ||
game = screenSwitchHandle; | ||
} | ||
|
||
@Override | ||
public void create() { | ||
super.create(); | ||
addActors(); | ||
loadSounds(); | ||
} | ||
|
||
private void addActors() { | ||
table = new Table(); | ||
table.top().right(); | ||
table.setFillParent(true); | ||
|
||
TextButton mainMenuBtn = new TextButton("Pause", skin); | ||
|
||
// Spawns a pause menu when the button is pressed. | ||
mainMenuBtn.addListener( | ||
new ChangeListener() { | ||
@Override | ||
public void changed(ChangeEvent changeEvent, Actor actor) { | ||
logger.debug("Pause button clicked"); | ||
openSound.play(0.4f); | ||
// PauseMenuFactory.createPauseMenu(game, false); | ||
PauseMenuFactory.createPauseMenu(game); | ||
|
||
} | ||
}); | ||
|
||
table.add(mainMenuBtn).padTop(100f).padRight(10f); | ||
|
||
stage.addActor(table); | ||
} | ||
|
||
@Override | ||
public void draw(SpriteBatch batch) { | ||
// draw is handled by the stage | ||
} | ||
|
||
@Override | ||
public float getZIndex() { | ||
return Z_INDEX; | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
table.clear(); | ||
super.dispose(); | ||
} | ||
|
||
public void loadSounds() { | ||
ServiceLocator.getResourceService().loadSounds(sounds); | ||
ServiceLocator.getResourceService().loadAll(); | ||
openSound = ServiceLocator.getResourceService().getAsset(sounds[0], Sound.class); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
source/core/src/main/com/csse3200/game/screens/HelpScreen/NextButtonMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.csse3200.game.screens.HelpScreen; | ||
|
||
import com.badlogic.gdx.graphics.Color; | ||
import com.badlogic.gdx.graphics.g2d.BitmapFont; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Label; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Table; | ||
import com.csse3200.game.GdxGame; | ||
import com.csse3200.game.components.pausemenu.*; | ||
import com.csse3200.game.entities.Entity; | ||
import com.csse3200.game.rendering.TextureRenderComponent; | ||
import com.csse3200.game.services.ServiceLocator; | ||
import com.badlogic.gdx.utils.Array; | ||
|
||
import static com.badlogic.gdx.utils.Align.center; | ||
import static com.badlogic.gdx.utils.Align.top; | ||
|
||
public class NextButtonMenu { | ||
|
||
public static Entity nextMenu(GdxGame game) { | ||
|
||
Entity Menu = new Entity() | ||
.addComponent(new PauseMenuTimeStopComponent()) | ||
.addComponent(new NextContinueButton()) | ||
.addComponent(new TowerSelectionInstruct()); | ||
Menu.setScale(8, 8.2f); | ||
Menu.setPosition(6.3f,2f); | ||
|
||
ServiceLocator.getEntityService().register(Menu); | ||
return Menu; | ||
|
||
} | ||
} | ||
|
89 changes: 89 additions & 0 deletions
89
source/core/src/main/com/csse3200/game/screens/HelpScreen/NextContinueButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.csse3200.game.screens.HelpScreen; | ||
|
||
|
||
import com.badlogic.gdx.audio.Sound; | ||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
import com.badlogic.gdx.scenes.scene2d.Actor; | ||
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.components.maingame.MainGamePauseDisplay; | ||
import com.csse3200.game.entities.Entity; | ||
import com.csse3200.game.entities.factories.PauseMenuFactory; | ||
import com.csse3200.game.services.ServiceLocator; | ||
|
||
import com.csse3200.game.ui.ButtonFactory; | ||
import com.csse3200.game.ui.UIComponent; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
||
/** | ||
* Displays a button in the pause menu to resume the game and put away the pause menu. | ||
*/ | ||
public class NextContinueButton extends UIComponent { | ||
private static final Logger logger = LoggerFactory.getLogger(com.csse3200.game.components.pausemenu.PauseMenuContinueButton.class); | ||
private static final float Z_INDEX = 2f; | ||
private Table table1; | ||
private GdxGame game; | ||
private final String[] sounds = { | ||
"sounds/ui/Open_Close/NA_SFUI_Vol1_Close_01.ogg" | ||
}; | ||
private Sound closeSound; | ||
|
||
@Override | ||
public void create() { | ||
super.create(); | ||
addActors(); | ||
loadSounds(); | ||
} | ||
|
||
private void addActors() { | ||
|
||
table1 = new Table(); | ||
|
||
table1.setFillParent(true); | ||
// TextButton NextMenuBtn = buttonFactory.createButton("Continue"); | ||
TextButton NextMenuBtn = new TextButton("Continue", skin); | ||
|
||
// Triggers an event when the button is pressed. | ||
NextMenuBtn.addListener( | ||
new ChangeListener() { | ||
@Override | ||
public void changed(ChangeEvent changeEvent, Actor actor) { | ||
logger.debug("Continue button clicked"); | ||
closeSound.play(0.4f); | ||
entity.dispose(); | ||
|
||
} | ||
}); | ||
|
||
table1.add(NextMenuBtn); | ||
stage.addActor(table1); | ||
table1.top().right(); | ||
table1.padTop(240f).padRight(100f); | ||
} | ||
|
||
@Override | ||
public void draw(SpriteBatch batch) { | ||
// draw is handled by the renderer component | ||
} | ||
|
||
@Override | ||
public float getZIndex() { | ||
return Z_INDEX; | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
table1.clear(); | ||
super.dispose(); | ||
} | ||
|
||
public void loadSounds() { | ||
ServiceLocator.getResourceService().loadSounds(sounds); | ||
ServiceLocator.getResourceService().loadAll(); | ||
closeSound = ServiceLocator.getResourceService().getAsset(sounds[0], Sound.class); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
source/core/src/main/com/csse3200/game/screens/HelpScreen/PauseCompTutorial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.csse3200.game.screens.HelpScreen; | ||
|
||
|
||
|
||
import com.csse3200.game.GdxGame; | ||
import com.csse3200.game.components.pausemenu.*; | ||
import com.csse3200.game.entities.Entity; | ||
import com.csse3200.game.rendering.TextureRenderComponent; | ||
import com.csse3200.game.services.ServiceLocator; | ||
import com.badlogic.gdx.utils.Array; | ||
|
||
import static com.badlogic.gdx.utils.Align.center; | ||
|
||
public class PauseCompTutorial { | ||
|
||
public static Entity TutorialMenu(GdxGame game) { | ||
|
||
Entity TutorialMenu = new Entity() | ||
.addComponent(new PauseMenuTimeStopComponent()) | ||
.addComponent(new HelpContinueButton()) | ||
.addComponent(new TextureRenderComponent("images/HelpScreen/hs.jpg")); | ||
TutorialMenu.setScale(16, 8.2f); | ||
TutorialMenu.setPosition(center+1.3f, center); | ||
ServiceLocator.getEntityService().register(TutorialMenu); | ||
return TutorialMenu; | ||
|
||
} | ||
} |
Oops, something went wrong.