package _texture.loader;

import javax.swing.JOptionPane;

import fileIO.textures.worldgen.BoulderTextures;
import fileIO.textures.worldgen.DebrisTextures;
import fileIO.textures.worldgen.FlowerTextures;
import fileIO.textures.worldgen.SaplingTextures;
import fileIO.textures.worldgen.TallGrassTextures;
import fileIO.textures.worldgen.TileTextures;
import fileIO.textures.worldgen.TreeTextures;
import items.DroppedItemIconTextures;
import items.ItemIconTextures;
import textures.hud.HUDTextures;
import textures.hud.SecondaryHUDTextures;
import textures.hud.constructionmenu.BaseConstructionMenu;
import textures.menu.MenuButtonTextures;
import textures.menu.MenuSplashSheetTextures;
import textures.mobs.goblin.GoblinTextures;
import textures.mobs.rabbit.RabbitDeathTextures;
import textures.mobs.rabbit.RabbitIdleEatGroundTextures;
import textures.mobs.rabbit.RabbitIdleWalkTextures;
import textures.mobs.rabbit.RabbitRunAwayTextures;
import textures.mobs.rabbit.RabbitSleepTextures;
import textures.player.BasePlayerGetHitAndDeath;
import textures.player.PlayerAxeChopTextures;
import textures.player.PlayerIdleTextures;
import textures.player.PlayerMineTextures;
import textures.player.PlayerWalkTextures;
import textures.player.attacks.BasePlayerAttackTextures;
import textures.player.attacks.CrudeAxeAttackTextures;
import textures.player.attacks.CrudePickAxeAttackTextures;
import textures.player.items.crudeaxe.CrudeAxeChopTextures;
import textures.player.items.crudeaxe.CrudeAxeGetHitTextures;
import textures.player.items.crudeaxe.CrudeAxeIdleTextures;
import textures.player.items.crudeaxe.CrudeAxeWalkTextures;
import textures.player.items.crudepickaxe.CrudePickAxeGetHitTextures;
import textures.player.items.crudepickaxe.CrudePickaxeIdleTextures;
import textures.player.items.crudepickaxe.CrudePickaxeMineTextures;
import textures.player.items.crudepickaxe.CrudePickaxeWalkTextures;
import textures.player.items.goblinspear.GoblinSpearTextures;
import textures.player.items.torch.TorchGetHitTextures;
import textures.player.items.torch.TorchIdleTextures;
import textures.player.items.torch.TorchWalkTextures;
import textures.settings.SettingsTextures;
import textures.structures.StructuresTextures;
import utils.Utils;

/*  ------------- Nihilne ------------
    * Created by Mitch Weaver - 2016 *
      ~~~~ All Rights Reserved ~~~~ */

public final class TextureLoader {
	
	public static void initSplashSheet() {
		MenuSplashSheetTextures.getTextures(Utils.loadImage("/splashsheet.nihil"));
	}

