local TextureManager = { }

function TextureManager:loadAtlas(prefabObject, atlasPath, callback)
	ResourceManager:loadOriginAssetAsync(atlasPath, GConst.TYPEOF_UNITY_CLASS.BF_ATLAS, function(assetPath, asset)
		if prefabObject:isDestroyed() then
			ResourceManager:unload(assetPath)
			return
		end

		callback(assetPath, asset)
	end)
end

function TextureManager:unloadAtlas(atlasPath)
	ResourceManager:unload(atlasPath)
end


function TextureManager:loadTextureAsync(prefabObject, texturePath, callback)
	ResourceManager:loadOriginAssetAsync(texturePath, GConst.TYPEOF_UNITY_CLASS.TEXTURE_2D, function(assetPath, texture)
		if prefabObject:isDestroyed() then
			ResourceManager:unload(assetPath)
			return
		end

		if callback then
			callback(assetPath, texture)
		end
	end)
end

function TextureManager:unLoadTexture(texturePath)
	ResourceManager:unload(texturePath)
end

return TextureManager