<commit_before>package de.sopa.scene.game;


import android.view.animation.Animation;

import org.andengine.engine.handler.timer.ITimerCallback;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.entity.sprite.ButtonSprite;

import de.sopa.model.game.Level;
import de.sopa.model.game.LevelResult;

/**
 * @author <NAME> - <EMAIL>
 * @author <NAME>
 */
public class LevelModeGameScene extends GameScene {
    private boolean leaveScene;

    public LevelModeGameScene(Object o) {
        super(o);
        leaveScene = false;
    }

    @Override
    protected void addButtons() {
        ButtonSprite restartButton = new ButtonSprite(camera.getWidth() - 300, (camera.getHeight() - 300), resourcesManager.restartRegion, vbom, new ButtonSprite.OnClickListener() {
            @Override
            public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                sceneService.loadGameSceneFromGameScene(levelBackup);
            }
        });
        restartButton.setWidth(300);
        restartButton.setHeight(300);
        registerTouchArea(restartButton);
        attachChild(restartButton);
    }

    @Override
    public void onBackKeyPressed() {
        if(!leaveScene) {
            sceneService.loadLevelChoiceSceneFromGameScene();
        }
    }

    public void onSolvedGame() {
        Level level = gameService.getLevel();
        final LevelResult levelResult = levelService.calculateLevelResult(level);
        levelService.persistLevelResult(levelResult);
        int nextLevelId = level.getId() + 1;
        levelService.unlockLevel(nextLevelId);
        this.leaveScene = true;
        engine.registerUpdateHandler(new TimerHandler(1.5f,new ITimerCallback() {
            @Override
            public void onTimePassed(TimerHandler pTimerHandler) {
                engine.unregisterUpdateHandler(pTimerHandler);
                sceneService.loadScoreScreen(levelResult);
            }
        }));

    }<commit_msg>remove restart button on solve game<commit_after>package de.sopa.scene.game;


import android.view.animation.Animation;

import org.andengine.engine.handler.timer.ITimerCallback;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.entity.sprite.ButtonSprite;

import de.sopa.model.game.Level;
import de.sopa.model.game.LevelResult;

/**
 * @author <NAME> - <EMAIL>
 * @author <NAME>
 */
public class LevelModeGameScene extends GameScene {
    private boolean leaveScene;
    private ButtonSprite restartButton;

    public LevelModeGameScene(Object o) {
        super(o);
        leaveScene = false;
    }

    @Override
    protected void addButtons() {
        restartButton = new ButtonSprite(camera.getWidth() - 300, (camera.getHeight() - 300), resourcesManager.restartRegion, vbom, new ButtonSprite.OnClickListener() {
            @Override
            public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                sceneService.loadGameSceneFromGameScene(levelBackup);
            }
        });
        restartButton.setWidth(300);
        restartButton.setHeight(300);
        registerTouchArea(restartButton);
        attachChild(restartButton);
    }

    @Override
    public void onBackKeyPressed() {
        if(!leaveScene) {
            sceneService.loadLevelChoiceSceneFromGameScene();
        }
    }

    public void onSolvedGame() {
        restartButton.setVisible(false);
        Level level = gameService.getLevel();
        final LevelResult levelResult = levelService.calculateLevelResult(level);
        levelService.persistLevelResult(levelResult);
        int nextLevelId = level.getId() + 1;
        levelService.unlockLevel(nextLevelId);
        this.leaveScene = true;
        engine.registerUpdateHandler(new TimerHandler(1.5f,new ITimerCallback() {
            @Override
            public void onTimePassed(TimerHandler pTimerHandler) {
                engine.unregisterUpdateHandler(pTimerHandler);
                sceneService.loadScoreScreen(levelResult);
            }
        }));

    }
{'fraction_non_alphanumeric': 0.09323271665043817, 'fraction_numerical': 0.007302823758519961, 'mean_word_length': 2.9282982791587, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5105549', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1114, 'n_words': 200}