mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Split up choose entity between desktop and mobile to allow varying implementations for search and reveal combo dialog
This commit is contained in:
@@ -10,11 +10,15 @@ import forge.LobbyPlayer;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.assets.ISkinImage;
|
||||
import forge.deck.CardPool;
|
||||
import forge.game.GameEntity;
|
||||
import forge.game.player.DelayedReveal;
|
||||
import forge.game.player.IHasIcon;
|
||||
import forge.item.PaperCard;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.sound.IAudioClip;
|
||||
import forge.sound.IAudioMusic;
|
||||
import forge.view.CardView;
|
||||
import forge.view.GameEntityView;
|
||||
|
||||
public interface IGuiBase {
|
||||
boolean isRunningOnDesktop();
|
||||
@@ -36,6 +40,7 @@ public interface IGuiBase {
|
||||
<T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
||||
final List<T> sourceChoices, final List<T> destChoices, final CardView referenceCard, final boolean sideboardingMode);
|
||||
List<PaperCard> sideboard(CardPool sideboard, CardPool main);
|
||||
GameEntityView chooseSingleEntityForEffect(String title, Collection<? extends GameEntity> optionList, DelayedReveal delayedReveal, boolean isOptional, PlayerControllerHuman controller);
|
||||
String showFileDialog(String title, String defaultDir);
|
||||
File getSaveFile(File defaultFile);
|
||||
void showCardList(final String title, final String message, final List<PaperCard> list);
|
||||
|
||||
@@ -159,6 +159,14 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
}
|
||||
|
||||
private final HashSet<Card> tempShownCards = new HashSet<Card>();
|
||||
public <T> void tempShow(Iterable<T> objects) {
|
||||
for (final T t : objects) {
|
||||
if (t instanceof Card) {
|
||||
// assume you may see any card passed through here
|
||||
tempShowCard((Card) t);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void tempShowCard(Card c) {
|
||||
CardView cv = MatchUtil.cards.get(c.getId());
|
||||
if (!cv.mayBeShown()) {
|
||||
@@ -423,17 +431,8 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
return Iterables.getFirst(input.getSelected(), null);
|
||||
}
|
||||
|
||||
if (delayedReveal != null) {
|
||||
delayedReveal.reveal(this); //TODO: Merge this into search dialog
|
||||
}
|
||||
for (final T t : optionList) {
|
||||
if (t instanceof Card) {
|
||||
// assume you may see any card passed through here
|
||||
tempShowCard((Card) t);
|
||||
}
|
||||
}
|
||||
final GameEntityView result = isOptional ? SGuiChoose.oneOrNone(getGui(), title, gameView.getGameEntityViews((Iterable<GameEntity>) optionList, false)) : SGuiChoose.one(getGui(), title, gameView.getGameEntityViews((Iterable<GameEntity>) optionList, false));
|
||||
endTempShowCards();
|
||||
final GameEntityView result = getGui().chooseSingleEntityForEffect(title, optionList, delayedReveal, isOptional, this);
|
||||
endTempShowCards(); //assume tempShow called by getGui().chooseSingleEntityForEffect
|
||||
return (T) gameView.getGameEntity(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ public abstract class LocalGameView implements IGameView {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final List<GameEntityView> getGameEntityViews(final Iterable<GameEntity> entities, final boolean forceUpdate) {
|
||||
public final List<GameEntityView> getGameEntityViews(final Iterable<? extends GameEntity> entities, final boolean forceUpdate) {
|
||||
List<GameEntityView> views = new ArrayList<GameEntityView>();
|
||||
for (GameEntity e : entities) {
|
||||
views.add(getGameEntityView(e, forceUpdate));
|
||||
|
||||
Reference in New Issue
Block a user