コード例 #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("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();
        }
      }
    }
  }
コード例 #2
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");
  }