<commit_before>package com.draga.spaceTravels3.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.draga.spaceTravels3.Constants;
import com.draga.spaceTravels3.SpaceTravels3;
import com.draga.spaceTravels3.manager.ScreenManager;
import com.draga.spaceTravels3.manager.SettingsManager;
import com.draga.spaceTravels3.manager.UIManager;
import com.draga.spaceTravels3.manager.asset.AssMan;
import com.draga.spaceTravels3.ui.BeepingTextButton;
import com.draga.spaceTravels3.ui.Screen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

public class TutorialScreen extends Screen
{
    private final float                  labelsWidth;
    private final float                  imageSize;
    private final AssetManager           assMan;
    private       Stage                  stage;
    private       HashMap<String, Image> asyncImages;

    public TutorialScreen()
    {
        super(true, true);

        this.stage = new Stage(SpaceTravels3.menuViewport, SpaceTravels3.spriteBatch);

        this.labelsWidth = this.stage.getWidth() * 0.8f;
        this.imageSize = this.stage.getWidth() * 0.1f;

        this.assMan = new AssetManager();
        this.asyncImages = new HashMap<>();

        Table table = UIManager.addDefaultTableToStage(this.stage);

        // Header label.
        table.add("Tutorial", "large", Color.WHITE);
        table.row();

        // Tutorial slides.
        table
            .add(getTutorial())
            .expand()
            .center();
        table.row();

        // Back button.
        table.row();
        table.add(getBackTextButton());

        this.stage.setDebugAll(SettingsManager.getDebugSettings().debugDraw);
    }

    private Actor getTutorial()
    {
        Table table = UIManager.getDefaultTable();

        table.add(getMovementTutorial());
        table.row();
        table.add(getGoalTutorial());
        table.row();
        table.add(getElementsTutorial());

        ScrollPane scrollPane = new ScrollPane(table, UIManager.skin);
        scrollPane.setFadeScrollBars(false);
        scrollPane.setScrollingDisabled(true, false);

        return scrollPane;
    }

    private TextButton getBackTextButton()
    {
        TextButton backTextButton = new BeepingTextButton("Back", UIManager.skin);
        backTextButton.addListener(new ClickListener()
        {
            @Override
            public void clicked(InputEvent event, float x, float y)
            {
                ScreenManager.removeScreen(TutorialScreen.this);
            }
        });

        return backTextButton;
    }

    private Actor getMovementTutorial()
    {
        Table table = new Table(UIManager.skin);

        table.add("Movement", "large", Color.WHITE);
        table.row();

        String movementText =
            "There are 2 ways of moving you ship, this can be changed in the settings.\r\n"
                + "Using the accelerometer you should keep your device face up and tilt it "
                + "slightly where you want to go.\r\n"
                + "When using the touch screen 2 dashed circles will appear on the screen, touch "
                + "within them to move the ship in that direction. The further away you touch from "
                + "the ship the greater thrust you will give it (and fuel you'll consume).\r\n"
                + "Being in space nothing but the planets gravity will slow you down! Use the "
                + "inertia of the ship and the gravity of the planets in your favor.";

        Label movementLabel = new Label(movementText, UIManager.skin);
        table
            .add(movementLabel)
            .width(this.labelsWidth);
        movementLabel.setWrap(true);

        return table;
    }

    private Actor getGoalTutorial()
    {
        Table table = new Table(UIManager.skin);

        table.add("Goal", "large", Color.WHITE);
        table.row();

        String goalText =
            "The goal is to land safely on the destination planet. This will be shown in blue in "
                + "the minimap, will have an overlay to indicate how fast are you going and the "
                + "trajectory line will appear blue.";
        Label goalLabel = new Label(goalText, UIManager.skin);
        goalLabel.setWrap(true);
        table
            .add(goalLabel)
            .width(this.labelsWidth);

        return table;
    }

