Package mage.server

Examples of mage.server.Session


    updateGame(replay.previous(), replay.getGame());
  }

  @Override
  public void gameResult(final String result) {
    Session session = SessionManager.getInstance().getSession(sessionId);
    if (session != null)
      session.fireCallback(new ClientCallback("replayDone", result));
  }
View Full Code Here


  private void updateGame(final GameState state, Game game) {
    if (state == null) {
      gameResult("game ended");
    }
    else {
      Session session = SessionManager.getInstance().getSession(sessionId);
      if (session != null)
        session.fireCallback(new ClientCallback("replayUpdate", new GameView(state, game)));
    }
  }
View Full Code Here

    this.gameId = gameId;
  }

  public boolean init(final GameView gameView) {
    if (!killed) {
      Session session = SessionManager.getInstance().getSession(sessionId);
      if (session != null) {
        session.clearAck();
        session.fireCallback(new ClientCallback("gameInit", gameView));
        if (waitForAck("gameInit"))
          return true;
      }
    }
    return false;
View Full Code Here

    }
    return false;
  }

  public boolean waitForAck(String message) {
    Session session = SessionManager.getInstance().getSession(sessionId);
    do {
      //TODO: add timeout
    } while (!session.getAckMessage().equals(message) && !killed);
    return true;
  }
View Full Code Here

    return true;
  }

  public void update(final GameView gameView) {
    if (!killed) {
      Session session = SessionManager.getInstance().getSession(sessionId);
      if (session != null)
        session.fireCallback(new ClientCallback("gameUpdate", gameView));
    }
  }
View Full Code Here

    }
  }

  public void inform(final String message, final GameView gameView) {
    if (!killed) {
      Session session = SessionManager.getInstance().getSession(sessionId);
      if (session != null)
        session.fireCallback(new ClientCallback("gameInform", new GameClientMessage(gameView, message)));
    }
  }
View Full Code Here

    }
  }

  public void gameOver(final String message) {
    if (!killed) {
      Session session = SessionManager.getInstance().getSession(sessionId);
      if (session != null)
        session.fireCallback(new ClientCallback("gameOver", message));
    }
  }
View Full Code Here

TOP

Related Classes of mage.server.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.