@Override
 public boolean keyEvent(final NiftyInputEvent inputEvent) {
   if (inputEvent == NiftyInputEvent.ConsoleToggle) {
     if (screen.isActivePopup(consolePopup)) {
       nifty.closePopup(consolePopup.getId());
     } else {
       nifty.showPopup(screen, consolePopup.getId(), null);
     }
     return true;
   }
   return false;
 }
 public void ClosePopulationPopup() {
   if (PopulationPopup != null) {
     nifty.closePopup(PopulationPopup.getId());
     PopulationPopup = null;
   }
   enableMouseWheel();
 }
  public void OpenMenuPopup() {
    CloseMenuPopup();
    Game game = Main.app.getStateManager().getState(Game.class);
    game.Pause(true);

    MenuPopup = nifty.createPopup("MenuPopup");
    nifty.showPopup(screen, MenuPopup.getId(), null);
  }
  public void OpenPopulationPopup() {
    ClosePopulationPopup();
    Game game = Main.app.getStateManager().getState(Game.class);
    game.Pause(true);
    // prevent mouse wheel interfering with scrolling a menu
    // TODO there may be a better way of doing this, e.g. nifty not passing the mousewheel event to
    // the game.
    disableMouseWheel();

    PopulationPopup = nifty.createPopup("PopulationPopup");
    nifty.showPopup(screen, PopulationPopup.getId(), null);
  }
 public void showPopup() {
   nifty.showPopup(nifty.getCurrentScreen(), popup.getId(), null);
 }
 public void closePopup() {
   nifty.closePopup(popup.getId());
 }
 @NiftyEventSubscriber(id = "creditsBack")
 public void onCreditsBackClick(final String id, final ButtonClickedEvent event) {
   nifty.closePopup(creditsPopup.getId());
 }
 private void showCredits() {
   nifty.showPopup(screen, creditsPopup.getId(), null);
 }
 public void CloseMenuPopup() {
   if (MenuPopup != null) {
     nifty.closePopup(MenuPopup.getId());
     MenuPopup = null;
   }
 }