Show Undo in prompt if last action is undoable

Clean up unnecessary items from Game menu
This commit is contained in:
drdev
2014-07-01 04:46:24 +00:00
parent e32f335010
commit b51b67e6f0
9 changed files with 59 additions and 42 deletions

View File

@@ -507,13 +507,6 @@ public class FControl {
getPlayerPanel(zone.getPlayer()).getField().updateCard(c);
}
}
public static void undoLastAction() {
Game game = getGame();
Player player = game.getPhaseHandler().getPriorityPlayer();
if (player != null && player.getLobbyPlayer() == getGuiPlayer()) {
game.stack.undo();
}
}
/** Concede game, bring up WinLose UI. */
public static void concede() {

View File

@@ -12,6 +12,7 @@ import com.badlogic.gdx.Input.Keys;
import forge.Forge;
import forge.LobbyPlayer;
import forge.match.MatchUtil;
import forge.menu.FMenuBar;
import forge.model.FModel;
import forge.properties.ForgePreferences;
@@ -202,7 +203,7 @@ public class MatchScreen extends FScreen {
break;
case Keys.Z: //undo on Ctrl+Z
if (KeyInputAdapter.isCtrlKeyDown()) {
FControl.undoLastAction();
MatchUtil.undoLastAction();
return true;
}
break;

View File

@@ -14,30 +14,12 @@ import forge.toolbox.FEvent.FEventHandler;
public class VGameMenu extends FDropDownMenu {
@Override
protected void buildMenu() {
addItem(new FMenuItem("Undo", new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
FControl.undoLastAction();
}
}));
addItem(new FMenuItem("Concede", FSkinImage.CONCEDE, new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
FControl.concede();
}
}));
addItem(new FMenuItem("End Turn", FSkinImage.ENDTURN, new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
FControl.endCurrentTurn();
}
}));
addItem(new FMenuItem("Alpha Strike", FSkinImage.ALPHASTRIKE, new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
FControl.alphaStrike();
}
}));
addItem(new FMenuItem("Deck List", FSkinImage.DECKLIST, new FEventHandler() {
@Override
public void handleEvent(FEvent e) {