package com.uoc.educationalVG.utils;

import com.uoc.educationalVG.framework.Game;
import com.uoc.educationalVG.framework.Graphics;
import com.uoc.educationalVG.framework.Screen;
import com.uoc.educationalVG.framework.Graphics.PixmapFormat;
import com.uoc.educationalVG.memorycon.MainMenuScreen;

/**
 * Fetches the assets from disk
 * 
 * @author "Beginning Android 4 Games Development"
 * @author (adapted by Sergi Colina)
 *
 */
public class LoadingScreen extends Screen {
	public LoadingScreen(Game game) {
		super(game);
	}

	@Override
	public void update(float deltaTime) {
		Graphics g = game.getGraphics();

		Assets.setBackground(g.newPixmap("pics/background.png",
				PixmapFormat.ARGB4444));
		Assets.setButtons(g
				.newPixmap("pics/buttons.png", PixmapFormat.ARGB4444));
		Assets.setNumbers(g
				.newPixmap("pics/numbers.png", PixmapFormat.ARGB4444));
		Assets.setNumbers2(g.newPixmap("pics/numbers2.png",
				PixmapFormat.ARGB4444));
		Assets.setNumbersDigital(g.newPixmap("pics/numbersDigital.png",
				PixmapFormat.ARGB4444));
		Assets.setContinueButton(g.newPixmap("pics/continueButton.png",
				PixmapFormat.ARGB4444));
		Assets.setOk(g.newPixmap("pics/ok.png", PixmapFormat.ARGB4444));
		Assets.setOk110(g.newPixmap("pics/ok110.png", PixmapFormat.ARGB4444));
		Assets.setNotOk(g.newPixmap("pics/notOk.png", PixmapFormat.ARGB4444));
		Assets.setNotOk110(g.newPixmap("pics/notOk110.png",
				PixmapFormat.ARGB4444));
		Assets.setBonus110(g.newPixmap("pics/bonus110.png",
				PixmapFormat.ARGB4444));
		Assets.setPuntuacio(g.newPixmap("pics/puntuacio.png",
				PixmapFormat.ARGB4444));
		Assets.setTemps(g.newPixmap("pics/temps.png", PixmapFormat.ARGB4444));
		Assets.setBravo(g.newPixmap("pics/bravo.png", PixmapFormat.ARGB4444));

		Assets.setMainMenuScreen(g.newPixmap("pics/mainMenuScreen.jpg",
				PixmapFormat.RGB565));
		Assets.setHighScoresScreen(g.newPixmap("pics/highScoresScreen.png",
				PixmapFormat.ARGB4444));
		Assets.setIntroScreen(g.newPixmap("pics/introScreen.png",
				PixmapFormat.ARGB4444));
		Assets.setHowToScreen(g.newPixmap("pics/howToScreen.png",
				PixmapFormat.ARGB4444));

		Assets.setExercise01intro(g.newPixmap("pics/exercise01intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise01game(g.newPixmap("pics/exercise01game.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise02intro(g.newPixmap("pics/exercise02intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise02game(g.newPixmap("pics/exercise02game.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise03intro(g.newPixmap("pics/exercise03intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise03game(g.newPixmap("pics/exercise03game.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise04intro(g.newPixmap("pics/exercise04intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise04agame(g.newPixmap("pics/exercise04agame.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise04bgame(g.newPixmap("pics/exercise04bgame.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise04cgame(g.newPixmap("pics/exercise04cgame.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise05intro(g.newPixmap("pics/exercise05intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise05game(g.newPixmap("pics/exercise05game.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise06game0(g.newPixmap("pics/exercise06game0.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise06game1(g.newPixmap("pics/exercise06game1.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise07intro(g.newPixmap("pics/exercise07intro.png",
				PixmapFormat.ARGB4444));
		Assets.setExercise07game(g.newPixmap("pics/exercise07game.png",
				PixmapFormat.ARGB4444));
		Assets.setFinalScoreScreen(g.newPixmap("pics/finalScoreScreen.png",
				PixmapFormat.ARGB4444));

		Assets.setTreasure0Screen(g.newPixmap("pics/treasure0.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure200Screen(g.newPixmap("pics/treasure200.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure300Screen(g.newPixmap("pics/treasure300.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure400Screen(g.newPixmap("pics/treasure400.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure500Screen(g.newPixmap("pics/treasure500.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure600Screen(g.newPixmap("pics/treasure600.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure700Screen(g.newPixmap("pics/treasure700.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure800Screen(g.newPixmap("pics/treasure800.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure900Screen(g.newPixmap("pics/treasure900.jpg",
				PixmapFormat.ARGB4444));
		Assets.setTreasure1000Screen(g.newPixmap("pics/treasure1000.jpg",
				PixmapFormat.ARGB4444));

		Assets.setClick(game.getAudio().newSound("audio/click.ogg"));
		Assets.setOutOfBounds(game.getAudio().newSound("audio/outOfBounds.ogg"));
		Assets.setCorrect(game.getAudio().newSound("audio/correct.ogg"));
		Assets.setWrong(game.getAudio().newSound("audio/wrong.ogg"));
		Assets.setGameOver(game.getAudio().newSound("audio/gameOver.ogg"));
		Assets.setBonus(game.getAudio().newSound("audio/bonus.ogg"));
		Assets.setSplash(game.getAudio().newSound("audio/splash.ogg"));
		Assets.setHouse(game.getAudio().newSound("audio/house.ogg"));
		Assets.setStar(game.getAudio().newSound("audio/star.ogg"));

		Assets.setPirateSong(game.getAudio().newMusic("audio/pirateSong.ogg"));
		Assets.setExitmusic(game.getAudio().newMusic("audio/exitmusic.ogg"));
		Assets.setHesAPirate(game.getAudio().newMusic("audio/hesAPirate.ogg"));


		Settings.load(game.getFileIO());
		game.setScreen(new MainMenuScreen(game)); // our first screen!
	}

	@Override
	public void present(float deltaTime) {

	}

	@Override
	public void pause() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void dispose() {

	}
}