5
5
namespace AssetManagementBase
6
6
{
7
7
public delegate Stream AssetOpener ( string assetName ) ;
8
- public delegate T AssetLoader < T > ( AssetManager manager , string assetName , object settings ) ;
8
+ public delegate T AssetLoader < T > ( AssetManager manager , string assetName , IAssetSettings settings , object tag ) ;
9
9
10
10
public class AssetManager
11
11
{
@@ -43,15 +43,15 @@ internal AssetManager(AssetManagerCore core, string currentFolder)
43
43
public byte [ ] ReadAssetAsByteArray ( string assetName ) => _core . ReadAssetAsByteArray ( BuildFullPath ( assetName ) ) ;
44
44
45
45
46
- public bool HasAsset ( string assetName , object settings = null )
46
+ public bool HasAsset ( string assetName , IAssetSettings settings = null )
47
47
{
48
48
assetName = BuildFullPath ( assetName ) ;
49
49
var cacheKey = BuildCacheKey ( assetName , settings ) ;
50
50
51
51
return _core . Cache . ContainsKey ( cacheKey ) ;
52
52
}
53
53
54
- public T UseLoader < T > ( AssetLoader < T > loader , string assetName , object settings = null , bool storeInCache = true )
54
+ public T UseLoader < T > ( AssetLoader < T > loader , string assetName , IAssetSettings settings = null , object tag = null , bool storeInCache = true )
55
55
{
56
56
assetName = BuildFullPath ( assetName ) ;
57
57
var cacheKey = BuildCacheKey ( assetName , settings ) ;
@@ -74,7 +74,7 @@ public T UseLoader<T>(AssetLoader<T> loader, string assetName, object settings =
74
74
}
75
75
}
76
76
77
- var result = loader ( assetManager , assetName , settings ) ;
77
+ var result = loader ( assetManager , assetName , settings , tag ) ;
78
78
79
79
if ( storeInCache )
80
80
{
@@ -93,12 +93,12 @@ private string BuildFullPath(string assetName)
93
93
return assetName ;
94
94
}
95
95
96
- private static string BuildCacheKey ( string assetName , object settings )
96
+ private static string BuildCacheKey ( string assetName , IAssetSettings settings )
97
97
{
98
98
var cacheKey = assetName ;
99
99
if ( settings != null )
100
100
{
101
- cacheKey += "|" + settings . ToString ( ) ;
101
+ cacheKey += "|" + settings . BuildKey ( ) ;
102
102
103
103
}
104
104
0 commit comments