clean up; music selection no longer wraps back to top;

This commit is contained in:
Harrison Deng 2018-09-04 04:50:35 -05:00
parent eba5459ab3
commit ec82f3a5ee
2 changed files with 12 additions and 12 deletions

View File

@ -38,7 +38,6 @@ public class RhythmBullet extends Game {
private AssetManager assetManager = new AssetManager(); private AssetManager assetManager = new AssetManager();
private Skin skin; private Skin skin;
TextureAtlas skinAtlas;
private Preferences preferences; private Preferences preferences;
private RoundingResolutionHandler rRHandler; private RoundingResolutionHandler rRHandler;
private InitialScreen initialScreen; private InitialScreen initialScreen;
@ -217,7 +216,6 @@ public class RhythmBullet extends Game {
Gdx.app.debug("Core", "disposing..."); Gdx.app.debug("Core", "disposing...");
try { try {
getScreen().dispose(); getScreen().dispose();
skinAtlas.dispose();
getSkin().dispose(); getSkin().dispose();
assetManager.dispose(); assetManager.dispose();
assetPack.dispose(); assetPack.dispose();

View File

@ -207,13 +207,15 @@ public class MusicSelectionPage extends Page implements Observer {
} }
private void scrollDown() { private void scrollDown() {
selectables.selectNext(); if (selectables.selectNext()) {
scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight()); scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight());
}
} }
private void scrollUp() { private void scrollUp() {
selectables.selectPrevious(); if (selectables.selectPrevious()) {
scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight()); scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight());
}
} }
public FileHandle getSelectedMusic() { public FileHandle getSelectedMusic() {
@ -465,20 +467,22 @@ public class MusicSelectionPage extends Page implements Observer {
} }
public void selectNext() { public boolean selectNext() {
int index = getCheckedIndex() + 1; int index = getCheckedIndex() + 1;
if (index == buttons.size) { if (index == buttons.size) {
index = 0; return false;
} }
buttons.get(index).setChecked(true); buttons.get(index).setChecked(true);
return true;
} }
public void selectPrevious() { public boolean selectPrevious() {
int index = getCheckedIndex() - 1; int index = getCheckedIndex() - 1;
if (index == -1) { if (index == -1) {
index = buttons.size -1; return false;
} }
buttons.get(index).setChecked(true); buttons.get(index).setChecked(true);
return true;
} }
@Override @Override
@ -510,7 +514,6 @@ public class MusicSelectionPage extends Page implements Observer {
setPosition(scrollPane.getWidth() + scrollPane.getX(), 0); setPosition(scrollPane.getWidth() + scrollPane.getX(), 0);
setSize(width, height); setSize(width, height);
subInformation = new Table(skin); subInformation = new Table(skin);
subInformation.setBackground("corner-panel");
albumCover = new Image(assets.get("defaultCover.png", Texture.class)); albumCover = new Image(assets.get("defaultCover.png", Texture.class));
songTitle = new ScrollText("", null, skin, true, true); songTitle = new ScrollText("", null, skin, true, true);
author = new Label(null, skin, "sub-font", skin.getColor("default")); author = new Label(null, skin, "sub-font", skin.getColor("default"));
@ -540,7 +543,6 @@ public class MusicSelectionPage extends Page implements Observer {
} }
public void setToDefault() { public void setToDefault() {
clear(); clear();
subInformation.clear(); subInformation.clear();