Ejemplo n.º 1
0
  private void runSession() {
    while (true) {
      shell = arseGUI.open(display);
      initializeARSE();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }

      if (gameMasterMode) {
        gameMasterSession = new GameMasterSession(display);
        gameMasterSession.open();

        gameMasterMode = false;
      } else if (playerMode) {
        playerLoginGUI = new PlayerLoginGUI();
        playerSession = new PlayerSession(display);
        shell = playerLoginGUI.open(display);
        initializePlayerLoginGUI();
        while (!shell.isDisposed()) {
          if (!display.readAndDispatch()) display.sleep();
        }

        if (playerSession.loggedIn()) {
          playerSession.open();
        }
        playerMode = false;
      } else break;
    }
  }
Ejemplo n.º 2
0
  private void initializePlayerLoginGUI() {
    playerLoginGUI.addLoginListener(
        new SelectionListener() {
          private void login() {
            try {
              playerSession.login(
                  playerLoginGUI.getName(), playerLoginGUI.getAddress(), playerLoginGUI.getPort());
              shell.dispose();
            } catch (LoginErrorException e) {
              playerLoginGUI.alert(e.getMessage(), shell);
            }
          }

          public void widgetSelected(SelectionEvent e) {
            login();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            login();
          }
        });
  }