Newer
Older
exporter / Defs / GraphicDef.as
package Defs
{
	import flash.utils.getTimer;
	import flash.utils.getQualifiedClassName;
	import com.hurlant.util.der.ObjectIdentifier;
	
	import djarts.utils.SimpleTimer;
	
	public class GraphicDef
	{
		public var ID:int;
		public var Name:String = "";
		public var Folder:String = "";
		public var Version:int = 0;
		public var FileSize:int = 0;
		public var Type:int = 0;

		public var ExportParams:Object = {};
		
		public static const EXPORT_FORMAT_NONE = 0;
		public static const EXPORT_FORMAT_SPRITESHEET = 1;
		public static const EXPORT_FORMAT_CACHEDCLIP = 2;
		public static const EXPORT_FORMAT_SKELANIM = 3;
		public static const EXPORT_FORMAT_ANIMSETS = 4;
		public static const EXPORT_FORMAT_ANIMPIECES = 5;
		public static const EXPORT_FORMAT_SCENE = 6;
		
		// ============ Init ============ //
		
		public function GraphicDef(data=null)
		{
			if(data != null) ReadFromData(data);
		}
		
		public function ReadFromData(data)
		{

			if (data.hasOwnProperty("id")) ID = data['id'];
			if (data.hasOwnProperty("graphic_id")) Name = data['graphic_id'];
			if (data.hasOwnProperty("v")) Version = data['v'];
			if (data.hasOwnProperty("fs")) FileSize = data['fs'];
			if (data.hasOwnProperty("type")) Type = data['type'];

			if (data.hasOwnProperty("graphic"))
			{
				var graphic:String = data["graphic"];
				var index = graphic.lastIndexOf("/");
				if (index != -1)
				{
					Folder = graphic.substr(0, index+1);
					Name = graphic.substr(index+1);
				}
				else
				{
					Name = graphic;
				}
			}
			
			if (data.hasOwnProperty("export_params")) ExportParams = data['export_params'];
			
		}
		
		
	}
}