示例#1
0
  @Override
  public void show() {
    super.show();

    // retrieve the custom skin for our 2D widgets
    Skin skin = super.getSkin();

    // create the table actor and add it to the stage
    table = super.getTable();
    table.setWidth(stage.getWidth());
    table.setHeight(stage.getHeight());
    table.pad(10).defaults().spaceBottom(10).space(5);
    table.row().fill().expandX();
    AtlasRegion splashRegion = getAtlas().findRegion("splash-screen/menulogo");
    Image logo = new Image(splashRegion);
    table.add(logo).fill(false);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    TextButton continueButton = new TextButton("Continue", skin);
    continueButton.setVisible(false);
    continueButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            //                game.setScreen( new StartGameScreen( game ) );
          }
        });
    table.add(continueButton).size(300, 60).uniform().spaceBottom(10);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    TextButton newGameButton = new TextButton("New game", skin);
    newGameButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            // TODO: Move it back to char select screen
            //                game.setScreen( new CharSelectScreen( game ) );
            if (Unsealed.DEBUG) game.setScreen(new BattleScreen(game));
            else game.setScreen(new SplashScreen(game));
          }
        });
    table.add(newGameButton).size(300, 60).uniform().spaceBottom(10);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    //        TextButton optionsButton = new TextButton( "Options", skin );
    //        optionsButton.setDisabled(true);
    //        optionsButton.addListener( new ClickListener() {
    //            @Override
    //            public void clicked(InputEvent event, float x, float y ) {
    //                game.setScreen( new OptionsScreen( game ) );
    //            }
    //        } );
    //        table.add(optionsButton).size( 300, 60 ).uniform().spaceBottom(10);
  }
示例#2
0
文件: Menu.java 项目: vieux/hnefatafl
  @Override
  public void show() {
    super.show();

    table = new Table();
    table.setFillParent(true);

    TextButtonStyle bStyle = new TextButtonStyle();
    bStyle.font = Cache.getFont(48);
    bStyle.fontColor = Color.LIGHT_GRAY;
    final TextButton buttonPlay = new TextButton("PLAY", bStyle);

    buttonPlay.pad(20);
    table.add(buttonPlay);

    table.row();
    final TextButton buttonCredits = new TextButton("CREDITS", bStyle);

    buttonCredits.pad(20);
    table.add(buttonCredits);
    table.row();
    final TextButton buttonExit = new TextButton("EXIT", bStyle);

    buttonExit.pad(20);
    table.add(buttonExit);
    table.pad(150, 0, 0, 0);
    getStage().addActor(table);

    buttonPlay.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            onExit(new LevelSelect(getGame()), buttonPlay, buttonCredits, buttonExit);
          }
        });
    buttonCredits.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            onExit(new Credits(getGame()), buttonPlay, buttonCredits, buttonExit);
          }
        });
    buttonExit.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Gdx.app.exit();
          }
        });
    Tween.set(buttonPlay, ActorAccessor.ALPHA).target(0).start(getTweenManager());
    Tween.to(buttonPlay, ActorAccessor.ALPHA, 1).target(1).start(getTweenManager());
    Tween.set(buttonCredits, ActorAccessor.ALPHA).target(0).start(getTweenManager());
    Tween.to(buttonCredits, ActorAccessor.ALPHA, 1).target(1).delay(0.1f).start(getTweenManager());
    Tween.set(buttonExit, ActorAccessor.ALPHA).target(0).start(getTweenManager());
    Tween.to(buttonExit, ActorAccessor.ALPHA, 1).target(1).delay(0.2f).start(getTweenManager());

    Gdx.input.setInputProcessor(new InputMultiplexer(getStage(), new TouchDetector(this)));
  }
示例#3
0
 public void setStyle(Style style) {
   this.style = style;
   // window
   window.setBackground(style.background);
   window.pad(style.vPad, style.hPad, style.vPad, style.hPad);
   // title
   title.setStyle(style.title);
   // action buttons
   actionsGroup.setStyle(style.actionsGroup);
 }
示例#4
0
 /**
  * Sets the background drawable and sets the table's padding to {@link Drawable#getBottomHeight()}
  * , {@link Drawable#getTopHeight()}, {@link Drawable#getLeftWidth()}, and {@link
  * Drawable#getRightWidth()}.
  *
  * @param background If null, the background will be cleared and all padding is removed.
  */
 public void setBackground(Drawable background) {
   if (this.background == background) return;
   this.background = background;
   if (background == null) pad(null);
   else {
     padBottom(background.getBottomHeight());
     padTop(background.getTopHeight());
     padLeft(background.getLeftWidth());
     padRight(background.getRightWidth());
     invalidate();
   }
 }
