Permalink
Browse files

SkinManager.a2s()

  • Loading branch information...
1 parent e2d6179 commit e12153c1bc7cb47533edbff86255342a83e28528 @vancura vancura committed Jan 18, 2011
Showing with 29 additions and 0 deletions.
  1. +29 −0 src/com/falanxia/moderatrix/globals/SkinManager.as
@@ -25,6 +25,8 @@
package com.falanxia.moderatrix.globals {
import com.falanxia.emitor.Asset;
+ import com.falanxia.emitor.AssetCollection;
+ import com.falanxia.emitor.AssetManager;
import com.falanxia.moderatrix.enums.SkinType;
import com.falanxia.moderatrix.interfaces.ISkin;
import com.falanxia.moderatrix.skin.AtlasSkin;
@@ -56,6 +58,9 @@ package com.falanxia.moderatrix.globals {
private static var instance:SkinManager;
+ private var assetManager:AssetManager;
+ private var defaultCollection:AssetCollection;
+
/**
@@ -155,6 +160,30 @@ package com.falanxia.moderatrix.globals {
return isSupported ? skin : null;
}
+
+
+
+ /**
+ * Get asset from the asset collection.
+ * If no asset collection ID is provided, default one is used instead.
+ * @param assetID Asset ID
+ * @param collectionID (optional) Asset collection ID
+ * @return Skin
+ * @see ISkin
+ */
+ public function a2s(assetID:String, collectionID:String = null):ISkin {
+ if(assetManager == null) {
+ assetManager = AssetManager.getInstance();
+ }
+
+ if(defaultCollection == null) {
+ defaultCollection = assetManager.getCollection();
+ }
+
+ var collection:AssetCollection = (collectionID == null) ? defaultCollection : assetManager.getCollection(collectionID);
+
+ return (collection == null) ? null : assetToSkin(collection.getAsset(assetID));
+ }
}
}

0 comments on commit e12153c

Please sign in to comment.