using Cryville.Crtr.Components;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace Cryville.Crtr {
	public static class GenericResources {
		public static Dictionary<string, Type> Components
			= new Dictionary<string, Type>();
		public static Dictionary<string, Shader> Shaders
			= new Dictionary<string, Shader>();
		public static Dictionary<string, Mesh> Meshes
			= new Dictionary<string, Mesh>();
		public static Dictionary<string, Material> Materials
			= new Dictionary<string, Material>();

		static bool loaded;

		public static void LoadDefault() {
			if (loaded) return;
			Components.Add("image", typeof(SpritePlane));
			Components.Add("polysec", typeof(PolygonSGO));
			Components.Add("rect", typeof(SpriteRect));
			Components.Add("scale3", typeof(SpriteScale3));
			Components.Add("sprite", typeof(SpriteBase));
			Components.Add("text", typeof(SpriteText));

			Meshes.Add("quad", Resources.Load<Mesh>("quad"));
			Meshes.Add("quad_scale3h", Resources.Load<Mesh>("quad_scale3h"));
			Meshes.Add("quad_scale9", Resources.Load<Mesh>("quad_scale9"));

			Materials.Add("-CutoutMat", Resources.Load<Material>("CutoutMat"));
			Materials.Add("-TransparentMat", Resources.Load<Material>("TransparentMat"));

			loaded = true;
		}
	}
}
