コード例 #1
0
	/**
	 * Creates the screen of a level within the placement mode. This is the
	 * screen which is presented to the user upon entering a recoloring or
	 * termedit level.
	 * 
	 * @param game
	 *            the backreference to the central game
	 * @param controller
	 *            the game controller, which is responsible for the played level
	 */
	public PlacementModeScreen(AlligatorApp game, GameController controller) {
		super(game);
		gameController = controller;

		AssetManager assetManager = AssetManager.getInstance();
		assetManager.load(getAssetDirPath() + "textures/pack.atlas",
				TextureAtlas.class);
		goalDialog = new Dialog("", StyleHelper.getInstance().getDialogStyle());

		fillTable();
		final int packageIndex = gameController.getLevel().getPackageIndex();
		final LevelPackagesController packagesController = game
				.getLevelPackagesController();
		final LevelPackage pack = packagesController.getLevelPackages().get(
				packageIndex);
		setBackground(pack.getDesign());
		game.getSettingController().addSettingChangeListener(this);

		// load graphics for animation/tutorial
		if (gameController.getLevel().hasAnimation()) {
			List<String> animations = gameController.getLevel().getAnimation();
			for (String animation : animations) {
				assetManager.load(animation, Texture.class);
			}
		}
	}
コード例 #2
0
	private void buildTutorialDialog(String animationPath) {
		AssetManager manager = AssetManager.getInstance();
		StyleHelper helper = StyleHelper.getInstance();

		final Dialog tutorial = new Dialog("", StyleHelper.getInstance()
				.getDialogStyle());
		tutorial.clear();
		tutorial.fadeDuration = 0f;

		Table buttonTable = new Table();
		Drawable drawable = new TextureRegionDrawable(new TextureRegion(
				manager.get(animationPath, Texture.class)));
		// used image button here because it keeps the ratio of the texture
		ImageButton tutorialImage = new ImageButton(drawable);
		ImageButton okay = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-check"));

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

		buttonTable.add(okay).size(100).bottom().right().expand().pad(30);
		tutorial.stack(tutorialImage, buttonTable).height(500).width(800);
		tutorial.show(stage);
	}
コード例 #3
0
 @Override
 public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch, float parentAlpha) {
   if (de.croggle.AlligatorApp.DEBUG) {
     batch.draw(
         de.croggle.data.AssetManager.getInstance()
             .getColorTexture(de.croggle.game.Color.uncolored()),
         getX(),
         getY(),
         getWidth() * getScaleX(),
         getHeight() * getScaleY());
   }
 }
コード例 #4
0
    public ColorButton(Color c) {
      this.c = c;
      AssetManager assets = AssetManager.getInstance();
      Drawable up;
      if (colorBlindEnabled) {
        up = new TextureRegionDrawable(new TextureRegion(assets.getPatternTexture(c)));
      } else {
        up = new TextureRegionDrawable(new TextureRegion(assets.getColorTexture(c)));
      }

      this.setStyle(new Button.ButtonStyle(up, up, up));
    }
コード例 #5
0
 /**
  * Returns the asset manager which controls all kinds of game media, e.g. graphics.
  *
  * @return the asset manager
  */
 public AssetManager getAssetManager() {
   return de.croggle.data.AssetManager.getInstance();
 }