mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
[Mobile] refactor netplay phase indicator
This commit is contained in:
@@ -96,6 +96,19 @@ public class GameView extends TrackableObject {
|
||||
void updatePlayerTurn(PhaseHandler phaseHandler) {
|
||||
set(TrackableProperty.PlayerTurn, PlayerView.get(phaseHandler.getPlayerTurn()));
|
||||
}
|
||||
public void updateNeedsPhaseRedrawn(PlayerView p, PhaseType ph) {
|
||||
set(TrackableProperty.PlayerTurn, p);
|
||||
set(TrackableProperty.Phase, ph);
|
||||
set(TrackableProperty.NeedsPhaseRedrawn, true);
|
||||
}
|
||||
public boolean getNeedsPhaseRedrawn() {
|
||||
if (get(TrackableProperty.NeedsPhaseRedrawn) == null)
|
||||
return false;
|
||||
return get(TrackableProperty.NeedsPhaseRedrawn);
|
||||
}
|
||||
public void clearNeedsPhaseRedrawn() {
|
||||
set(TrackableProperty.NeedsPhaseRedrawn, false);
|
||||
}
|
||||
|
||||
public void updatePlanarPlayer(PlayerView p) {
|
||||
set(TrackableProperty.PlanarPlayer, p);
|
||||
|
||||
@@ -256,6 +256,7 @@ public enum TrackableProperty {
|
||||
GameOver(TrackableTypes.BooleanType),
|
||||
PoisonCountersToLose(TrackableTypes.IntegerType),
|
||||
GameLog(TrackableTypes.StringType),
|
||||
NeedsPhaseRedrawn(TrackableTypes.BooleanType),
|
||||
PlayerTurn(TrackableTypes.PlayerViewType, FreezeMode.IgnoresFreeze),
|
||||
Phase(TrackableTypes.EnumType(PhaseType.class), FreezeMode.IgnoresFreeze);
|
||||
|
||||
|
||||
@@ -223,11 +223,15 @@ public class MatchController extends AbstractGuiGame {
|
||||
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(lastPlayer).getPhaseIndicator().getLabel(ph);
|
||||
if (phaseLabel != null)
|
||||
phaseLabel.setActive(true);
|
||||
if (GuiBase.isNetworkplay())
|
||||
getGameView().updateNeedsPhaseRedrawn(lastPlayer, PhaseType.CLEANUP);
|
||||
} 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())
|
||||
getGameView().updateNeedsPhaseRedrawn(getGameView().getPlayerTurn(), ph);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -442,6 +442,17 @@ public class MatchScreen extends FScreen {
|
||||
if (activeEffect != null) {
|
||||
activeEffect.draw(g, 10, 10, 100, 100);
|
||||
}
|
||||
|
||||
if (game.getNeedsPhaseRedrawn()) {
|
||||
resetAllPhaseButtons();
|
||||
if (game.getPlayerTurn() != null && game.getPhase() != null) {
|
||||
final PhaseLabel phaseLabel = getPlayerPanel(game.getPlayerTurn()).getPhaseIndicator().getLabel(game.getPhase());
|
||||
if (phaseLabel != null) {
|
||||
phaseLabel.setActive(true);
|
||||
game.clearNeedsPhaseRedrawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user