Beatmap downloader improvements and fixes.

Updates:
- Added some buttons to downloads menu: clear inactive downloads, import beatmaps, reset search, and show/hide unranked maps.
- Small changes to OsuParser, OszUnpacker, and OsuGroupList (mostly adding return values) to allow parsing only newly unpacked beatmaps.
- Added alpha fade hover effect to MenuButton, as an alternative to expanding (used for 3-part menu buttons).
- Added text rendering fields to MenuButton (also for the 3-part menu buttons).
- Added sound effects to downloads menu.

Fixes:
- Check downloads for illegal filename characters, and remove them if necessary.
- The number of results and downloads shown now supports all resolutions.
- Confirmation dialog no longer appears when restarting the application (since downloads are static).
- Do not set a focus node immediately if the theme song will be played.
- Always play the theme song if no songs are loaded (even if disabled in settings).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-02-02 00:15:16 -05:00
parent cfc0449ab2
commit ec90d6fd03
20 changed files with 517 additions and 183 deletions

View File

@@ -220,7 +220,7 @@ public class SongMenu extends BasicGameState {
// options button
Image optionsIcon = GameImage.MENU_OPTIONS.getImage();
optionsButton = new MenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
optionsButton.setHoverScale(1.75f);
optionsButton.setHoverExpand(1.75f);
// loader
int loaderDim = GameImage.MENU_MUSICNOTE.getImage().getWidth();
@@ -565,8 +565,7 @@ public class SongMenu extends BasicGameState {
case Input.KEY_ESCAPE:
if (reloadThread != null) {
// beatmap reloading: stop parsing OsuFiles by sending interrupt to OsuParser
if (reloadThread != null)
reloadThread.interrupt();
reloadThread.interrupt();
} else if (!search.getText().isEmpty()) {
// clear search text
search.setText("");
@@ -626,7 +625,7 @@ public class SongMenu extends BasicGameState {
if (OsuGroupList.get().size() > 0) {
OsuGroupList.get().init();
setFocus(OsuGroupList.get().getRandomNode(), -1, true);
} else if (Options.isThemSongEnabled())
} else
MusicController.playThemeSong();
reloadThread = null;
@@ -756,15 +755,15 @@ public class SongMenu extends BasicGameState {
public void enter(GameContainer container, StateBasedGame game)
throws SlickException {
Display.setTitle(game.getTitle());
Utils.getBackButton().setScale(1f);
optionsButton.setScale(1f);
Utils.getBackButton().resetHover();
optionsButton.resetHover();
hoverOffset = 0f;
hoverIndex = -1;
startScore = 0;
// stop playing the theme song
if (MusicController.isThemePlaying() && focusNode != null)
MusicController.play(focusNode.osuFiles.get(focusNode.osuFileIndex), true);
// set focus node if not set (e.g. theme song playing)
if (focusNode == null && OsuGroupList.get().size() > 0)
setFocus(OsuGroupList.get().getRandomNode(), -1, true);
// reset music track
else if (resetTrack) {