package com.uoc.educationalVG.framework;

/**
 * We make it an abstract class instead of an interface so that we can implement
 * some bookkeeping. This way, we have to write less boilerplate code in the
 * actual implementations of the abstract Screen class.
 * 
 * @author "Beginning Android 4 Games Development"
 * @author (adapted by Sergi Colina)
 */

public abstract class Screen {

	protected final Game game;
	protected int oldScore, oldBonus, oldTime;
	protected String score, bonus, time;
	protected long timeIni, timeEnd, totalTime;

	/*
	 * Different bonus depending on screen difficulty
	 */
	public static final int BONUS01 = 60;
	public static final int BONUS02 = 70;
	public static final int BONUS03 = 100;
	public static final int BONUS04A = 120;
	public static final int BONUS04B = 150;
	public static final int BONUS04C = 175;
	public static final int BONUS05 = 75;
	public static final int BONUS06 = 50;
	public static final int BONUS07 = 100;

	public Screen(Game game) {

		this.game = game;
		this.bonus = "0";
		this.oldBonus = 0;
		this.time = "0";
	}

	/**
	 * Updates the screen state
	 * 
	 * @param deltaTime
	 */
	public abstract void update(float deltaTime);

	/**
	 * Presents the screen according to its state
	 * 
	 * @param deltaTime
	 */
	public abstract void present(float deltaTime);

	/**
	 * It will be called when the game is paused
	 */
	public abstract void pause();

	/**
	 * It will be called when the game is resumed
	 */
	public abstract void resume();

	/**
	 * Will be called by the Game instance in case Game.setScreen() is called.
	 * The Game instance will dispose of the current Screen via this method and
	 * thereby give the Screen an opportunity to release all its system
	 * resources (for example, graphical assets stored in Pixmaps) to make room
	 * for the new screen's resources in memory. The call to the
	 * Screen.dispose() method is also the last opportunity for a screen to make
	 * sure that any information that needs persistence is saved. Also: Once we
	 * no longer need the Music/Sound instance, we have to dispose of it. This
	 * will close any system resources, such as the file from which the audio
	 * was streamed.
	 */
	public abstract void dispose();
}
