-
Notifications
You must be signed in to change notification settings - Fork 4
ChooserGUI_Persistence
The integration of background music chooser GUI into code involves making a music icon which will be shown on each screen. Clicking on the music icon will open a dialog containing two radio buttons with background music names. The choice of the user will be persisted in local storage. The user should also be given an option to disable background music for a particular screen.
BackgroundMusic.java: Location
Function | Returns | Description |
---|---|---|
getAllMusicByScreen(String screenName) | String[] | Fetch all music paths for a particular screen, empty if no associated music. |
containsScreenMusic(String screenName) | Boolean | Checks if a particular screen has associated background music. Returns true if the screen has some background music, false otherwise |
selectMusic(String screenName, String trackPath) | void | Selects a new background music and persists the choice in a JSON file stored in the 'DECO2800' folder in external location. The file's name is 'backgroundMusic.json' which contains a mapping of screen name and chosen track. |
getSelectedMusic(String screenName) | String | Get selected music track for the supplied screen name, defaults to the first choice that is provided in backgroundMusic.json |
isSelected(String screenName, String trackName) | Boolean | Check if a particular track is the selected one or not. If it is selected, return true and false otherwise. |
getNotSelectedTrack(String screenName) | String | Get the first non-selected track of a screen, if any. |
The music is fetched for a particular screen when its entity is registered.
Usage: A simple method call specifying the screen name and selected track path
BackgroundMusic.selectMusic(screenName, trackPath);
// Example
BackgroundMusic.selectMusic("MainGame", "sounds/customBgm/game1.mp3");
Persisting the choice of the user: Stores choice as a mapping of screen name (key) and track name (value).
/**
* Selects a new background music and persists the choice
*
* @param screenName name of the screen
* @param trackPath path of the track
*/
public static void selectMusic(String screenName, String trackPath) {
Map<String, String> chosenMusic = getAllChosenMusic();
chosenMusic.put(screenName, trackPath);
setChosenMusic(chosenMusic);
}
Fetching the choice of the user(which defaults to the first track if nothing was selected):
/**
* Get selected music track for the supplied screen name, defaults to
* the first choice that is provided in backgroundMusic.json
*
* @param screenName name of screen
* @return trackPath path of the chosen track, defaults to the first track
*/
public static String getSelectedMusic(String screenName) {
String defaultTrack = "";
if (containsScreenMusic(screenName)) {
defaultTrack = getAllMusicByScreen(screenName)[0];
}
return getAllChosenMusic().getOrDefault(screenName, defaultTrack);
}
Track choices for all screens are fetched through assets/configs/backgroundMusic.json
which can be found here.
/**
* Fetch the mapping of screen name and associated background music paths
*
* @return music mapping of screen name and music paths
*/
private static Map<String, String[]> getAllMusic() {
MusicList musicList =
FileLoader.readClass(MusicList.class, "configs/backgroundMusic.json");
if (musicList == null) {
musicList = new MusicList();
}
return musicList.music;
}
Camera Angle and The Player's Perspective
Achievements Trophies and Cards
πΎ Obstacle/Enemy
βMonster Manual
βObstacles/Enemies
ββ- Alien Plants
ββ- Variation thorns
ββ- Falling Meteorites
ββ- FaceHugger
ββ- AlienMonkey
βSpaceship & Map Entry
βParticle effect
[code for debuff animations](code for debuff animations)
Main Character Movement, Interactions and Animations - Code Guidelines
ItemBar & Recycle system
πΎ Obstacle/Enemy
βObstacle/Enemy
βMonster Manual
βSpaceship Boss
βParticle effects
βOther Related Code
βUML & Sequence diagram of enemies/obstacles
Scoring System Implementation Explanation
Buff and Debuff Implementation
Infinite generating terrains Implementation Explanation
Game Over Screen and functions explaination
Buffer timer before game start
Rocks and woods layout optimization
Magma and nails code implementation
Guide: Adding Background music for a particular screen
History Scoreboard - Score Details
Listening for important events in the Achievements ecosystem
Hunger and Thirst icon code guidelines
Hunger and Thirst User Testing
Buff and Debuff Manual User Testing
The New Button User Test in Setting Page
The Main Menu Buttons User Testing
Infinite loop game and Terrain Testing
https://github.com/UQdeco2800/2021-ext-studio-2.wiki.git
πΎ Obstacle/Enemy
βObstacle testing
ββ- Alien Plants & Variation Thorns
ββ- Falling Meteorites
βEnemy testing
ββ- Alien Monkeys & Facehugger
ββ- Spaceship Boss
βMonster Manual
βParticle-effect
βPlayer attack testing
ββ- Player Attack
Sprint 1
Sprint 2
Sprint 3
Sprint 4
Changeable background & Buffer time testing
Game over screen test sprint 4
New terrain textures on bonus map test sprint 4
Achievements System, Game Records and Unlockable Chapters
Musics Implementation Testing plan