<commit_before>package es.seastorm.merlin;

import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;

import java.util.Random;

import es.seastorm.merlin.assets.GameAssets;
import es.seastorm.merlin.screens.labyrint.LabyrintScreen;
import es.seastorm.merlin.screens.menu.MenuScreen;
import es.seastorm.merlin.screens.story.StoryScreen;

public class MerlinGame extends Game {
    private MenuScreen menuScreen = null;
    private LabyrintScreen labyrintScreen = null;

    public boolean music = true;
    public boolean sound = true;
    public static int[] maxLevel = {1, 1, 1, 1};

    public int currentPhase = -1;
    public int currentFirstLevel = -1;


    public MenuScreen getMenuScreen() {
        if (menuScreen == null) {
            menuScreen = new MenuScreen(this);
        }
        return menuScreen;
    }


    public LabyrintScreen getLabyrintScreen() {
        if (labyrintScreen == null) {
            labyrintScreen = new LabyrintScreen(this);
        }
        return labyrintScreen;
    }


    @Override
    public void create() {
        // Set Libgdx log level
        Gdx.app.setLogLevel(Application.LOG_DEBUG);

        // Load rest of assets
        GameAssets.instance.init(new AssetManager());


        this.music = getMusic();
        this.sound = getSound();

        // Start game at menu screen
        loadMenuScreen();
        setMaxLevel(3, 90);


    }


    public void loadMenuScreen() {
        //playScreen = null;
        setScreen(getMenuScreen());
    }

    public void loadStoryScreen() {
        setScreen(new StoryScreen(this));
    }

    public void loadLabyrintScreen(int section, int level) {
        System.out.println("loadLabyrintScreen " + section + " - " + level);
        getLabyrintScreen().level = level;
        getLabyrintScreen().section = section;
        setScreen(getLabyrintScreen());
    }

    public void setMaxLevel(int section, int newMaxLevel) {
        newMaxLevel = Math.min(newMaxLevel, Constants.LEVEL_LIST[section].length);
        if (maxLevel[section] < newMaxLevel) {
            maxLevel[section] = newMaxLevel;
            Preferences prefs = Gdx.app.getPreferences(Constants.PREFERENCES);
            prefs.putInteger("maxlevel_" + section, newMaxLevel);<commit_msg>Remove extra max levels<commit_after>package es.seastorm.merlin;

import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;

import java.util.Random;

import es.seastorm.merlin.assets.GameAssets;
import es.seastorm.merlin.screens.labyrint.LabyrintScreen;
import es.seastorm.merlin.screens.menu.MenuScreen;
import es.seastorm.merlin.screens.story.StoryScreen;

public class MerlinGame extends Game {
    private MenuScreen menuScreen = null;
    private LabyrintScreen labyrintScreen = null;

    public boolean music = true;
    public boolean sound = true;
    public static int[] maxLevel = {1, 1, 1, 1};

    public int currentPhase = -1;
    public int currentFirstLevel = -1;


    public MenuScreen getMenuScreen() {
        if (menuScreen == null) {
            menuScreen = new MenuScreen(this);
        }
        return menuScreen;
    }


    public LabyrintScreen getLabyrintScreen() {
        if (labyrintScreen == null) {
            labyrintScreen = new LabyrintScreen(this);
        }
        return labyrintScreen;
    }


    @Override
    public void create() {
        // Set Libgdx log level
        Gdx.app.setLogLevel(Application.LOG_DEBUG);

        // Load rest of assets
        GameAssets.instance.init(new AssetManager());


        this.music = getMusic();
        this.sound = getSound();

        // Start game at menu screen
        loadMenuScreen();
        //setMaxLevel(3, 90);


    }


    public void loadMenuScreen() {
        //playScreen = null;
        setScreen(getMenuScreen());
    }

    public void loadStoryScreen() {
        setScreen(new StoryScreen(this));
    }

    public void loadLabyrintScreen(int section, int level) {
        System.out.println("loadLabyrintScreen " + section + " - " + level);
        getLabyrintScreen().level = level;
        getLabyrintScreen().section = section;
        setScreen(getLabyrintScreen());
    }

    public void setMaxLevel(int section, int newMaxLevel) {
        newMaxLevel = Math.min(newMaxLevel, Constants.LEVEL_LIST[section].length);
        if (maxLevel[section] < newMaxLevel) {
            maxLevel[section] = newMaxLevel;
            Preferences prefs = Gdx.app.getPreferences(Constants.PREFERENCES);
            prefs.putInteger("maxlevel_" + section, newMaxLevel);
{'fraction_non_alphanumeric': 0.10181368507831821, 'fraction_numerical': 0.003709810387469085, 'mean_word_length': 2.8092621664050235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5990387', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1428, 'n_words': 312}