music selection page now functions with new method of loading
This commit is contained in:
parent
c41c941338
commit
6fe280044d
@ -132,6 +132,7 @@ public class MusicListController extends Observable implements OnCompletionListe
|
||||
|
||||
|
||||
public MusicManager getCurrentMusicManager() {
|
||||
if (mm == null) throw new NullPointerException("Music manager not loaded yet. try calling load music.");
|
||||
return mm;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,6 @@ public class Visualizer extends Widget implements Disposable {
|
||||
|
||||
|
||||
public void setMM(MusicManager mm) {
|
||||
if (this.mm != null) {
|
||||
this.mm.dispose();
|
||||
}
|
||||
this.mm = mm;
|
||||
mmSet = false;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import zero1hd.rhythmbullet.screens.MainMenu;
|
||||
public class MainPage extends Page implements Observer {
|
||||
private Label versionLabel;
|
||||
|
||||
private MusicListController sc;
|
||||
private MusicListController mlc;
|
||||
private TitleBarVisualizer titleBar;
|
||||
private Table table;
|
||||
private TextButton playButton;
|
||||
@ -33,12 +33,13 @@ public class MainPage extends Page implements Observer {
|
||||
private TextButton quitButton;
|
||||
|
||||
private MusicControls musicControls;
|
||||
|
||||
private MainMenu mMenu;
|
||||
private ScrollText scrollText;
|
||||
public MainPage(RhythmBullet core, Vector3 targetPosition, MusicListController sc, MainMenu mm) {
|
||||
this.sc = sc;
|
||||
|
||||
public MainPage(RhythmBullet core, Vector3 targetPosition, MusicListController mlc, MainMenu mm) {
|
||||
this.mlc = mlc;
|
||||
setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("red-linear"));
|
||||
|
||||
this.mMenu = mm;
|
||||
titleBar = new TitleBarVisualizer(core.getAssetManager());
|
||||
addActor(titleBar);
|
||||
|
||||
@ -85,7 +86,7 @@ public class MainPage extends Page implements Observer {
|
||||
});
|
||||
table.add(quitButton).fillX();
|
||||
|
||||
musicControls = new MusicControls(core.getDefaultSkin(), sc);
|
||||
musicControls = new MusicControls(core.getDefaultSkin(), mlc);
|
||||
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight()-15f);
|
||||
addActor(musicControls);
|
||||
|
||||
@ -113,9 +114,17 @@ public class MainPage extends Page implements Observer {
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if (o == sc) {
|
||||
MusicManager mm = (MusicManager) arg;
|
||||
if (o == mlc.getMusicList()) {
|
||||
mlc.shuffle(true);
|
||||
MusicManager mm = mlc.getCurrentMusicManager();
|
||||
updateVisualsForDifferentSong(mm);
|
||||
mMenu.getMusicSelectionPage().refreshUIList();
|
||||
mMenu.getMusicSelectionPage().selectMusicUI(mm);
|
||||
mlc.play();
|
||||
} else if (o == mlc) {
|
||||
MusicManager mm = mlc.getCurrentMusicManager();
|
||||
updateVisualsForDifferentSong(mm);
|
||||
mm.play();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ public class MusicSelectionPage extends Page implements Observer {
|
||||
private TextButton beginButton;
|
||||
private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
|
||||
|
||||
public MusicSelectionPage(Skin skin, MusicListController musicList, AssetManager assetManager, Vector3 cameraTarget, AnalysisPage ap) {
|
||||
public MusicSelectionPage(Skin skin, MusicListController musicListController, AssetManager assetManager, Vector3 cameraTarget, AnalysisPage ap) {
|
||||
setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||
this.skin = skin;
|
||||
this.mc = musicList;
|
||||
this.mc = musicListController;
|
||||
musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
|
||||
this.assets = assetManager;
|
||||
musicTable = new Table();
|
||||
@ -214,7 +214,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
||||
}
|
||||
extraInfoDone = true;
|
||||
|
||||
musicInfoTable.add(songTitle).width(musicInfoTable.getWidth()*0.7f).spaceBottom(30f);
|
||||
musicInfoTable.add(songTitle).width(musicInfoTable.getWidth()*0.6f).spaceBottom(30f);
|
||||
musicInfoTable.row();
|
||||
musicSubInfo.add(author);
|
||||
musicSubInfo.row();
|
||||
|
@ -130,10 +130,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
super.clicked(event, x, y);
|
||||
}
|
||||
});
|
||||
mlc.deleteObservers();
|
||||
mlc.addObserver(mainPage);
|
||||
mlc.getMusicList().deleteObservers();
|
||||
mlc.addObserver(musicSelectionPage);
|
||||
mlc.getMusicList().addObserver(musicSelectionPage);
|
||||
mlc.addObserver(mainPage);
|
||||
mlc.getMusicList().addObserver(mainPage);
|
||||
}
|
||||
public void attemptLoadShaders() {
|
||||
if (core.getPrefs().getBoolean("glow shader", true)) {
|
||||
|
Loading…
Reference in New Issue
Block a user