diff --git a/core/src/zero1hd/rhythmbullet/audio/MusicInfo.java b/core/src/zero1hd/rhythmbullet/audio/MusicInfo.java index ea7d7f3..8787d27 100755 --- a/core/src/zero1hd/rhythmbullet/audio/MusicInfo.java +++ b/core/src/zero1hd/rhythmbullet/audio/MusicInfo.java @@ -33,6 +33,7 @@ public class MusicInfo implements Disposable { private FileHandle musicFile; private Preferences musicAnnotation; + public MusicInfo(FileHandle musicFile, Preferences musicAnnotation) { this.musicFile = musicFile; this.musicAnnotation = musicAnnotation; @@ -103,6 +104,7 @@ public class MusicInfo implements Disposable { * @return */ public Texture loadTexture() { + Gdx.app.debug("MusicInfo", "Texture loading for music: " + getMusicName()); if (Gdx.files.external("RhythmBullet/AlbumArt/" + musicFile.name() + ".png").exists()) { return new Texture(Gdx.files.external("RhythmBullet/AlbumArt/" + musicFile.name() + ".png")); } else { diff --git a/core/src/zero1hd/rhythmbullet/audio/MusicInfoController.java b/core/src/zero1hd/rhythmbullet/audio/MusicInfoController.java index a49bbf2..258ebf4 100755 --- a/core/src/zero1hd/rhythmbullet/audio/MusicInfoController.java +++ b/core/src/zero1hd/rhythmbullet/audio/MusicInfoController.java @@ -36,7 +36,7 @@ public class MusicInfoController implements Disposable { } songInfoArray.clear(); exec.submit(() -> { - for (int i = 0; i < musicList.getAmountOfMusic(); i++) { + for (int i = 0; i < musicList.getTotal(); i++) { MusicInfo musicInfo = new MusicInfo(musicList.getMusicList().get(i), musicAnnotation); musicInfo.loadInfo(); songInfoArray.add(musicInfo); diff --git a/core/src/zero1hd/rhythmbullet/audio/MusicList.java b/core/src/zero1hd/rhythmbullet/audio/MusicList.java index 96214fb..933ae66 100755 --- a/core/src/zero1hd/rhythmbullet/audio/MusicList.java +++ b/core/src/zero1hd/rhythmbullet/audio/MusicList.java @@ -102,7 +102,7 @@ public class MusicList extends Observable { return getAudioData(musicList.get(index)); } - public int getAmountOfMusic() { + public int getTotal() { return musicList.size; } diff --git a/core/src/zero1hd/rhythmbullet/audio/MusicListController.java b/core/src/zero1hd/rhythmbullet/audio/MusicListController.java index 8af3040..b3ace6d 100755 --- a/core/src/zero1hd/rhythmbullet/audio/MusicListController.java +++ b/core/src/zero1hd/rhythmbullet/audio/MusicListController.java @@ -65,8 +65,8 @@ public class MusicListController extends Observable implements OnCompletionListe public void onCompletion(Music music) { if (autoPlay) { if (shuffle) { - if (musicList.getAmountOfMusic() != 0) { - currentPlaybackID = rand.nextInt(musicList.getAmountOfMusic()); + if (musicList.getTotal() != 0) { + currentPlaybackID = rand.nextInt(musicList.getTotal()); } else { currentPlaybackID = 0; } @@ -83,10 +83,10 @@ public class MusicListController extends Observable implements OnCompletionListe * @param load whether this method should also make sure to load the music, dispose of the last one, etc. Normally called unless you plan to manually call it elswhere. */ public void shuffle(boolean load) { - if (musicList.getAmountOfMusic() == 0) { + if (musicList.getTotal() == 0) { currentPlaybackID = 0; } else { - currentPlaybackID = rand.nextInt(musicList.getAmountOfMusic()); + currentPlaybackID = rand.nextInt(musicList.getTotal()); } if (load) { loadMusic(); @@ -118,9 +118,9 @@ public class MusicListController extends Observable implements OnCompletionListe mm.dispose(); } if (currentPlaybackID < 0) { - currentPlaybackID = musicList.getAmountOfMusic(); + currentPlaybackID = musicList.getTotal(); } - if (currentPlaybackID > musicList.getAmountOfMusic()) { + if (currentPlaybackID > musicList.getTotal()) { currentPlaybackID = 0; } this.mm = musicList.getMusicInfoFromIndex(currentPlaybackID); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java index a5b8dfb..1021aae 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java @@ -1,5 +1,6 @@ package zero1hd.rhythmbullet.graphics.ui.components; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.scenes.scene2d.InputEvent; @@ -62,6 +63,7 @@ public class MusicSelectable extends WidgetGroup implements Disposable { * @param musicInfo the music information for this song. */ public void updateInfo(MusicInfo musicInfo) { + Gdx.app.debug("MusicSelectable", "Updating info for: " + getName()); this.musicInfo = musicInfo; displayName.setOriginalText(musicInfo.getMusicName()); durationLabel.setText("Runtime: " diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ShortenedTextLabel.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ShortenedTextLabel.java index fab6580..f851792 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ShortenedTextLabel.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ShortenedTextLabel.java @@ -25,11 +25,6 @@ public class ShortenedTextLabel extends Label { this.targetWidth = targetWidth; } - @Override - public void act(float delta) { - super.act(delta); - } - public void resize() { setToOriginalText(); while (gl.width > targetWidth && (getText().length - 4) > 0) { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java index cfcc84c..e93dcdb 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java @@ -176,22 +176,27 @@ public class MusicSelectionPage extends Page implements Observer { } } + attemptRefreshUpdate(); super.act(delta); - - if (uiSongCount < mc.getMusicList().getAmountOfMusic()) { - MusicSelectable selectable = new MusicSelectable(mc.getMusicList().getSongFileHandleFromIndex(uiSongCount), skin, this); - selectables.add(selectable); - musicTable.add(selectables.get(uiSongCount)).expandX().fillX(); - uiSongCount++; - musicTable.row(); - if (uiSongCount == mc.getMusicList().getAmountOfMusic()) { - selectMusicUI(mc.getCurrentMusicManager()); - } - } else if (uiSongInfoCount < selectables.size && mic.isDoneLoading() ) { - selectables.get(uiSongInfoCount).updateInfo(mic.getSongInfoArray().get(uiSongInfoCount)); - uiSongInfoCount++; - if (uiSongInfoCount == selectables.size) { - updateInformation(); + } + + private void attemptRefreshUpdate() { + if (uiSongInfoCount != mc.getMusicList().getTotal()) { + if (uiSongCount < mc.getMusicList().getTotal()) { + MusicSelectable selectable = new MusicSelectable(mc.getMusicList().getSongFileHandleFromIndex(uiSongCount), skin, this); + selectables.add(selectable); + musicTable.add(selectables.get(uiSongCount)).expandX().fillX(); + uiSongCount++; + musicTable.row(); + if (uiSongCount == mc.getMusicList().getTotal()) { + selectMusicUI(mc.getCurrentMusicManager()); + } + } else if (uiSongInfoCount < selectables.size && mic.isDoneLoading()) { + selectables.get(uiSongInfoCount).updateInfo(mic.getSongInfoArray().get(uiSongInfoCount)); + uiSongInfoCount++; + if (uiSongInfoCount == selectables.size) { + updateInformation(); + } } } } @@ -255,7 +260,7 @@ public class MusicSelectionPage extends Page implements Observer { this.currentlySelected = currentlySelected; songSelectionTimer = 1f; - if (mic.isDoneLoading()) { + if (mic.isDoneLoading() && uiSongInfoCount == selectables.size) { updateInformation(); } } @@ -313,6 +318,7 @@ public class MusicSelectionPage extends Page implements Observer { private void updateInformation() { Gdx.app.debug("MusicSelectionPage", "Updating song info panel..."); if (currentlySelected == null) throw new NullPointerException("Buddy, you need to update this page to have the proper current music selected..."); + if (currentlySelected.getMusicInfo() == null) throw new NullPointerException("K, ur music info is null."); songTitle.setText(currentlySelected.getMusicInfo().getMusicName(), null); author.setText("Author: " + currentlySelected.getMusicInfo().getAuthor()); if (albumCoverTexture != null) { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java index d379552..f923d00 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java @@ -84,7 +84,7 @@ public class OptionsPage extends Page { Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin()); optionsTable.add(musicDirectoryLabel); - Label songCount = new Label("Songs: " + sc.getMusicList().getAmountOfMusic(), core.getDefaultSkin(), "sub-font", core.getDefaultSkin().getColor("default")); + Label songCount = new Label("Songs: " + sc.getMusicList().getTotal(), core.getDefaultSkin(), "sub-font", core.getDefaultSkin().getColor("default")); directoryField = new TextField(null, core.getDefaultSkin() ) { @Override public void act(float delta) { @@ -93,7 +93,7 @@ public class OptionsPage extends Page { if (musicSearchTimer <= 0) { sc.getMusicList().setSearchPath(directoryField.getText()); sc.getMusicList().asynchRefresh(); - songCount.setText("Songs: " + sc.getMusicList().getAmountOfMusic()); + songCount.setText("Songs: " + sc.getMusicList().getTotal()); } } super.act(delta); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java index 00fc30a..fb436a5 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java @@ -9,21 +9,16 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.utils.Disposable; -import zero1hd.rhythmbullet.util.MiniSender; - public class Page extends Group implements Disposable { private Label pageTitle; private TextureRegion background; - public MiniSender miniSender; public Page() { setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - miniSender = new MiniSender(); setTouchable(Touchable.childrenOnly); } public Page(String titleText, Skin skin) { - miniSender = new MiniSender(); setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); setTouchable(Touchable.childrenOnly); pageTitle = new Label(titleText, skin, "large-font", skin.getColor("default")); diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index 41c5827..8c282de 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -272,7 +272,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { } if (stage.getCamera().position.x != cameraPosition.x || stage.getCamera().position.y != cameraPosition.y) { - stage.getCamera().position.lerp(cameraPosition, lerpAlpha); + stage.getCamera().position.lerp(cameraPosition, delta*lerpAlpha); stage.getViewport().apply(); } @@ -325,9 +325,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { private void calcLerpAlpha(int width) { if (width <= 3835) { - lerpAlpha = 0.15f; + lerpAlpha = 5.0f; } else { - lerpAlpha = 0.15f; + lerpAlpha = 5.5f; } }