Added context menu to switch between manual and automatic usage of the mana in mana pool. Manual usage is done by clicking on the mana symbol in the player panel. Still some fine tuning to do.

This commit is contained in:
LevelX2 2014-05-24 02:56:35 +02:00
parent eeead4a8b4
commit 71fb7bf25b
26 changed files with 415 additions and 100 deletions

View file

@ -28,18 +28,25 @@
package mage.interfaces;
import java.util.List;
import java.util.UUID;
import mage.MageException;
import mage.cards.decks.DeckCardLists;
import mage.cards.repository.CardInfo;
import mage.cards.repository.ExpansionInfo;
import mage.constants.ManaType;
import mage.game.GameException;
import mage.game.match.MatchOptions;
import mage.game.tournament.TournamentOptions;
import mage.utils.MageVersion;
import mage.view.*;
import java.util.List;
import java.util.UUID;
import mage.view.DraftPickView;
import mage.view.GameView;
import mage.view.MatchView;
import mage.view.TableView;
import mage.view.TournamentView;
import mage.view.UserDataView;
import mage.view.UserView;
import mage.view.UsersView;
/**
*
@ -107,9 +114,11 @@ public interface MageServer {
void sendPlayerString(UUID gameId, String sessionId, String data) throws MageException;
void sendPlayerBoolean(UUID gameId, String sessionId, Boolean data) throws MageException;
void sendPlayerInteger(UUID gameId, String sessionId, Integer data) throws MageException;
void sendPlayerManaType(UUID gameId, String sessionId, ManaType data) throws MageException;
void concedeGame(UUID gameId, String sessionId) throws MageException;
void quitMatch(UUID gameId, String sessionId) throws MageException;
void undo(UUID gameId, String sessionId) throws MageException;
void setManaPoolMode(UUID gameId, String sessionId, boolean autoPayment) throws MageException;
GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException;
//priority methods

View file

@ -57,6 +57,7 @@ import org.jboss.remoting.transporter.TransporterClient;
import javax.swing.*;
import java.net.*;
import java.util.*;
import mage.constants.ManaType;
/**
*
@ -623,6 +624,21 @@ public class SessionImpl implements Session {
return false;
}
@Override
public boolean sendPlayerManaType(UUID gameId, ManaType data) {
try {
if (isConnected()) {
server.sendPlayerManaType(gameId, sessionId, data);
return true;
}
} catch (MageException ex) {
handleMageException(ex);
} catch (Throwable t) {
handleThrowable(t);
}
return false;
}
@Override
public DraftPickView sendCardPick(UUID draftId, UUID cardId) {
try {
@ -1165,6 +1181,21 @@ public class SessionImpl implements Session {
return false;
}
@Override
public boolean setManaPoolMode(boolean autoPayment, UUID gameId) {
try {
if (isConnected()) {
server.setManaPoolMode(gameId, sessionId, autoPayment);
return true;
}
} catch (MageException ex) {
handleMageException(ex);
} catch (Throwable t) {
handleThrowable(t);
}
return false;
}
@Override
public boolean cheat(UUID gameId, UUID playerId, DeckCardLists deckList) {
try {

View file

@ -27,10 +27,10 @@
*/
package mage.remote.interfaces;
import mage.cards.decks.DeckCardLists;
import mage.view.DraftPickView;
import java.util.UUID;
import mage.cards.decks.DeckCardLists;
import mage.constants.ManaType;
import mage.view.DraftPickView;
/**
* @author noxx
@ -51,6 +51,8 @@ public interface GamePlay {
boolean sendPlayerString(UUID gameId, String data);
boolean sendPlayerManaType(UUID gameId, ManaType data);
boolean concedeGame(UUID gameId);
boolean quitMatch(UUID gameId);
@ -99,4 +101,13 @@ public interface GamePlay {
*/
boolean restorePriority(UUID gameId);
/**
* This method toggles usage of mana pool
*
* @param automatic true mana in pool will be used automatically
* @param gameId
* @return
*/
boolean setManaPoolMode(boolean automatic, UUID gameId);
}