phase indicator

This commit is contained in:
Anthony Calosa
2021-10-06 17:46:00 +08:00
parent 0c2b0b3d9a
commit eb01aa8e58
2 changed files with 18 additions and 27 deletions

View File

@@ -209,10 +209,27 @@ public class MatchController extends AbstractGuiGame {
public void alertUser() {
//TODO
}
private PlayerView lastPlayer;
@Override
public void updatePhase(boolean saveState) {
final PhaseType ph = getGameView().getPhase();
if (ph != null) {
if (ph.isBefore(PhaseType.END_OF_TURN))
lastPlayer = getGameView().getPlayerTurn();
//reset phase labels
view.resetAllPhaseButtons();
if (lastPlayer != null && PhaseType.CLEANUP.equals(ph)) {
//set phaselabel
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(lastPlayer).getPhaseIndicator().getLabel(ph);
if (phaseLabel != null)
phaseLabel.setActive(true);
} else if (getGameView().getPlayerTurn() != null) {
//set phaselabel
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(getGameView().getPlayerTurn()).getPhaseIndicator().getLabel(ph);
if (phaseLabel != null)
phaseLabel.setActive(true);
}
}
if(GuiBase.isNetworkplay())
checkStack();

View File

@@ -349,32 +349,6 @@ public class MatchScreen extends FScreen {
return new Rectangle(0, VPrompt.HEIGHT, scroller.getWidth(), getHeight() - 2 * VPrompt.HEIGHT);
}
private PlayerView lastPlayer;
@Override
public void draw(Graphics g) {
super.draw(g);
final GameView game = MatchController.instance.getGameView();
if (game == null) { return; }
if (game.getPhase() != null) {
final PhaseType ph = game.getPhase();
if (ph.isBefore(PhaseType.END_OF_TURN))
lastPlayer = game.getPlayerTurn();
//reset phase labels
resetAllPhaseButtons();
if (lastPlayer != null && PhaseType.CLEANUP.equals(ph)) {
//set phaselabel
final PhaseLabel phaseLabel = getPlayerPanel(lastPlayer).getPhaseIndicator().getLabel(ph);
if (phaseLabel != null)
phaseLabel.setActive(true);
} else if (game.getPlayerTurn() != null) {
//set phaselabel
final PhaseLabel phaseLabel = getPlayerPanel(game.getPlayerTurn()).getPhaseIndicator().getLabel(ph);
if (phaseLabel != null)
phaseLabel.setActive(true);
}
}
}
@Override
protected void drawOverlay(Graphics g) {
final GameView game = MatchController.instance.getGameView();