* UI: added playable/activatable cards highlight in all zone and windows (mana abilities, commander, graveyard, revealed, etc);

This commit is contained in:
Oleg Agafonov 2019-06-28 03:30:57 +04:00
parent fe52ffd56a
commit f6123037ec
15 changed files with 302 additions and 192 deletions

View file

@ -32,7 +32,7 @@ import java.util.stream.Collectors;
/**
* @author BetaSteward_at_googlemail.com
*/
public class CardView extends SimpleCardView {
public class CardView extends SimpleCardView implements SelectableObjectView {
private static final long serialVersionUID = 1L;

View file

@ -1,21 +1,18 @@
package mage.view;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
/**
*
* @author Plopman
*/
public interface CommandObjectView extends Serializable {
public String getExpansionSetCode();
public interface CommandObjectView extends SelectableObjectView {
public String getName();
String getExpansionSetCode();
public UUID getId();
String getName();
public List<String> getRules();
UUID getId();
List<String> getRules();
}

View file

@ -1,10 +1,11 @@
package mage.view;
import mage.cards.Card;
import mage.game.command.Emblem;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import mage.cards.Card;
import mage.game.command.Emblem;
/**
* @author noxx
@ -15,24 +16,24 @@ public class EmblemView implements CommandObjectView, Serializable {
protected String name;
protected String expansionSetCode;
protected List<String> rules;
protected boolean isPlayable = false;
public EmblemView(Emblem emblem, Card sourceCard) {
id = emblem.getId();
name = "Emblem " + sourceCard.getName();
this.id = emblem.getId();
this.name = "Emblem " + sourceCard.getName();
if (emblem.getExpansionSetCodeForImage() == null) {
expansionSetCode = sourceCard.getExpansionSetCode();
this.expansionSetCode = sourceCard.getExpansionSetCode();
} else {
expansionSetCode = emblem.getExpansionSetCodeForImage();
this.expansionSetCode = emblem.getExpansionSetCodeForImage();
}
rules = emblem.getAbilities().getRules(sourceCard.getName());
this.rules = emblem.getAbilities().getRules(sourceCard.getName());
}
public EmblemView(Emblem emblem) {
id = emblem.getId();
name = emblem.getName();
expansionSetCode = emblem.getExpansionSetCodeForImage();
rules = emblem.getAbilities().getRules(emblem.getName());
this.id = emblem.getId();
this.name = emblem.getName();
this.expansionSetCode = emblem.getExpansionSetCodeForImage();
this.rules = emblem.getAbilities().getRules(emblem.getName());
}
@Override
@ -54,4 +55,37 @@ public class EmblemView implements CommandObjectView, Serializable {
public List<String> getRules() {
return rules;
}
@Override
public boolean isPlayable() {
return isPlayable;
}
@Override
public void setPlayable(boolean isPlayable) {
this.isPlayable = isPlayable;
}
@Override
public boolean isChoosable() {
// unsupported
return false;
}
@Override
public void setChoosable(boolean isChoosable) {
// unsupported
}
@Override
public boolean isSelected() {
// unsupported
return false;
}
@Override
public void setSelected(boolean selected) {
// unsupported
}
}

View file

@ -39,7 +39,7 @@ public class GameView implements Serializable {
private final int priorityTime;
private final List<PlayerView> players = new ArrayList<>();
private CardsView hand;
private Set<UUID> canPlayInHand;
private Set<UUID> canPlayObjects;
private Map<String, SimpleCardsView> opponentHands;
private Map<String, SimpleCardsView> watchedHands;
private final CardsView stack = new CardsView();
@ -300,12 +300,12 @@ public class GameView implements Serializable {
return isPlayer;
}
public Set<UUID> getCanPlayInHand() {
return canPlayInHand;
public Set<UUID> getCanPlayObjects() {
return canPlayObjects;
}
public void setCanPlayInHand(Set<UUID> canPlayInHand) {
this.canPlayInHand = canPlayInHand;
public void setCanPlayObjects(Set<UUID> canPlayObjects) {
this.canPlayObjects = canPlayObjects;
}
public int getSpellsCastCurrentTurn() {

View file

@ -1,10 +1,11 @@
package mage.view;
import mage.cards.Card;
import mage.game.command.Plane;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import mage.cards.Card;
import mage.game.command.Plane;
/**
* @author spjspj
@ -16,23 +17,24 @@ public class PlaneView implements CommandObjectView, Serializable {
protected String expansionSetCode;
protected List<String> rules;
public PlaneView(Plane plane, Card sourceCard) {
id = plane.getId();
name = "Plane " + sourceCard.getName();
if (plane.getExpansionSetCodeForImage() == null) {
expansionSetCode = sourceCard.getExpansionSetCode();
} else {
expansionSetCode = plane.getExpansionSetCodeForImage();
}
protected boolean isPlayable = false;
rules = plane.getAbilities().getRules(sourceCard.getName());
public PlaneView(Plane plane, Card sourceCard) {
this.id = plane.getId();
this.name = "Plane " + sourceCard.getName();
if (plane.getExpansionSetCodeForImage() == null) {
this.expansionSetCode = sourceCard.getExpansionSetCode();
} else {
this.expansionSetCode = plane.getExpansionSetCodeForImage();
}
this.rules = plane.getAbilities().getRules(sourceCard.getName());
}
public PlaneView(Plane plane) {
id = plane.getId();
name = plane.getName();
expansionSetCode = plane.getExpansionSetCodeForImage();
rules = plane.getAbilities().getRules(plane.getName());
this.id = plane.getId();
this.name = plane.getName();
this.expansionSetCode = plane.getExpansionSetCodeForImage();
this.rules = plane.getAbilities().getRules(plane.getName());
}
@Override
@ -54,4 +56,36 @@ public class PlaneView implements CommandObjectView, Serializable {
public List<String> getRules() {
return rules;
}
@Override
public boolean isPlayable() {
return isPlayable;
}
@Override
public void setPlayable(boolean isPlayable) {
this.isPlayable = isPlayable;
}
@Override
public boolean isChoosable() {
// unsupported
return false;
}
@Override
public void setChoosable(boolean isChoosable) {
// unsupported
}
@Override
public boolean isSelected() {
// unsupported
return false;
}
@Override
public void setSelected(boolean selected) {
// unsupported
}
}

View file

@ -0,0 +1,19 @@
package mage.view;
/**
* @author JayDi85
*/
public interface SelectableObjectView {
boolean isPlayable();
void setPlayable(boolean isPlayable);
boolean isChoosable();
void setChoosable(boolean isChoosable);
boolean isSelected();
void setSelected(boolean selected);
}