minor structure change for adding analysis page
This commit is contained in:
@@ -1,12 +1,49 @@
|
||||
package zero1hd.polyjet.screens;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.utils.SnapshotArray;
|
||||
|
||||
import zero1hd.polyjet.audio.AudioAnalyzer;
|
||||
import zero1hd.polyjet.audio.AudioData;
|
||||
import zero1hd.polyjet.ui.pages.Page;
|
||||
|
||||
public class AnalyzePage extends Page {
|
||||
AudioAnalyzer audioAnalyzer;
|
||||
AudioData music;
|
||||
|
||||
Table songInfo;
|
||||
Slider difficultyModifier;
|
||||
Label difficultyModifierPercentage;
|
||||
|
||||
public AnalyzePage(Skin skin) {
|
||||
super("Results", skin);
|
||||
audioAnalyzer = new AudioAnalyzer();
|
||||
}
|
||||
|
||||
public void setSong(AudioData music, SnapshotArray<Actor> uiMusicInfo) {
|
||||
this.music = music;
|
||||
audioAnalyzer.startAnalyticalThread(music);
|
||||
songInfo.add(uiMusicInfo.get(0)).spaceBottom(20f);
|
||||
songInfo.add(uiMusicInfo.pop()).expandX().center();
|
||||
songInfo.row();
|
||||
for (int currentActor = 1; currentActor < uiMusicInfo.size; currentActor++) {
|
||||
songInfo.add(uiMusicInfo.get(currentActor));
|
||||
songInfo.row();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAudioData() {
|
||||
if (music != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void clearAUdioData() {
|
||||
music = null;
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
|
||||
|
||||
private MainMenu mainMenu;
|
||||
private MusicSelectionPage musicSelection;
|
||||
|
||||
private AnalyzePage analyzePage;
|
||||
public PreGameScreen(final Polyjet core, MainMenu mainMenu) {
|
||||
this.core = core;
|
||||
analyzer = new AudioAnalyzer();
|
||||
@@ -58,8 +58,12 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
|
||||
cyberCircle1.setPosition(Gdx.graphics.getWidth()-cyberCircle1.getWidth()/2-10, -cyberCircle1.getHeight()*2/4f);
|
||||
stage.addActor(cyberCircle1);
|
||||
|
||||
analyzePage = new AnalyzePage(core.defaultSkin);
|
||||
analyzePage.setPosition(1f*Gdx.graphics.getWidth(), 0);
|
||||
stage.addActor(analyzePage);
|
||||
|
||||
//draw music selector
|
||||
musicSelection = new MusicSelectionPage(core, mainMenu);
|
||||
musicSelection = new MusicSelectionPage(core, mainMenu, analyzePage);
|
||||
stage.addActor(musicSelection);
|
||||
musicSelection.beginMusicSearch();
|
||||
|
||||
@@ -82,7 +86,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
|
||||
stage.getCamera().position.lerp(cameraTarget, 0.25f);
|
||||
}
|
||||
|
||||
if (cameraTarget.x != 1.5f*Gdx.graphics.getWidth() && musicSelection.getAudio() != null) {
|
||||
if (cameraTarget.x != 1.5f*Gdx.graphics.getWidth() && analyzePage.hasAudioData()) {
|
||||
cameraTarget.x = 1.5f*Gdx.graphics.getWidth();
|
||||
}
|
||||
super.render(delta);
|
||||
|
Reference in New Issue
Block a user