示例#1
0
  public LoadingStage() {
    initViewport();

    // Get our textureatlas from the manager, then get assets
    TextureAtlas atlas = Game.GDXVars().getTextureAtlas(Paths.loadingPack);
    font = Game.GDXVars().getFont(Paths.defaultFont);

    // Create actors
    background = new Image(Game.GDXVars().getTexture(Paths.splashBackground));
    background.setSize(getWidth(), getHeight());
    loadingBar = new LoadingBar(atlas);
    loadingBar.setPosition(getWidth() / 2 - loadingBar.getWidth() / 2, loadingBar.getHeight() / 2f);

    // Add actors
    addActor(background);
    addActor(loadingBar);

    // Selection group
    selector =
        new AtlasSelector(
            Game.GDXVars().getTextureAtlas(Paths.charactersPack), Game.Save().characters);
    addActor(selector);
    selector.setPosition(getWidth() / 2f - selector.getWidth() / 2f, 130);

    progress = 0f;

    // Start the work
    startLoadingWork();
  }
示例#2
0
  @Override
  public void act(float delta) {
    Game.GDXVars().assetManager.update();
    progress = Game.GDXVars().assetManager.getProgress();
    loadingBar.setProgress(progress);
    loadingBar.setMessage((progress == 1) ? "Tap to continue..." : "Loading textures ...");
    selector.setSelectable(Game.Save().characters);

    super.act(delta);
  }
示例#3
0
  @Override
  public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    if (!super.touchUp(screenX, screenY, pointer, button)) {
      if (Game.GDXVars().assetManager.update()) { // Load some, will return true if done loading
        if (Game.Save().characters[selector.getSelectedIndex()]) {
          Game.startSurvivorGame(selector.getSelectedIndex());
          return true;
        }
      }
    }

    return false;
  }
示例#4
0
  @Override
  public void draw() {
    // Draw actors
    super.draw();

    // Write title
    getBatch().begin();
    font.setScale(1f);
    font.draw(
        getBatch(),
        Game.TITLE,
        getWidth() / 2f - font.getBounds(Game.TITLE).width / 2f,
        getHeight() - 10f);
    font.setScale(0.5f);
    TextBounds bounds = font.getBounds("Highscore : " + Game.Save().highScore);
    font.draw(
        getBatch(), "Highscore : " + Game.Save().highScore, getWidth() - bounds.width, getHeight());
    getBatch().end();
  }
示例#5
0
 /** Start the work needed to be done */
 private void startLoadingWork() {
   Game.GDXVars().loadSurvivorStageAssets();
 }