Began structuring new asset management system.
This commit is contained in:
parent
8f56b94c1f
commit
415f603bb4
8
RecrownedGTK/src/AssetsSystem/AssetLoader.cs
Normal file
8
RecrownedGTK/src/AssetsSystem/AssetLoader.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace RecrownedGTK.AssetsSystem {
|
||||||
|
public class AssetLoader {
|
||||||
|
public T Load<T>(string path) {
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
//TODO Implement a method of loading.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,10 +10,10 @@ namespace RecrownedGTK.AssetsSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AssetManager
|
public class AssetManager
|
||||||
{
|
{
|
||||||
|
private AssetLoader assetLoader;
|
||||||
Thread thread;
|
Thread thread;
|
||||||
readonly AssetManager contentManager;
|
|
||||||
readonly Queue<ContentData> queue;
|
readonly Queue<ContentData> queue;
|
||||||
Dictionary<string, Object> assets;
|
Dictionary<string, IDisposable> assets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path modifiers to change the path in which the content manager looks to load a file. Used for better organizing things while not needing to type entire path.
|
/// Path modifiers to change the path in which the content manager looks to load a file. Used for better organizing things while not needing to type entire path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -41,7 +41,7 @@ namespace RecrownedGTK.AssetsSystem
|
|||||||
/// <param name="contentManager">The manager to wrap.</param>
|
/// <param name="contentManager">The manager to wrap.</param>
|
||||||
public AssetManager()
|
public AssetManager()
|
||||||
{
|
{
|
||||||
assets = new Dictionary<string, Object>();
|
assets = new Dictionary<string, IDisposable>();
|
||||||
queue = new Queue<ContentData>();
|
queue = new Queue<ContentData>();
|
||||||
contentPathModifier = new Dictionary<Type, IAssetPathResolver>();
|
contentPathModifier = new Dictionary<Type, IAssetPathResolver>();
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ namespace RecrownedGTK.AssetsSystem
|
|||||||
}
|
}
|
||||||
path = handler.Modify(assetName);
|
path = handler.Modify(assetName);
|
||||||
}
|
}
|
||||||
assets.Add(assetName, contentManager.Load<Object>(path));
|
assets.Add(assetName, assetLoader.Load<IDisposable>(path));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,10 @@ namespace RecrownedGTK.AssetsSystem
|
|||||||
{
|
{
|
||||||
lock (queue)
|
lock (queue)
|
||||||
{
|
{
|
||||||
contentManager.Unload();
|
foreach (KeyValuePair<string, IDisposable> asset in assets)
|
||||||
|
{
|
||||||
|
asset.Value.Dispose();
|
||||||
|
}
|
||||||
assets.Clear();
|
assets.Clear();
|
||||||
ClearQueue();
|
ClearQueue();
|
||||||
Debug.WriteLine("Unloaded all assets.");
|
Debug.WriteLine("Unloaded all assets.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user