Quick fixes.
- Fixed a crash when closing the application in the ranking screen when viewing a score. - Fixed a minor bug where OsuGroupList fields were not being erased upon restart. - Dim the track volume by 50% when viewing a score. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
ce15f25ca1
commit
2007058eb1
|
@ -95,6 +95,10 @@ public class Container extends AppGameContainer {
|
|||
|
||||
// prevent loading tracks from re-initializing OpenAL
|
||||
MusicController.reset();
|
||||
|
||||
// reset OsuGroupList data
|
||||
if (OsuGroupList.get() != null)
|
||||
OsuGroupList.get().reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -175,12 +175,20 @@ public class Opsu extends StateBasedGame {
|
|||
if (id == STATE_GAME || id == STATE_GAMEPAUSEMENU || id == STATE_GAMERANKING) {
|
||||
// start playing track at preview position
|
||||
SongMenu songMenu = (SongMenu) this.getState(Opsu.STATE_SONGMENU);
|
||||
songMenu.resetGameDataOnLoad();
|
||||
if (id == STATE_GAME) {
|
||||
MusicController.pause();
|
||||
MusicController.resume();
|
||||
} else
|
||||
songMenu.resetTrackOnLoad();
|
||||
if (id == STATE_GAMERANKING) {
|
||||
GameData data = ((GameRanking) this.getState(Opsu.STATE_GAMERANKING)).getGameData();
|
||||
if (data != null && data.isGameplay()) {
|
||||
songMenu.resetGameDataOnLoad();
|
||||
songMenu.resetTrackOnLoad();
|
||||
}
|
||||
} else {
|
||||
songMenu.resetGameDataOnLoad();
|
||||
if (id == STATE_GAME) {
|
||||
MusicController.pause();
|
||||
MusicController.resume();
|
||||
} else
|
||||
songMenu.resetTrackOnLoad();
|
||||
}
|
||||
Utils.resetCursor();
|
||||
this.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
return false;
|
||||
|
|
|
@ -48,10 +48,10 @@ public class OsuGroupList {
|
|||
private ArrayList<OsuGroupNode> nodes;
|
||||
|
||||
/** Index of current expanded node (-1 if no node is expanded). */
|
||||
private int expandedIndex = -1;
|
||||
private int expandedIndex;
|
||||
|
||||
/** The last search query. */
|
||||
private String lastQuery = "";
|
||||
private String lastQuery;
|
||||
|
||||
/**
|
||||
* Creates a new instance of this class (overwriting any previous instance).
|
||||
|
@ -68,7 +68,17 @@ public class OsuGroupList {
|
|||
*/
|
||||
private OsuGroupList() {
|
||||
parsedNodes = new ArrayList<OsuGroupNode>();
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the list's fields.
|
||||
* This does not erase any parsed nodes.
|
||||
*/
|
||||
public void reset() {
|
||||
nodes = parsedNodes;
|
||||
expandedIndex = -1;
|
||||
lastQuery = "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,10 +289,11 @@ public class MusicController {
|
|||
|
||||
/**
|
||||
* Toggles the volume dim state of the current track.
|
||||
* @param multiplier the volume multiplier when the track is dimmed
|
||||
*/
|
||||
public static void toggleTrackDimmed() {
|
||||
public static void toggleTrackDimmed(float multiplier) {
|
||||
float volume = Options.getMusicVolume() * Options.getMasterVolume();
|
||||
setVolume((trackDimmed) ? volume : volume / 3f);
|
||||
setVolume((trackDimmed) ? volume : volume * multiplier);
|
||||
trackDimmed = !trackDimmed;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,10 @@ public class GameRanking extends BasicGameState {
|
|||
throws SlickException {
|
||||
Display.setTitle(game.getTitle());
|
||||
Utils.getBackButton().setScale(1f);
|
||||
if (data.isGameplay())
|
||||
if (!data.isGameplay()) {
|
||||
if (!MusicController.isTrackDimmed())
|
||||
MusicController.toggleTrackDimmed(0.5f);
|
||||
} else
|
||||
SoundController.playSound(SoundEffect.APPLAUSE);
|
||||
}
|
||||
|
||||
|
@ -199,7 +202,10 @@ public class GameRanking extends BasicGameState {
|
|||
* Sets the associated GameData object.
|
||||
* @param data the GameData
|
||||
*/
|
||||
public void setGameData(GameData data) {
|
||||
this.data = data;
|
||||
}
|
||||
public void setGameData(GameData data) { this.data = data; }
|
||||
|
||||
/**
|
||||
* Returns the current GameData object (usually null unless state active).
|
||||
*/
|
||||
public GameData getGameData() { return data; }
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class MainMenu extends BasicGameState {
|
|||
// window focus change: increase/decrease theme song volume
|
||||
if (MusicController.isThemePlaying() &&
|
||||
MusicController.isTrackDimmed() == container.hasFocus())
|
||||
MusicController.toggleTrackDimmed();
|
||||
MusicController.toggleTrackDimmed(0.33f);
|
||||
|
||||
// fade in background
|
||||
if (bgAlpha < 0.9f) {
|
||||
|
|
|
@ -777,6 +777,10 @@ public class SongMenu extends BasicGameState {
|
|||
else if (MusicController.isPaused())
|
||||
MusicController.resume();
|
||||
|
||||
// undim track
|
||||
if (MusicController.isTrackDimmed())
|
||||
MusicController.toggleTrackDimmed(1f);
|
||||
|
||||
// reset song stack
|
||||
randomStack = new Stack<SongNode>();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user