	public static void init() {
		final long then = System.nanoTime();
		
		try{
		//textures.mobs.rabbit
		RabbitIdleWalkTextures.getTextures(Utils.loadImage("/rabbitsheet.nihil"));
		RabbitIdleEatGroundTextures.getTextures(Utils.loadImage("/rabbitsheet.nihil"));
		RabbitRunAwayTextures.getTextures(Utils.loadImage("/rabbitsheet.nihil"));
		RabbitSleepTextures.getTextures(Utils.loadImage("/rabbitsheet.nihil"));
		RabbitDeathTextures.getTextures(Utils.loadImage("/rabbitsheet.nihil"));
		
		// textures.mobs.goblin
		GoblinTextures.getTextures(Utils.loadImage("/goblinsheet.nihil"));
			
		// textures.structures
		StructuresTextures.getTextures(Utils.loadImage("/structuresheet.nihil"));
		
		// textures.worldgen
		BoulderTextures.getTextures(Utils.loadImage("/bouldersheet.nihil"));
		DebrisTextures.getTextures(Utils.loadImage("/debrissheet.nihil"));
		FlowerTextures.getTextures(Utils.loadImage("/flowersheet.nihil"));
		TallGrassTextures.getTextures(Utils.loadImage("/grasssheet.nihil"));
		TreeTextures.getTextures(Utils.loadImage("/treesheet.nihil"));
		SaplingTextures.getTextures(Utils.loadImage("/saplingsheet.nihil"));
		
		// Tiles
		TileTextures.getTextures(Utils.loadImage("/tilesheet.nihil"));
		TileTextures.getOceanTextures(Utils.loadImage("/oceantilesheet.nihil"));
		
		// textures.hud
		HUDTextures.getTextures(Utils.loadImage("/HUDsheet.nihil"));
		SecondaryHUDTextures.getTextures(Utils.loadImage("/secondaryhudsheet.nihil"));
		BaseConstructionMenu.getTextures(Utils.loadImage("/constructionsheet.nihil"));
		
		// textures.items
		ItemIconTextures.getTextures(Utils.loadImage("/itemiconsheet.nihil"));
		DroppedItemIconTextures.getTextures();
		
		// textures.player
		PlayerIdleTextures.getTextures(Utils.loadImage("/playersheet.nihil"));
		PlayerWalkTextures.getTextures(Utils.loadImage("/playersheet.nihil"));
		PlayerAxeChopTextures.getTextures(Utils.loadImage("/playeraxesheet.nihil"));
		PlayerMineTextures.getTextures(Utils.loadImage("/playerminesheet.nihil"));
		BasePlayerGetHitAndDeath.getTextures(Utils.loadImage("/playerdeathsheet.nihil"));
		
		// textures.player.attacks
		BasePlayerAttackTextures.getTextures(Utils.loadImage("/baseplayerattacksheet.nihil"));
		CrudeAxeAttackTextures.getTextures(Utils.loadImage("/crudeaxeattacksheet.nihil"));
		CrudePickAxeAttackTextures.getTextures(Utils.loadImage("/crudepickaxeattacksheet.nihil"));
		
		// textures.player.items.crudeaxe
		CrudeAxeIdleTextures.getTextures(Utils.loadImage("/crudeaxesheet.nihil"));
		CrudeAxeWalkTextures.getTextures(Utils.loadImage("/crudeaxesheet.nihil"));
		CrudeAxeChopTextures.getTextures(Utils.loadImage("/crudeaxechopsheet.nihil"));
		CrudeAxeGetHitTextures.getTextures(Utils.loadImage("/crudeaxegethitsheet.nihil"));
		
		// textures.player.items.crudepickaxe
		CrudePickaxeIdleTextures.getTextures(Utils.loadImage("/crudepickaxesheet.nihil"));
		CrudePickaxeWalkTextures.getTextures(Utils.loadImage("/crudepickaxesheet.nihil"));
		CrudePickaxeMineTextures.getTextures(Utils.loadImage("/crudepickaxeminesheet.nihil"));
		CrudePickAxeGetHitTextures.getTextures(Utils.loadImage("/crudepickaxegethitsheet.nihil"));
		
		// textures.player.items.torch
		TorchIdleTextures.getTextures(Utils.loadImage("/torchwalkidlesheet.nihil"));
		TorchWalkTextures.getTextures(Utils.loadImage("/torchwalkidlesheet.nihil"));
		TorchGetHitTextures.getTextures(Utils.loadImage("/torchgethitsheet.nihil"));
		
		// textures.player.items.goblinspear
		GoblinSpearTextures.getIdlesWalksTextures(Utils.loadImage("/goblinspearsheet.nihil"));
		GoblinSpearTextures.getAttackTextures(Utils.loadImage("/goblinspearattacksheet.nihil"));
		GoblinSpearTextures.getHitsTextures(Utils.loadImage("/goblinspeargethitsheet.nihil"));
		
		
		// textures.settings
		SettingsTextures.getTextures(Utils.loadImage("/settingsbuttonsheet.nihil"));
		
		// textures.menu
		MenuButtonTextures.getTextures(Utils.loadImage("/menubuttonsheet.nihil"));
		MenuSplashSheetTextures.getTextures(Utils.loadImage("/splashsheet.nihil"));
		} catch (Exception e) {
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "Failed to load game textures. Yell at the developer."); System.exit(1);
		}
		
		System.out.println("Textures loaded. Time Taken: " + Utils.df.format((System.nanoTime() - then) / Utils.second) + " seconds");
	}
}
