Пример #1
0
  @Override
  public void HUDAreaClicked(HUDArea ha) {
    HUDArea hudArea = null;

    for (int i = 0; i < hudAreas.size(); i++) {
      hudArea = hudAreas.get(i);
      if (hudArea == ha) {
        if (hudArea.getType().equals("single_player")) {
          hudManager.unloadHUD(name);
          hudManager.loadHUD(HUDManager.HUDType.ScreenCharacterSelection);
        } else if (hudArea.getType().equals("multi_player")) {
          if (hudManager.getIsOnline() && Game.VERSION.equals(hudManager.getCurrentVersion())) {
            hudManager.unloadHUD(name);
            hudManager.loadHUD(HUDManager.HUDType.ScreenMultiPlayer);
          } else {
            registry.showMessage(
                "Error",
                "Must be online and have latest version to play.  Try updating and restarting.");
          }
        } else if (hudArea.getType().equals("settings")) {
          hudManager.unloadHUD(name);
          hudManager.loadHUD(HUDManager.HUDType.ScreenSettings);
        } else if (hudArea.getType().equals("exit")) {
          hudManager.gameExit();
        } else if (hudArea.getType().equals("donate")) {
          String url = "http://www.epicinventor.com/donate.html";

          try {
            Desktop.getDesktop().browse(java.net.URI.create(url));
          } catch (Exception e) {
          }
        } else if (hudArea.getType().equals("help")) {
          String url = "http://www.epicinventor.com/help.html";

          try {
            Desktop.getDesktop().browse(java.net.URI.create(url));
          } catch (Exception e) {
          }
        } else if (hudArea.getType().equals("download")) {
          Process p = null;
          try {
            p = Runtime.getRuntime().exec("EpicInventorUpdater");
          } catch (IOException ex) {
          }

          if (p == null) {
            registry.showMessage(
                "Error", "Could not launch auto-updater, run manually from folder");
          } else {
            hudManager.gameExit();
          }
        }
      }
    }
  }
Пример #2
0
  @Override
  public void HUDAreaClicked(HUDArea ha) {
    HUDArea hudArea = null;

    for (int i = 0; i < hudAreas.size(); i++) {
      hudArea = hudAreas.get(i);
      if (hudArea == ha) {
        if (hudArea.getType().equals("main_menu")) {
          SoundClip cl = new SoundClip("Misc/Click");
          hudManager.unloadHUD(name);
          hudManager.togglePauseHUD();
        } else if (hudArea.getType().equals("exit")) {
          SoundClip cl = new SoundClip("Misc/Click");
          hudManager.unloadHUD(name);
          hudManager.resumeMasterGame();
        } else if (hudArea.getType().equals("next")) {
          SoundClip cl = new SoundClip("Misc/Click");
          if (currentImage < IMAGE_COUNT) {
            currentImage++;
            setImage("HUD/Tutorial/" + currentImage);
          }
          if (currentImage >= IMAGE_COUNT) {
            hudArea.setIsActive(false);
            this.getHUDAreaByType("finish").setIsActive(true);
          }
        } else if (hudArea.getType().equals("finish")) {
          SoundClip cl = new SoundClip("Misc/Click");
          hudManager.unloadHUD(name);
          hudManager.resumeMasterGame();
        }
      }
    }
  }
Пример #3
0
  public HUDTutorial(HUDManager hm, Registry rg, int x, int y, int w, int h) {
    super(hm, rg, x, y, w, h);

    setImage("HUD/Tutorial/1");

    HUDArea hudArea = null;

    // next
    hudArea = addArea(NEXT_X, NEXT_Y, NEXT_WIDTH, NEXT_HEIGHT, "next");
    hudArea.setImage("HUD/Tutorial/ButtonNext");

    // finish
    hudArea = addArea(FINISH_X, FINISH_Y, FINISH_WIDTH, FINISH_HEIGHT, "finish");
    hudArea.setImage("HUD/Tutorial/ButtonFinish");
    hudArea.setIsActive(false);

    // main_menu
    hudArea = addArea(MAIN_MENU_X, MAIN_MENU_Y, MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT, "main_menu");
    hudArea.setImage("HUD/Tutorial/ButtonMainMenu");

    // exit
    hudArea = addArea(EXIT_X, EXIT_Y, EXIT_WIDTH, EXIT_HEIGHT, "exit");
    hudArea.setImage("HUD/Tutorial/ButtonExit");
  }
Пример #4
0
  public HUDScreenMain(HUDManager hm, Registry rg, int x, int y, int w, int h) {
    super(hm, rg, x, y, w, h);

    setImage("HUD/ScreenMain/BG");

    HUDArea hudArea = null;

    // single player
    hudArea =
        addArea(
            BUTTON_SINGLE_PLAYER_X,
            BUTTON_SINGLE_PLAYER_Y,
            BUTTON_LARGE_WIDTH,
            BUTTON_LARGE_HEIGHT,
            "single_player");
    hudArea.setImage("HUD/ScreenMain/ButtonSinglePlayer");

    // multi player
    hudArea =
        addArea(
            BUTTON_MULTI_PLAYER_X,
            BUTTON_MULTI_PLAYER_Y,
            BUTTON_LARGE_WIDTH,
            BUTTON_LARGE_HEIGHT,
            "multi_player");
    if (hudManager.getIsOnline() && Game.VERSION.equals(hudManager.getCurrentVersion())) {
      hudArea.setImage("HUD/ScreenMain/ButtonMultiPlayer");
    } else {
      hudArea.setImage("HUD/ScreenMain/ButtonMultiPlayerOff");
    }

    // settings
    hudArea =
        addArea(BUTTON_SETTINGS_X, BUTTON_SETTINGS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "settings");
    hudArea.setImage("HUD/ScreenMain/ButtonSettings");

    // credits
    // hudArea = addArea(BUTTON_CREDITS_X, BUTTON_CREDITS_Y, BUTTON_WIDTH, BUTTON_HEIGHT,
    // "credits");
    // hudArea.setImage("HUD/ScreenMain/ButtonCredits");

    // exit
    hudArea = addArea(BUTTON_EXIT_X, BUTTON_EXIT_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "exit");
    hudArea.setImage("HUD/ScreenMain/ButtonExit");

    // donate
    hudArea =
        addArea(
            BUTTON_DONATE_X, BUTTON_DONATE_Y, BUTTON_DONATE_WIDTH, BUTTON_DONATE_HEIGHT, "donate");
    hudArea.setImage("HUD/Common/Donate");

    // help
    // hudArea = addArea(BUTTON_HELP_X, BUTTON_HELP_Y, BUTTON_HELP_WIDTH, BUTTON_HELP_HEIGHT,
    // "help");
    // hudArea.setImage("HUD/Common/Help");

    if (hudManager.getIsOnline() && !Game.VERSION.equals(hudManager.getCurrentVersion())) {
      // download
      hudArea =
          addArea(
              BUTTON_DOWNLOAD_X,
              BUTTON_DOWNLOAD_Y,
              BUTTON_DOWNLOAD_WIDTH,
              BUTTON_DOWNLOAD_HEIGHT,
              "download");
      hudArea.setImage("HUD/ScreenMain/NewVersion");
    }

    hudManager.setStartServer(false);
    hudManager.setServerJoin(false);
  }