mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +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) {
|
void updatePlayerTurn(PhaseHandler phaseHandler) {
|
||||||
set(TrackableProperty.PlayerTurn, PlayerView.get(phaseHandler.getPlayerTurn()));
|
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) {
|
public void updatePlanarPlayer(PlayerView p) {
|
||||||
set(TrackableProperty.PlanarPlayer, p);
|
set(TrackableProperty.PlanarPlayer, p);
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ public enum TrackableProperty {
|
|||||||
GameOver(TrackableTypes.BooleanType),
|
GameOver(TrackableTypes.BooleanType),
|
||||||
PoisonCountersToLose(TrackableTypes.IntegerType),
|
PoisonCountersToLose(TrackableTypes.IntegerType),
|
||||||
GameLog(TrackableTypes.StringType),
|
GameLog(TrackableTypes.StringType),
|
||||||
|
NeedsPhaseRedrawn(TrackableTypes.BooleanType),
|
||||||
PlayerTurn(TrackableTypes.PlayerViewType, FreezeMode.IgnoresFreeze),
|
PlayerTurn(TrackableTypes.PlayerViewType, FreezeMode.IgnoresFreeze),
|
||||||
Phase(TrackableTypes.EnumType(PhaseType.class), 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);
|
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(lastPlayer).getPhaseIndicator().getLabel(ph);
|
||||||
if (phaseLabel != null)
|
if (phaseLabel != null)
|
||||||
phaseLabel.setActive(true);
|
phaseLabel.setActive(true);
|
||||||
|
if (GuiBase.isNetworkplay())
|
||||||
|
getGameView().updateNeedsPhaseRedrawn(lastPlayer, PhaseType.CLEANUP);
|
||||||
} else if (getGameView().getPlayerTurn() != null) {
|
} else if (getGameView().getPlayerTurn() != null) {
|
||||||
//set phaselabel
|
//set phaselabel
|
||||||
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(getGameView().getPlayerTurn()).getPhaseIndicator().getLabel(ph);
|
final VPhaseIndicator.PhaseLabel phaseLabel = view.getPlayerPanel(getGameView().getPlayerTurn()).getPhaseIndicator().getLabel(ph);
|
||||||
if (phaseLabel != null)
|
if (phaseLabel != null)
|
||||||
phaseLabel.setActive(true);
|
phaseLabel.setActive(true);
|
||||||
|
if (GuiBase.isNetworkplay())
|
||||||
|
getGameView().updateNeedsPhaseRedrawn(getGameView().getPlayerTurn(), ph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -442,6 +442,17 @@ public class MatchScreen extends FScreen {
|
|||||||
if (activeEffect != null) {
|
if (activeEffect != null) {
|
||||||
activeEffect.draw(g, 10, 10, 100, 100);
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user