mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix mobile game compile errors from recent refactoring
This commit is contained in:
@@ -2195,6 +2195,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
controllerCreator = ctrlr;
|
||||
controller = ctrlr;
|
||||
view.updateAvatarIndex(this);
|
||||
view.updateAvatarCardImageKey(this);
|
||||
view.updateIsAI(this);
|
||||
view.updateLobbyPlayerName(this);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,13 @@ public class PlayerView extends GameEntityView {
|
||||
set(TrackableProperty.AvatarIndex, p.getLobbyPlayer().getAvatarIndex());
|
||||
}
|
||||
|
||||
public String getAvatarCardImageKey() {
|
||||
return get(TrackableProperty.AvatarCardImageKey);
|
||||
}
|
||||
void updateAvatarCardImageKey(Player p) {
|
||||
set(TrackableProperty.AvatarCardImageKey, p.getLobbyPlayer().getAvatarCardImageKey());
|
||||
}
|
||||
|
||||
public FCollectionView<PlayerView> getOpponents() {
|
||||
return get(TrackableProperty.Opponents);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public enum TrackableProperty {
|
||||
IsAI(TrackableTypes.BooleanType),
|
||||
LobbyPlayerName(TrackableTypes.StringType),
|
||||
AvatarIndex(TrackableTypes.IntegerType),
|
||||
AvatarCardImageKey(TrackableTypes.StringType),
|
||||
Opponents(TrackableTypes.PlayerViewCollectionType),
|
||||
Life(TrackableTypes.IntegerType),
|
||||
PoisonCounters(TrackableTypes.IntegerType),
|
||||
|
||||
@@ -49,7 +49,7 @@ public class MatchController implements IMatchController {
|
||||
private MatchController() { }
|
||||
public static final MatchController instance = new MatchController();
|
||||
|
||||
private static final Map<LobbyPlayer, FImage> avatarImages = new HashMap<LobbyPlayer, FImage>();
|
||||
private static final Map<String, FImage> avatarImages = new HashMap<String, FImage>();
|
||||
|
||||
private static MatchScreen view;
|
||||
|
||||
@@ -58,21 +58,21 @@ public class MatchController implements IMatchController {
|
||||
}
|
||||
|
||||
public static FImage getPlayerAvatar(final PlayerView p) {
|
||||
LobbyPlayer lp = p.getLobbyPlayer();
|
||||
String lp = p.getLobbyPlayerName();
|
||||
FImage avatar = avatarImages.get(lp);
|
||||
if (avatar == null) {
|
||||
if (lp.getAvatarCardImageKey() == null) {
|
||||
avatar = new FTextureRegionImage(FSkin.getAvatars().get(lp.getAvatarIndex()));
|
||||
if (p.getAvatarCardImageKey() == null) {
|
||||
avatar = new FTextureRegionImage(FSkin.getAvatars().get(p.getAvatarIndex()));
|
||||
}
|
||||
else { //handle lobby players with art from cards
|
||||
avatar = CardRenderer.getCardArt(lp.getAvatarCardImageKey(), false);
|
||||
avatar = CardRenderer.getCardArt(p.getAvatarCardImageKey(), false);
|
||||
}
|
||||
}
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public static void setPlayerAvatar(final LobbyPlayer lp, final FImage avatarImage) {
|
||||
avatarImages.put(lp, avatarImage);
|
||||
avatarImages.put(lp.getName(), avatarImage);
|
||||
}
|
||||
|
||||
public void refreshCardDetails(Iterable<CardView> cards) {
|
||||
@@ -176,7 +176,7 @@ public class MatchController implements IMatchController {
|
||||
public void updatePlayerControl() {
|
||||
//show/hide hand for top player based on whether the opponent is controlled
|
||||
if (MatchUtil.getHumanCount() == 1) {
|
||||
Player player = Player.get(view.getTopPlayerPanel().getPlayer());
|
||||
PlayerView player = view.getTopPlayerPanel().getPlayer();
|
||||
if (player.getMindSlaveMaster() != null) {
|
||||
view.getTopPlayerPanel().setSelectedZone(ZoneType.Hand);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import forge.game.GameView;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.combat.CombatView;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerView;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.match.MatchUtil;
|
||||
@@ -231,7 +230,7 @@ public class MatchScreen extends FScreen {
|
||||
}
|
||||
|
||||
public boolean isTopHumanPlayerActive() {
|
||||
return topPlayerPrompt != null && Player.get(topPlayerPanel.getPlayer()) == MatchUtil.getCurrentPlayer();
|
||||
return topPlayerPrompt != null && topPlayerPanel.getPlayer() == MatchUtil.getCurrentPlayer().getView();
|
||||
}
|
||||
|
||||
public VPrompt getActivePrompt() {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class VManaPool extends VDisplayArea {
|
||||
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count) {
|
||||
if (player.getLobbyPlayer() == GamePlayerUtil.getGuiPlayer()) {
|
||||
if (player.isLobbyPlayer(GamePlayerUtil.getGuiPlayer())) {
|
||||
MatchUtil.getHumanController().useMana(colorCode);
|
||||
}
|
||||
return true;
|
||||
@@ -89,7 +89,7 @@ public class VManaPool extends VDisplayArea {
|
||||
|
||||
@Override
|
||||
public boolean flick(float x, float y) {
|
||||
if (player.getLobbyPlayer() == GamePlayerUtil.getGuiPlayer()) {
|
||||
if (player.isLobbyPlayer(GamePlayerUtil.getGuiPlayer())) {
|
||||
//on two finger tap, keep using mana until it runs out or no longer can be put towards the cost
|
||||
while (MatchUtil.getHumanController().useMana(colorCode)) {}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ public class VPlayerPanel extends FContainer {
|
||||
}
|
||||
|
||||
//when gui player loses life, vibrate device for a length of time based on amount of life lost
|
||||
if (vibrateDuration > 0 && player.getLobbyPlayer() == MatchUtil.getGuiPlayer() &&
|
||||
if (vibrateDuration > 0 && player.isLobbyPlayer(MatchUtil.getGuiPlayer()) &&
|
||||
FModel.getPreferences().getPrefBoolean(FPref.UI_VIBRATE_ON_LIFE_LOSS)) {
|
||||
//never vibrate more than two seconds regardless of life lost or poison counters gained
|
||||
Gdx.input.vibrate(Math.min(vibrateDuration, 2000));
|
||||
|
||||
Reference in New Issue
Block a user