    private Actor getElementsTutorial()
    {
        Table table = new Table();

        table.add(new Label("Elements", UIManager.skin, "large", Color.WHITE));<commit_msg>tutorial rewording<commit_after>package com.draga.spaceTravels3.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.draga.spaceTravels3.Constants;
import com.draga.spaceTravels3.SpaceTravels3;
import com.draga.spaceTravels3.manager.ScreenManager;
import com.draga.spaceTravels3.manager.SettingsManager;
import com.draga.spaceTravels3.manager.UIManager;
import com.draga.spaceTravels3.manager.asset.AssMan;
import com.draga.spaceTravels3.ui.BeepingTextButton;
import com.draga.spaceTravels3.ui.Screen;

import java.util.ArrayList;
import java.util.HashMap;

public class TutorialScreen extends Screen
{
    private final float                  labelsWidth;
    private final float                  imageSize;
    private final AssetManager           assMan;
    private       Stage                  stage;
    private       HashMap<String, Image> asyncImages;

    public TutorialScreen()
    {
        super(true, true);

        this.stage = new Stage(SpaceTravels3.menuViewport, SpaceTravels3.spriteBatch);

        this.labelsWidth = this.stage.getWidth() * 0.8f;
        this.imageSize = this.stage.getWidth() * 0.1f;

        this.assMan = new AssetManager();
        this.asyncImages = new HashMap<>();

        Table table = UIManager.addDefaultTableToStage(this.stage);

        // Header label.
        table.add("Tutorial", "large", Color.WHITE);
        table.row();

        // Tutorial slides.
        table
            .add(getTutorial())
            .expand()
            .center();
        table.row();

        // Back button.
        table.row();
        table.add(getBackTextButton());

        this.stage.setDebugAll(SettingsManager.getDebugSettings().debugDraw);
    }

    private Actor getTutorial()
    {
        Table table = UIManager.getDefaultTable();

        table.add(getMovementTutorial());
        table.row();
        table.add(getGoalTutorial());
        table.row();
        table.add(getElementsTutorial());

        ScrollPane scrollPane = new ScrollPane(table, UIManager.skin);
        scrollPane.setFadeScrollBars(false);
        scrollPane.setScrollingDisabled(true, false);

        return scrollPane;
    }

    private TextButton getBackTextButton()
    {
        TextButton backTextButton = new BeepingTextButton("Back", UIManager.skin);
        backTextButton.addListener(new ClickListener()
        {
            @Override
            public void clicked(InputEvent event, float x, float y)
            {
                ScreenManager.removeScreen(TutorialScreen.this);
            }
        });

        return backTextButton;
    }

    private Actor getMovementTutorial()
    {
        Table table = new Table(UIManager.skin);

        table.add("Movement", "large", Color.WHITE);
        table.row();

        String movementText =
            "There are 2 ways of moving your spaceship, these can be changed in the settings.\r\n"
                + "Using the accelerometer you should keep your device facing up and tilt it "
                + "slightly where you want to go.\r\n"
                + "When using the touch screen 2 dashed circles will appear on the screen, touch "
                + "within them to move the spaceship in that direction. The further away you touch from "
                + "the Spaceship the greater the thrust produced (and fuel consumed).\r\n"
                + "Being in space nothing but the planets' gravity will slow you down! Use the "
                + "inertia of the spaceship and the gravity of the planets in your favor.";

        Label movementLabel = new Label(movementText, UIManager.skin);
        table
            .add(movementLabel)
            .width(this.labelsWidth);
        movementLabel.setWrap(true);

        return table;
    }

    private Actor getGoalTutorial()
    {
        Table table = new Table(UIManager.skin);

        table.add("Goal", "large", Color.WHITE);
        table.row();

        String goalText =
            "The goal is to land safely on the destination planet. This will be shown in blue in "
                + "the minimap and will have an overlay to indicate how fast are you going .The "
                + "trajectory line colliding with it will appear blue.";
        Label goalLabel = new Label(goalText, UIManager.skin);
        goalLabel.setWrap(true);
        table
            .add(goalLabel)
            .width(this.labelsWidth);

        return table;
    }

    private Actor getElementsTutorial()
    {
        Table table = new Table();

        table.add(new Label("Elements", UIManager.skin, "large", Color.WHITE));
{'fraction_non_alphanumeric': 0.09633930328675458, 'fraction_numerical': 0.00492029128124385, 'mean_word_length': 2.4046901172529314, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6645074', 'n_tokens_mistral': 2989, 'n_tokens_neox': 2852, 'n_words': 710}