示例#5
0
  @Override
  public void setUpInterface(Table table) {
    // TODO: Move this to the skin.
    ScrollPane.ScrollPaneStyle style = new ScrollPane.ScrollPaneStyle();

    table.pad(20);

    Label header = new Label(game.getLocale().get("main.about"), game.getSkin(), "bold");
    table.add(header).expandX().align(Align.center).height(80).row();

    innerContainer = new Table();
    ScrollPane scroll = new ScrollPane(innerContainer, style);
    table.add(scroll).expand().fill().align(Align.top).row();
    innerContainer.defaults().fill().expand();

    screen = SCREEN_CREDITS;
    updateScrollPane();

    final TextButton changeButton =
        new TextButton(game.getLocale().get("about.license"), game.getSkin());
    changeButton.addListener(
        new ChangeListener() {
          @Override
          public void changed(ChangeEvent event, Actor actor) {
            if (screen == SCREEN_CREDITS) {
              screen = SCREEN_LICENSE;
              changeButton.setText(game.getLocale().get("about.credits"));
              updateScrollPane();
            } else {
              screen = SCREEN_CREDITS;
              changeButton.setText(game.getLocale().get("about.license"));
              updateScrollPane();
            }
            game.player.playSound(SoundPlayer.SoundCode.SELECT);
            event.cancel();
          }
        });

    Table buttonRow = new Table();
    buttonRow.defaults().fill().expand().width(Value.maxWidth).space(10);
    buttonRow.add(changeButton);

    TextButton backButton = new TextButton(game.getLocale().get("core.back"), game.getSkin());
    buttonRow.add(backButton).row();
    backButton.addListener(new ScreenPopper(game));

    table.add(buttonRow).expandX().fillX().height(60).padTop(20).align(Align.bottom).row();
  }
