forked from External/mage
[refactoring][minor] Replaced all tabs with four spaces.
This commit is contained in:
parent
e646e4768d
commit
239a4fb100
2891 changed files with 79411 additions and 79411 deletions
|
|
@ -39,112 +39,112 @@ import mage.view.GameView;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class GameManager {
|
||||
private final static GameManager INSTANCE = new GameManager();
|
||||
private final static GameManager INSTANCE = new GameManager();
|
||||
|
||||
public static GameManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
public static GameManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private GameManager() {}
|
||||
private GameManager() {}
|
||||
|
||||
private ConcurrentHashMap<UUID, GameController> gameControllers = new ConcurrentHashMap<UUID, GameController>();
|
||||
private ConcurrentHashMap<UUID, GameController> gameControllers = new ConcurrentHashMap<UUID, GameController>();
|
||||
|
||||
public UUID createGameSession(Game game, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId, UUID choosingPlayerId) {
|
||||
GameController gameController = new GameController(game, userPlayerMap, tableId, choosingPlayerId);
|
||||
gameControllers.put(game.getId(), gameController);
|
||||
return gameController.getSessionId();
|
||||
}
|
||||
public UUID createGameSession(Game game, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId, UUID choosingPlayerId) {
|
||||
GameController gameController = new GameController(game, userPlayerMap, tableId, choosingPlayerId);
|
||||
gameControllers.put(game.getId(), gameController);
|
||||
return gameController.getSessionId();
|
||||
}
|
||||
|
||||
public void joinGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).join(userId);
|
||||
}
|
||||
public void joinGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).join(userId);
|
||||
}
|
||||
|
||||
public void destroyChatSession(UUID gameId) {
|
||||
gameControllers.remove(gameId);
|
||||
}
|
||||
public void destroyChatSession(UUID gameId) {
|
||||
gameControllers.remove(gameId);
|
||||
}
|
||||
|
||||
public UUID getChatId(UUID gameId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).getChatId();
|
||||
return null;
|
||||
}
|
||||
public UUID getChatId(UUID gameId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).getChatId();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendPlayerUUID(UUID gameId, UUID userId, UUID data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerUUID(userId, data);
|
||||
}
|
||||
public void sendPlayerUUID(UUID gameId, UUID userId, UUID data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerUUID(userId, data);
|
||||
}
|
||||
|
||||
public void sendPlayerString(UUID gameId, UUID userId, String data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerString(userId, data);
|
||||
}
|
||||
public void sendPlayerString(UUID gameId, UUID userId, String data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerString(userId, data);
|
||||
}
|
||||
|
||||
public void sendPlayerBoolean(UUID gameId, UUID userId, Boolean data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerBoolean(userId, data);
|
||||
}
|
||||
public void sendPlayerBoolean(UUID gameId, UUID userId, Boolean data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerBoolean(userId, data);
|
||||
}
|
||||
|
||||
public void sendPlayerInteger(UUID gameId, UUID userId, Integer data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerInteger(userId, data);
|
||||
}
|
||||
public void sendPlayerInteger(UUID gameId, UUID userId, Integer data) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).sendPlayerInteger(userId, data);
|
||||
}
|
||||
|
||||
public void concedeGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).concede(userId);
|
||||
}
|
||||
public void concedeGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).concede(userId);
|
||||
}
|
||||
|
||||
public void watchGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).watch(userId);
|
||||
}
|
||||
public void watchGame(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).watch(userId);
|
||||
}
|
||||
|
||||
public void stopWatching(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).stopWatching(userId);
|
||||
}
|
||||
public void stopWatching(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).stopWatching(userId);
|
||||
}
|
||||
|
||||
public void removeSession(UUID userId) {
|
||||
for (GameController controller: gameControllers.values()) {
|
||||
controller.kill(userId);
|
||||
}
|
||||
}
|
||||
public void removeSession(UUID userId) {
|
||||
for (GameController controller: gameControllers.values()) {
|
||||
controller.kill(userId);
|
||||
}
|
||||
}
|
||||
|
||||
public void kill(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).kill(userId);
|
||||
}
|
||||
public void kill(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).kill(userId);
|
||||
}
|
||||
|
||||
public void cheat(UUID gameId, UUID userId, UUID playerId, DeckCardLists deckList) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).cheat(userId, playerId, deckList);
|
||||
}
|
||||
public void cheat(UUID gameId, UUID userId, UUID playerId, DeckCardLists deckList) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).cheat(userId, playerId, deckList);
|
||||
}
|
||||
|
||||
public boolean cheat(UUID gameId, UUID userId, UUID playerId, String cardName) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).cheat(userId, playerId, cardName);
|
||||
return false;
|
||||
}
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).cheat(userId, playerId, cardName);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void timeout(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).timeout(userId);
|
||||
}
|
||||
public void timeout(UUID gameId, UUID userId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).timeout(userId);
|
||||
}
|
||||
|
||||
public void removeGame(UUID gameId) {
|
||||
gameControllers.remove(gameId);
|
||||
}
|
||||
public void removeGame(UUID gameId) {
|
||||
gameControllers.remove(gameId);
|
||||
}
|
||||
|
||||
public void saveGame(UUID gameId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).saveGame();
|
||||
}
|
||||
public void saveGame(UUID gameId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
gameControllers.get(gameId).saveGame();
|
||||
}
|
||||
|
||||
public GameView getGameView(UUID gameId, UUID userId, UUID playerId) {
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).getGameView(playerId);
|
||||
return null;
|
||||
if (gameControllers.containsKey(gameId))
|
||||
return gameControllers.get(gameId).getGameView(playerId);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue