Quitting a gauntlet match should abandon it (when not

using the "quit and save" option after a win). With this
change, you can now properly edit your deck between
gauntlet tries and have the effect be reflected in the
next gauntlet.
This commit is contained in:
Myrd
2017-05-07 19:36:14 +00:00
parent b01ea14ad9
commit cfe2a7e98d
4 changed files with 22 additions and 0 deletions

View File

@@ -114,4 +114,10 @@ public class GauntletWinLose extends ControlWinLose {
super.actionOnContinue(); super.actionOnContinue();
} }
} }
@Override
public void actionOnQuit() {
super.actionOnQuit();
controller.actionOnQuit();
}
} }

View File

@@ -91,4 +91,10 @@ public class GauntletWinLose extends ControlWinLose {
super.actionOnContinue(); super.actionOnContinue();
} }
} }
@Override
public void actionOnQuit() {
super.actionOnQuit();
controller.actionOnQuit();
}
} }

View File

@@ -69,6 +69,7 @@ public final class GauntletData {
/** Resets a gauntlet data to an unplayed state, then stamps and saves. */ /** Resets a gauntlet data to an unplayed state, then stamps and saves. */
public void reset() { public void reset() {
userDeck = null;
completed = 0; completed = 0;
stamp(); stamp();
eventRecords.clear(); eventRecords.clear();

View File

@@ -15,6 +15,8 @@ import forge.model.FModel;
import forge.player.GamePlayerUtil; import forge.player.GamePlayerUtil;
public abstract class GauntletWinLoseController { public abstract class GauntletWinLoseController {
private static final String SAVE_AND_QUIT = "Save and Quit";
private final IWinLoseView<? extends IButton> view; private final IWinLoseView<? extends IButton> view;
private final GameView lastGame; private final GameView lastGame;
@@ -127,6 +129,13 @@ public abstract class GauntletWinLoseController {
return false; return false;
} }
public final void actionOnQuit() {
if (!SAVE_AND_QUIT.equals(view.getBtnQuit().getText())) {
// Quitting mid-match abandons the gauntlet.
FModel.getGauntletData().reset();
}
}
protected abstract void showOutcome(boolean isMatchOver, String message1, String message2, FSkinProp icon, List<String> lstEventNames, List<String> lstEventRecords, int len, int num); protected abstract void showOutcome(boolean isMatchOver, String message1, String message2, FSkinProp icon, List<String> lstEventNames, List<String> lstEventRecords, int len, int num);
protected abstract void saveOptions(); protected abstract void saveOptions();
} }