示例#6
0
  public AlertDialog(String titleText, Style style) {
    this.style = style;
    //        debug();

    setFillParent(true);
    setVisible(false);

    window = new Table();
    //        window.debug();
    window.setBackground(style.background);
    window.pad(style.vPad, style.hPad, style.vPad, style.hPad);

    // title
    title = new Label(titleText, style.title);
    window.add(title);
    window.row();

    add(window);
    row();

    actionsGroup = new DialogActionsGroup(style.actionsGroup);
    add(actionsGroup).center();
  }
    void layout() {
      root.defaults().space(6);
      root.columnDefaults(0).top().right().padTop(3);
      root.columnDefaults(1).left();
      root.add("Scale:");
      {
        Table table = table();
        table.add(scaleLabel).width(29);
        table.add(scaleSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Flip:");
      root.add(table(flipXCheckbox, flipYCheckbox)).row();
      root.add("Debug:");
      root.add(table(debugBonesCheckbox, debugRegionsCheckbox, debugBoundingBoxesCheckbox)).row();
      root.add();
      root.add(table(debugMeshHullCheckbox, debugMeshTrianglesCheckbox, debugPathsCheckbox)).row();
      root.add("Atlas alpha:");
      root.add(premultipliedCheckbox).row();

      root.add(new Image(skin.newDrawable("white", new Color(0x4e4e4eff))))
          .height(1)
          .fillX()
          .colspan(2)
          .pad(-3, 0, 1, 0)
          .row();

      root.add("Setup pose:");
      root.add(table(bonesSetupPoseButton, slotsSetupPoseButton, setupPoseButton)).row();
      root.add("Skin:");
      root.add(skinScroll).expand().fill().row();

      root.add(new Image(skin.newDrawable("white", new Color(0x4e4e4eff))))
          .height(1)
          .fillX()
          .colspan(2)
          .pad(1, 0, 1, 0)
          .row();

      root.add("Track:");
      {
        Table table = table();
        for (TextButton button : trackButtons.getButtons()) table.add(button);
        table.add(loopCheckbox);
        root.add(table).row();
      }
      root.add("Entry alpha:");
      {
        Table table = table();
        table.add(alphaLabel).width(29);
        table.add(alphaSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Animation:");
      root.add(animationScroll).expand().fill().row();
      root.add("Default mix:");
      {
        Table table = table();
        table.add(mixLabel).width(29);
        table.add(mixSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Speed:");
      {
        Table table = table();
        table.add(speedLabel).width(29);
        table.add(speedSlider).fillX().expandX();
        root.add(table).fill().row();
      }

      window.add(root).expand().fill();
      window.pack();
      stage.addActor(window);

      stage.addActor(statusLabel);

      {
        Table table = new Table();
        table.setFillParent(true);
        table.setTouchable(Touchable.disabled);
        stage.addActor(table);
        table.pad(10, 10, 22, 10).bottom().right();
        table.add(toasts);
      }

      {
        Table table = new Table();
        table.setFillParent(true);
        table.setTouchable(Touchable.disabled);
        stage.addActor(table);
        table.pad(10).top().right();
        table.defaults().right();
        table.add(new Label("", skin, "default", Color.LIGHT_GRAY)); // Version.
      }
    }
	private void fillTable() {
		StyleHelper helper = StyleHelper.getInstance();

		Table leftTable = new Table();
		ImageButton menu = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-menu"));
		ImageButton hint = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-hint"));
		zoomIn = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-plus"));
		zoomOut = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-minus"));
		Button goal = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-goal"));
		ImageButton startSimulation = new ImageButton(StyleHelper.getInstance()
				.getImageButtonStyleRound("widgets/icon-next"));
		startSimulation.addListener(new StartSimulationListener());

		// add listeners
		menu.addListener(new MenuClickListener());
		hint.addListener(new HintClickListener());

		leftTable.pad(30);
		leftTable.defaults().space(30);
		leftTable.add(menu).size(100).top().left();
		leftTable.row();
		// TODO only activated after some time
		leftTable.add(hint).expand().size(100).top().left();
		leftTable.row();
		leftTable.add(goal).expand().size(100).top().left();
		leftTable.row();

		leftTable.add(zoomIn).size(70).left();
		leftTable.row();
		leftTable.add(zoomOut).size(70).left();

		final ColorController colorController = gameController
				.getColorController();

		final ActorLayoutConfiguration config = new ActorLayoutConfiguration();
		config.setColorController(colorController);
		boardActor = new BoardActor(gameController.getShownBoard(), config);
		boardActor.setColorBlindEnabled(game.getSettingController()
				.getCurrentSetting().isColorblindEnabled());

		game.getSettingController().addSettingChangeListener(boardActor);
		// used to make resetting the board via game controller possible
		gameController.registerPlacementBoardEventListener(boardActor
				.getBoardEventListener());
		final Table boardTable = new Table();
		boardTable.add(boardActor).fill().expand();

		final Table controlTable = new Table();
		controlTable.add(leftTable).expand().fill();

		if (gameController.getLevel().getShowObjectBar()) {

			boardActor.enableLayoutEditing(
					gameController.getPlacmentBoardEventListener(), true);
			ObjectBar objectBar = boardActor.getObjectBar();
			objectBar.add(startSimulation).size(200);
			controlTable.add(objectBar).padLeft(30);

		} else {
			boardActor.enableLayoutEditing(
					gameController.getPlacmentBoardEventListener(), false);
			controlTable.add(startSimulation).bottom().right().size(200)
					.pad(30);
		}

		table.stack(boardTable, controlTable).fill().expand();
		onSettingChange(game.getSettingController().getCurrentSetting());

		BoardActor goalBoard = new BoardActor(gameController.getLevel()
				.getGoalBoard(), config);
		goalBoard.setZoomAndPanEnabled(false);
		goalBoard.setColorBlindEnabled(game.getSettingController()
				.getCurrentSetting().isColorblindEnabled());
		game.getSettingController().addSettingChangeListener(goalBoard);
		Table goalTable = new Table();
		goalTable.add(goalBoard).size(getViewportHeight());
		goal.addListener(new GoalClickListener());

		goalDialog.addListener(new ClickListener() {
			@Override
			public void clicked(InputEvent event, float x, float y) {
				goalDialog.hide();
			}
		});

		goalDialog.add(goalTable).width(getViewportWidth() - 250)
				.height(getViewportHeight());

	}
	private void fillTable() {
		StyleHelper helper = StyleHelper.getInstance();
		ImageButton back = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-back"));

		Table scrollTable = new Table();
		// ScrollPane scroll = new ScrollPane(scrollTable);

		Label gameplay = new Label(_("settings_title_gameplay"),
				helper.getLabelStyle(40));
		Label zoom = new Label(_("settings_title_zoom"), helper.getLabelStyle());
		Label colorBlindness = new Label(_("settings_title_color_blindness"),
				helper.getLabelStyle());
		Label sound = new Label(_("settings_title_sound"),
				helper.getLabelStyle(40));
		Label music = new Label(_("settings_title_music"),
				helper.getLabelStyle());
		Label effects = new Label(_("settings_title_effects"),
				helper.getLabelStyle());
		Label profile = new Label(_("settings_title_profile"),
				helper.getLabelStyle(40));

		zoomCheckBox = new CheckBox("", helper.getCheckBoxStyle());
		colorBlindnessCheckBox = new CheckBox("", helper.getCheckBoxStyle());

		musicSlider = new Slider(0, 100, 1, false, helper.getSliderStyle());
		effectsSlider = new Slider(0, 100, 1, false, helper.getSliderStyle());

		musicSlider.setValue(50);
		effectsSlider.setValue(50);

		TextButton editProfile = new TextButton(
				_("settings_button_edit_profile"), helper.getTextButtonStyle());

		// add listeners
		back.addListener(new LogicalPredecessorListener());

		SettingListener settingListener = new SettingListener();

		zoomCheckBox.addListener(settingListener);
		colorBlindnessCheckBox.addListener(settingListener);

		musicSlider.addListener(settingListener);
		effectsSlider.addListener(settingListener);

		editProfile.addListener(new ClickListener() {
			@Override
			public void clicked(InputEvent event, float x, float y) {
				if (game.getProfileController().getCurrentProfile() != null) {
					Dialog dialog = new EditProfileDialog();
					dialog.show(stage);
				} else {
					Dialog dialog = new NotificationDialog(
							_("warning_no_profile_selected"));
					dialog.show(stage);
				}

			}
		});

		scrollTable.defaults().left().space(10);
		scrollTable.add(gameplay).row();
		scrollTable.add(zoom).expandX().padLeft(30);
		scrollTable.add(zoomCheckBox).size(50).center().row();
		scrollTable.add(colorBlindness).expandX().padLeft(30);
		scrollTable.add(colorBlindnessCheckBox).size(50).center().row();
		scrollTable.add(sound).row();
		scrollTable.add(music).padLeft(30);
		scrollTable.add(musicSlider).width(300).height(50).row();
		scrollTable.add(effects).padLeft(30);
		scrollTable.add(effectsSlider).width(300).height(50).row();
		scrollTable.add(profile).row();
		scrollTable.add(editProfile).width(300).height(75);

		scrollTable.pad(50).padRight(150);
		table.add(back).size(100).top().left();
		table.add(scrollTable).expand().fill();
		table.pad(30);

		onProfileChange(null);
	}
示例#10
0
  @Override
  public void show() {
    super.show();

    // retrieve the custom skin for our 2D widgets
    Skin skin = super.getSkin();
    game.getMusicManager().play(UnsealedMusic.MENU);
    // create the table actor and add it to the stage
    table = super.getTable();
    table.setWidth(stage.getWidth());
    table.setHeight(stage.getHeight());
    table.pad(10).defaults().spaceBottom(10).space(5);
    table.row().fill().expandX();
    AtlasRegion splashRegion = getAtlas().findRegion("splash-screen/menulogo");
    Image logo = new Image(splashRegion);
    table.add(logo).colspan(3).fill(false);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    TextButton currentButton = new TextButton("Story Mode", skin);
    currentButton.setVisible(true);
    currentButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new ChapterSelectScreen(game));
          }
        });
    table.add(currentButton).colspan(3).size(300, 60).uniform().spaceBottom(10);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    currentButton = new TextButton("Battle Arena", skin);
    currentButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            if (Unsealed.DEBUG) game.setScreen(new BattleScreen(game, false, "TownOne"));
            else if (Gdx.app.getType() != ApplicationType.Android)
              game.setScreen(new QuickTutorialScreen(game));
            else game.setScreen(new BattleScreen(game, false, "TownOne"));
          }
        });
    table.add(currentButton).colspan(3).size(300, 60).uniform().spaceBottom(10);
    table.row();
    table.pad(10).defaults().spaceBottom(10);
    currentButton = new TextButton("Options", skin);
    currentButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new OptionsScreen(game));
          }
        });
    table.add(currentButton).uniform().spaceBottom(10);
    currentButton = new TextButton("Tutorial", skin);
    currentButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            if (Gdx.app.getType() == ApplicationType.Android)
              game.setScreen(new TutorialAndroidScreen(game));
            else game.setScreen(new TutorialDesktopScreen(game));
          }
        });
    table.add(currentButton).uniform().spaceBottom(10);
    currentButton = new TextButton("Credits", skin);
    currentButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new CreditsScreen(game));
          }
        });
    table.add(currentButton).uniform().spaceBottom(10);
    table.pad(10).defaults().spaceBottom(10);
  }