mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Update Win/Lose Overlay (mobile)
At the end of the match, user can minimize the overlay to see the last battlefield and browse other zones, to bring up the overlay, click game menu, and click Show WinLose Overlay. Also fixes issue #928
This commit is contained in:
@@ -37,5 +37,9 @@ public abstract class CachedCardImage implements ImageFetcher.Callback {
|
||||
return ImageCache.getImage(key, true);
|
||||
}
|
||||
|
||||
public Texture getImage(String mykey) {
|
||||
return ImageCache.getImage(mykey, true);
|
||||
}
|
||||
|
||||
public abstract void onImageFetched();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.ImageKeys;
|
||||
import forge.assets.FBufferedImage;
|
||||
import forge.assets.FImage;
|
||||
import forge.assets.FSkin;
|
||||
@@ -334,7 +333,7 @@ public class CardImageRenderer {
|
||||
|
||||
public static void drawZoom(Graphics g, CardView card, GameView gameView, boolean altState, float x, float y, float w, float h, float dispW, float dispH, boolean isCurrentCard) {
|
||||
boolean canshow = MatchController.instance.mayView(card);
|
||||
final Texture image = ImageCache.getImage(card.getState(altState).getImageKey(MatchController.instance.getLocalPlayers()), true);
|
||||
final Texture image = ImageCache.getImage(card.getState(altState).getImageKey(), true);
|
||||
FImage sleeves = MatchController.getPlayerSleeve(card.getOwner());
|
||||
if (image == null) { //draw details if can't draw zoom
|
||||
drawDetails(g, card, gameView, altState, x, y, w, h);
|
||||
@@ -388,7 +387,7 @@ public class CardImageRenderer {
|
||||
} else
|
||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||
} else {
|
||||
if (Forge.enableUIMask && canshow && !ImageKeys.getTokenKey(ImageKeys.MORPH_IMAGE).equals(card.getState(altState).getImageKey())) {
|
||||
if (Forge.enableUIMask && canshow) {
|
||||
if (ImageCache.isExtendedArt(card))
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else {
|
||||
@@ -396,7 +395,7 @@ public class CardImageRenderer {
|
||||
g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea);
|
||||
}
|
||||
} else {
|
||||
if (canshow && !ImageKeys.getTokenKey(ImageKeys.MORPH_IMAGE).equals(card.getState(altState).getImageKey()))
|
||||
if (canshow)
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else // sleeve
|
||||
g.drawImage(sleeves, x, y, w, h);
|
||||
|
||||
@@ -19,7 +19,6 @@ import forge.CachedCardImage;
|
||||
import forge.Forge;
|
||||
import forge.FThreads;
|
||||
import forge.Graphics;
|
||||
import forge.ImageKeys;
|
||||
import forge.StaticData;
|
||||
import forge.assets.FImage;
|
||||
import forge.assets.FImageComplex;
|
||||
@@ -482,8 +481,8 @@ public class CardRenderer {
|
||||
}
|
||||
}
|
||||
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate) {
|
||||
boolean canshow = MatchController.instance.mayView(card) && !ImageKeys.getTokenKey(ImageKeys.MORPH_IMAGE).equals(card.getCurrentState().getImageKey());
|
||||
Texture image = new RendererCachedCardImage(card, false).getImage();
|
||||
boolean canshow = MatchController.instance.mayView(card);
|
||||
Texture image = new RendererCachedCardImage(card, false).getImage(card.getCurrentState().getImageKey());
|
||||
FImage sleeves = MatchController.getPlayerSleeve(card.getOwner());
|
||||
float radius = (h - w)/8;
|
||||
float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f;
|
||||
|
||||
@@ -226,6 +226,11 @@ public class MatchController extends AbstractGuiGame {
|
||||
view.getStack().checkEmptyStack();
|
||||
}
|
||||
|
||||
public void showWinlose() {
|
||||
if (view.getViewWinLose() != null)
|
||||
view.getViewWinLose().setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTurn(final PlayerView player) {
|
||||
}
|
||||
@@ -254,7 +259,8 @@ public class MatchController extends AbstractGuiGame {
|
||||
@Override
|
||||
public void finishGame() {
|
||||
if (hasLocalPlayers() || getGameView().isMatchOver()) {
|
||||
new ViewWinLose(getGameView()).setVisible(true);
|
||||
view.setViewWinLose(new ViewWinLose(getGameView()));
|
||||
view.getViewWinLose().setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Set;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import forge.screens.match.winlose.ViewWinLose;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -78,6 +79,8 @@ public class MatchScreen extends FScreen {
|
||||
private VPlayerPanel bottomPlayerPanel, topPlayerPanel;
|
||||
private AbilityEffect activeEffect;
|
||||
|
||||
private ViewWinLose viewWinLose = null;
|
||||
|
||||
public MatchScreen(List<VPlayerPanel> playerPanels0) {
|
||||
super(new FMenuBar());
|
||||
|
||||
@@ -292,6 +295,14 @@ public class MatchScreen extends FScreen {
|
||||
return topPlayerPanel;
|
||||
}
|
||||
|
||||
public void setViewWinLose( ViewWinLose viewWinLose ){
|
||||
this.viewWinLose = viewWinLose;
|
||||
}
|
||||
|
||||
public ViewWinLose getViewWinLose() {
|
||||
return viewWinLose;
|
||||
}
|
||||
|
||||
public VPlayerPanel getBottomPlayerPanel() {
|
||||
return bottomPlayerPanel;
|
||||
}
|
||||
|
||||
@@ -92,5 +92,11 @@ public class VGameMenu extends FDropDownMenu {
|
||||
SettingsScreen.show(false);
|
||||
}
|
||||
}));
|
||||
addItem(new FMenuItem("Show WinLose Overlay", null, new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
MatchController.instance.showWinlose();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ public class VZoneDisplay extends VCardDisplayArea {
|
||||
|
||||
private void setRevealedPanel(int idx) {
|
||||
try {
|
||||
revealedPanel = cardPanels.get(idx); //??? on network match, triggered by card ability
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
revealedPanel = cardPanels.get(idx); //on network match, when zoomed and cast a card would randomly trigger the bug
|
||||
} catch (Exception e) { //before it was arrayindexoutofbounds, then indexoutofbounds, so just use a general exception
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
||||
private static final float GAP_Y_FACTOR = 0.02f;
|
||||
|
||||
private final FButton btnContinue, btnRestart, btnQuit;
|
||||
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog;
|
||||
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog, btnMinimize;
|
||||
private final FTextArea txtLog;
|
||||
private final OutcomesPanel pnlOutcomes;
|
||||
private final GameView game;
|
||||
@@ -114,6 +114,12 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
||||
}
|
||||
}).build());
|
||||
|
||||
btnMinimize = add(new FLabel.ButtonBuilder().text("Minimize").font(FSkinFont.get(12)).command(new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
hide();
|
||||
}
|
||||
}).build());
|
||||
lblTitle.setText(composeTitle(game0));
|
||||
|
||||
showGameOutcomeSummary();
|
||||
@@ -200,6 +206,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
||||
float y2 = height - dy - h;
|
||||
btnCopyLog.setBounds(width / 4, y2, width / 2, h);
|
||||
txtLog.setBounds(x, y, w, y2 - y - dy);
|
||||
btnMinimize.setBounds(0, 0, width, h);
|
||||
}
|
||||
|
||||
private static class OutcomesPanel extends FContainer {
|
||||
|
||||
Reference in New Issue
Block a user