package eu.jonahbauer.wizard.client.libgdx.actors.game.overlay;

import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import eu.jonahbauer.wizard.client.libgdx.screens.GameScreen;

import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
import static eu.jonahbauer.wizard.client.libgdx.actions.MyActions.*;

public class StartRoundOverlay extends Overlay {

    private final int round;

    public StartRoundOverlay(GameScreen gameScreen, int round) {
        super(gameScreen);
        this.round = round;
    }

    @Override
    public Actor createContent() {
        var root = new VerticalGroup().columnCenter().space(10f);

        var label = new Label("Round " + (round + 1), data.skin, "enchanted");
        label.setFontScale(1.5f);
        root.addActor(label);

        return root;
    }

    @Override
    public void show(Stage stage) {
        var root = getRoot();
        stage.addActor(root);
        stage.addAction(sequence(
                delay(2.0f),
                target(alpha(0.0f, .1f, Interpolation.pow2Out), root),
                removeActor(root)
        ));
    }
}
