fill highscore at the end from the game, extend gamesettings
This commit is contained in:
parent
4f50eda9ea
commit
d37263b4bf
@ -33,6 +33,8 @@ public class GameSettings {
|
|||||||
private String audioFile;
|
private String audioFile;
|
||||||
private String videoFile;
|
private String videoFile;
|
||||||
private boolean useVideo;
|
private boolean useVideo;
|
||||||
|
private String trackTitle;
|
||||||
|
private String trackArtist;
|
||||||
|
|
||||||
public GameSettings() {
|
public GameSettings() {
|
||||||
}
|
}
|
||||||
@ -47,6 +49,14 @@ public class GameSettings {
|
|||||||
this.useVideo = true;
|
this.useVideo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTrackTitle(String trackTitle) {
|
||||||
|
this.trackTitle = trackTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrackArtist(String trackArtist) {
|
||||||
|
this.trackArtist = trackArtist;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAudioFile() {
|
public String getAudioFile() {
|
||||||
return audioFile;
|
return audioFile;
|
||||||
}
|
}
|
||||||
@ -78,4 +88,12 @@ public class GameSettings {
|
|||||||
public Image.Format GetTextureFormat() {
|
public Image.Format GetTextureFormat() {
|
||||||
return TEXTURE_FORMAT;
|
return TEXTURE_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTrackArtist() {
|
||||||
|
return trackArtist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrackTitle() {
|
||||||
|
return trackTitle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,8 +149,10 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
|||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
if (tag.hasField(FieldKey.TITLE)) {
|
if (tag.hasField(FieldKey.TITLE)) {
|
||||||
title = tag.getFirst(FieldKey.TITLE);
|
title = tag.getFirst(FieldKey.TITLE);
|
||||||
|
settings.setTrackTitle(title);
|
||||||
}
|
}
|
||||||
artist = tag.getFirst(FieldKey.ARTIST);
|
artist = tag.getFirst(FieldKey.ARTIST);
|
||||||
|
settings.setTrackArtist(artist);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import org.wyrez.shootingstars.game.Player;
|
|||||||
import org.wyrez.shootingstars.game.StarManager;
|
import org.wyrez.shootingstars.game.StarManager;
|
||||||
import org.wyrez.shootingstars.gui.GameGUI;
|
import org.wyrez.shootingstars.gui.GameGUI;
|
||||||
import org.wyrez.shootingstars.gui.listener.GameListener;
|
import org.wyrez.shootingstars.gui.listener.GameListener;
|
||||||
|
import org.wyrez.shootingstars.gui.manager.HighscoreManager;
|
||||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||||
import org.wyrez.shootingstars.helper.UserDataKeys;
|
import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||||
@ -72,13 +73,14 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
|||||||
private Node player;
|
private Node player;
|
||||||
private Node starNode;
|
private Node starNode;
|
||||||
private OptionSettings optionSettings;
|
private OptionSettings optionSettings;
|
||||||
|
private HighscoreManager highscoreManager;
|
||||||
private boolean isRunning = false;
|
private boolean isRunning = false;
|
||||||
private boolean isFinished = false;
|
private boolean isFinished = false;
|
||||||
|
|
||||||
public GameState(Node rootNode, Screen screen, StateManager stateManager,
|
public GameState(Node rootNode, Screen screen, StateManager stateManager,
|
||||||
AssetManager assetManager, ViewPort viewPort, OptionSettings optionSettings,
|
AssetManager assetManager, ViewPort viewPort, OptionSettings optionSettings,
|
||||||
InputManager inputManager, Camera camera, AudioDataManager audioDataManager,
|
InputManager inputManager, Camera camera, AudioDataManager audioDataManager,
|
||||||
GameSettings settings, ScreenHelper screenHelper) {
|
GameSettings settings, ScreenHelper screenHelper, HighscoreManager highscoreManager) {
|
||||||
|
|
||||||
this.rootNode = rootNode;
|
this.rootNode = rootNode;
|
||||||
this.gui = new GameGUI(screen, this, assetManager, screenHelper);
|
this.gui = new GameGUI(screen, this, assetManager, screenHelper);
|
||||||
@ -91,6 +93,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
|||||||
this.assetManager = assetManager;
|
this.assetManager = assetManager;
|
||||||
this.viewPort = viewPort;
|
this.viewPort = viewPort;
|
||||||
this.optionSettings = optionSettings;
|
this.optionSettings = optionSettings;
|
||||||
|
this.highscoreManager = highscoreManager;
|
||||||
|
|
||||||
mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
|
mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
|
||||||
|
|
||||||
@ -234,6 +237,14 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finished() {
|
public void finished() {
|
||||||
|
String songName = settings.getTrackArtist() + " - " + settings.getTrackTitle();
|
||||||
|
|
||||||
|
if(settings.useVideo()) {
|
||||||
|
highscoreManager.addScore(songName, optionSettings.getUsername(), Integer.valueOf(player.getUserData(UserDataKeys.POINTS).toString()));
|
||||||
|
} else {
|
||||||
|
highscoreManager.addScore(songName, optionSettings.getUsername(), Integer.valueOf(player.getUserData(UserDataKeys.POINTS).toString()));
|
||||||
|
}
|
||||||
|
|
||||||
stateManager.setState(State.HIGHSCORE);
|
stateManager.setState(State.HIGHSCORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user