mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Fix so location saved on each plane (so you return to your last location when traveling back)
This commit is contained in:
@@ -319,6 +319,7 @@ public class ConquestMultiverseScreen extends FScreen implements IConquestEventL
|
|||||||
@Override
|
@Override
|
||||||
protected void onEnd(boolean endingAll) {
|
protected void onEnd(boolean endingAll) {
|
||||||
model.setCurrentLocation(path.get(path.size() - 1));
|
model.setCurrentLocation(path.get(path.size() - 1));
|
||||||
|
model.saveData(); //save new location
|
||||||
activeMoveAnimation = null;
|
activeMoveAnimation = null;
|
||||||
launchEvent();
|
launchEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public final class ConquestData {
|
|||||||
}
|
}
|
||||||
public void setCurrentLocation(ConquestLocation currentLocation0) {
|
public void setCurrentLocation(ConquestLocation currentLocation0) {
|
||||||
currentLocation = currentLocation0;
|
currentLocation = currentLocation0;
|
||||||
|
getCurrentPlaneData().setLocation(currentLocation0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConquestPlaneData getOrCreatePlaneData(ConquestPlane plane) {
|
private ConquestPlaneData getOrCreatePlaneData(ConquestPlane plane) {
|
||||||
|
|||||||
@@ -8,22 +8,22 @@ import forge.util.XmlWriter;
|
|||||||
import forge.util.XmlWriter.IXmlWritable;
|
import forge.util.XmlWriter.IXmlWritable;
|
||||||
|
|
||||||
public class ConquestPlaneData implements IXmlWritable {
|
public class ConquestPlaneData implements IXmlWritable {
|
||||||
private final ConquestPlane plane;
|
|
||||||
private final ConquestRecord[] eventResults;
|
private final ConquestRecord[] eventResults;
|
||||||
|
private ConquestLocation location;
|
||||||
|
|
||||||
public ConquestPlaneData(ConquestPlane plane0) {
|
public ConquestPlaneData(ConquestPlane plane0) {
|
||||||
plane = plane0;
|
location = new ConquestLocation(plane0, 0, 0, 0);
|
||||||
eventResults = new ConquestRecord[plane.getEventCount()];
|
eventResults = new ConquestRecord[plane0.getEventCount()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConquestPlaneData(XmlReader xml) {
|
public ConquestPlaneData(XmlReader xml) {
|
||||||
plane = xml.read("plane", ConquestPlane.Alara);
|
location = xml.read("location", ConquestLocation.class);
|
||||||
eventResults = new ConquestRecord[plane.getEventCount()];
|
eventResults = new ConquestRecord[location.getPlane().getEventCount()];
|
||||||
xml.read("eventResults", eventResults, ConquestRecord.class);
|
xml.read("eventResults", eventResults, ConquestRecord.class);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void saveToXml(XmlWriter xml) {
|
public void saveToXml(XmlWriter xml) {
|
||||||
xml.write("plane", plane);
|
xml.write("location", location);
|
||||||
xml.write("eventResults", eventResults);
|
xml.write("eventResults", eventResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +56,13 @@ public class ConquestPlaneData implements IXmlWritable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConquestLocation getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
public void setLocation(ConquestLocation location0) {
|
||||||
|
location = location0;
|
||||||
|
}
|
||||||
|
|
||||||
public void addWin(ConquestEvent event) {
|
public void addWin(ConquestEvent event) {
|
||||||
getOrCreateResult(event).addWin(event.getTier());
|
getOrCreateResult(event).addWin(event.getTier());
|
||||||
}
|
}
|
||||||
@@ -77,7 +84,7 @@ public class ConquestPlaneData implements IXmlWritable {
|
|||||||
public int getUnlockedCount() {
|
public int getUnlockedCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
ConquestData model = FModel.getConquest().getModel();
|
ConquestData model = FModel.getConquest().getModel();
|
||||||
for (PaperCard pc : plane.getCardPool().getAllCards()) {
|
for (PaperCard pc : location.getPlane().getCardPool().getAllCards()) {
|
||||||
if (model.hasUnlockedCard(pc)) {
|
if (model.hasUnlockedCard(pc)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user