Пример #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 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;
  }
Пример #3
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);
  }