mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Allow all overlays to face top human player if needed
Allow top human player to concede
This commit is contained in:
@@ -6,8 +6,6 @@ import forge.Graphics;
|
|||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.match.MatchUtil;
|
|
||||||
import forge.screens.match.MatchController;
|
|
||||||
import forge.toolbox.FList;
|
import forge.toolbox.FList;
|
||||||
import forge.toolbox.FOverlay;
|
import forge.toolbox.FOverlay;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
@@ -23,13 +21,10 @@ public class CardZoom extends FOverlay {
|
|||||||
|
|
||||||
public static <T> void show(final IPaperCard pc0) {
|
public static <T> void show(final IPaperCard pc0) {
|
||||||
card = ViewUtil.getCardForUi(pc0);
|
card = ViewUtil.getCardForUi(pc0);
|
||||||
cardZoom.setRotate180(false);
|
|
||||||
cardZoom.show();
|
cardZoom.show();
|
||||||
}
|
}
|
||||||
public static <T> void show(final CardView card0) {
|
public static <T> void show(final CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
//rotate card zoom to face top human player if needed
|
|
||||||
cardZoom.setRotate180(MatchUtil.getGame() != null && MatchController.getView().isTopHumanPlayerActive());
|
|
||||||
cardZoom.show();
|
cardZoom.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import forge.Forge;
|
|||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
|
import forge.match.MatchUtil;
|
||||||
|
import forge.screens.match.MatchController;
|
||||||
|
|
||||||
public abstract class FOverlay extends FContainer {
|
public abstract class FOverlay extends FContainer {
|
||||||
public static final float ALPHA_COMPOSITE = 0.5f;
|
public static final float ALPHA_COMPOSITE = 0.5f;
|
||||||
@@ -73,6 +75,8 @@ public abstract class FOverlay extends FContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (visible0) {
|
if (visible0) {
|
||||||
|
//rotate overlay to face top human player if needed
|
||||||
|
setRotate180(MatchUtil.getGame() != null && MatchController.getView().isTopHumanPlayerActive());
|
||||||
overlays.push(this);
|
overlays.push(this);
|
||||||
}
|
}
|
||||||
else if (!hidingAll) { //hiding all handles cleaning up overlay collection
|
else if (!hidingAll) { //hiding all handles cleaning up overlay collection
|
||||||
|
|||||||
@@ -358,40 +358,29 @@ public class MatchUtil {
|
|||||||
"This will end the current game and you will not be able to resume.\n\n" +
|
"This will end the current game and you will not be able to resume.\n\n" +
|
||||||
"Concede anyway?";
|
"Concede anyway?";
|
||||||
if (SOptionPane.showConfirmDialog(GuiBase.getInterface(), userPrompt, "Concede Game?", "Concede", "Cancel")) {
|
if (SOptionPane.showConfirmDialog(GuiBase.getInterface(), userPrompt, "Concede Game?", "Concede", "Cancel")) {
|
||||||
stopGame();
|
if (humanCount == 0) { // no human? then all players surrender!
|
||||||
}
|
for (Player p : game.getPlayers()) {
|
||||||
}
|
p.concede();
|
||||||
|
}
|
||||||
public static void stopGame() {
|
}
|
||||||
List<Player> pp = new ArrayList<Player>();
|
else {
|
||||||
for (Player p : game.getPlayers()) {
|
getCurrentPlayer().concede();
|
||||||
if (p.getOriginalLobbyPlayer() == getGuiPlayer()) {
|
|
||||||
pp.add(p);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
boolean hasHuman = !pp.isEmpty();
|
|
||||||
|
|
||||||
if (pp.isEmpty()) {
|
Player priorityPlayer = game.getPhaseHandler().getPriorityPlayer();
|
||||||
pp.addAll(game.getPlayers()); // no human? then all players surrender!
|
boolean humanHasPriority = priorityPlayer == null || priorityPlayer.getLobbyPlayer() == getGuiPlayer();
|
||||||
}
|
|
||||||
|
|
||||||
for (Player p: pp) {
|
if (humanCount > 0 && humanHasPriority) {
|
||||||
p.concede();
|
game.getAction().checkGameOverCondition();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
game.isGameOver(); // this is synchronized method - it's used to make Game-0 thread see changes made here
|
||||||
|
getInputQueue().onGameOver(false); //release any waiting input, effectively passing priority
|
||||||
|
}
|
||||||
|
|
||||||
Player priorityPlayer = game.getPhaseHandler().getPriorityPlayer();
|
if (playbackControl != null) {
|
||||||
boolean humanHasPriority = priorityPlayer == null || priorityPlayer.getLobbyPlayer() == getGuiPlayer();
|
playbackControl.onGameStopRequested();
|
||||||
|
}
|
||||||
if (hasHuman && humanHasPriority) {
|
|
||||||
game.getAction().checkGameOverCondition();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
game.isGameOver(); // this is synchronized method - it's used to make Game-0 thread see changes made here
|
|
||||||
getInputQueue().onGameOver(false); //release any waiting input, effectively passing priority
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playbackControl != null) {
|
|
||||||
playbackControl.onGameStopRequested();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user