コード例 #1
0
 /**
  * Connect.
  *
  * @param nickname player nickname
  * @param ip the host ip
  */
 public static void connect(String nickname, String ip) {
   getLocalPlayer().setName(nickname);
   client = new Client(ip, 21255);
   if (client.isOpen()) {
     lobby = new ClientLobbyStage(client.getSession());
     setCurrentStage(lobby);
     client.start();
   } else {
     currentStage.addEntity(
         new Notification(
             180,
             120,
             "default_med",
             "ERROR: Could not connect to the server!",
             5f,
             new Color(255, 100, 100),
             0f));
   }
 }
コード例 #2
0
 /**
  * Gets the session.
  *
  * @return the session
  */
 public static Session getSession() {
   if (client == null) return testSession;
   return client.getSession();
 }