Added facility to save and read DetailedInfo (DataRecorder data) in XML format using XStream.
This commit is contained in:
@@ -2,6 +2,7 @@ package dk.itu.mario.scene;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import dk.itu.mario.MarioInterface.GamePlay;
|
||||
@@ -48,8 +49,18 @@ public class LevelSceneCustom extends LevelScene {
|
||||
currentLevel = (Level) clg.generateLevel(gp);
|
||||
|
||||
String detailedInfo = FileHandler.readFile("DetailedInfo.txt");
|
||||
//TODO parse DetailedInfo
|
||||
System.out.println("DetailedInfo: " + detailedInfo);
|
||||
|
||||
File xmlInfoFile = new File("DetailedInfo.xml");
|
||||
if (xmlInfoFile.exists()) {
|
||||
try {
|
||||
DataRecorder dataRecorder = DataRecorder.fromXML(xmlInfoFile);
|
||||
System.out.println("DetailedInfo (from xml file): " + detailedInfo);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("DetailedInfo (from txt file): " + detailedInfo);
|
||||
}
|
||||
|
||||
try {
|
||||
level = currentLevel.clone();
|
||||
@@ -57,7 +68,7 @@ public class LevelSceneCustom extends LevelScene {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//TODO change this
|
||||
// TODO change this
|
||||
// level is always overground
|
||||
Art.startMusic(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user