refactored.
This commit is contained in:
parent
ea8f96d877
commit
019b955577
@ -2,13 +2,13 @@
|
||||
|
||||
namespace RecrownedAthenaeum.ContentSystem
|
||||
{
|
||||
struct LoadableContent
|
||||
struct ContentData
|
||||
{
|
||||
internal Type type;
|
||||
internal string assetName;
|
||||
internal bool usePathModifier;
|
||||
|
||||
public LoadableContent(string assetName, Type type, bool usePathModifier)
|
||||
public ContentData(string assetName, Type type, bool usePathModifier)
|
||||
{
|
||||
this.type = type;
|
||||
this.assetName = assetName;
|
@ -13,7 +13,7 @@ namespace RecrownedAthenaeum.ContentSystem
|
||||
{
|
||||
Thread thread;
|
||||
readonly ContentManager contentManager;
|
||||
readonly Queue<LoadableContent> queue;
|
||||
readonly Queue<ContentData> queue;
|
||||
Dictionary<string, IDisposable> assets;
|
||||
/// <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.
|
||||
@ -40,7 +40,7 @@ namespace RecrownedAthenaeum.ContentSystem
|
||||
{
|
||||
this.contentManager = contentManager;
|
||||
assets = new Dictionary<string, IDisposable>();
|
||||
queue = new Queue<LoadableContent>();
|
||||
queue = new Queue<ContentData>();
|
||||
contentPathModifier = new Dictionary<Type, IContentPathModifier>();
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace RecrownedAthenaeum.ContentSystem
|
||||
{
|
||||
if (!assets.ContainsKey(assetName))
|
||||
{
|
||||
queue.Enqueue(new LoadableContent(assetName, typeof(T), usePathModifier));
|
||||
queue.Enqueue(new ContentData(assetName, typeof(T), usePathModifier));
|
||||
Debug.WriteLine("Queued asset: " + assetName);
|
||||
}
|
||||
else
|
||||
@ -115,7 +115,7 @@ namespace RecrownedAthenaeum.ContentSystem
|
||||
{
|
||||
lock (queue)
|
||||
{
|
||||
LoadableContent content = queue.Dequeue();
|
||||
ContentData content = queue.Dequeue();
|
||||
Load(content.assetName, content.type, content.usePathModifier);
|
||||
tasksCompleted++;
|
||||
progress = (float)tasksCompleted / totalTasks;
|
||||
|
@ -52,7 +52,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Camera\Camera2D.cs" />
|
||||
<Compile Include="ContentSystem\ContentLoad.cs" />
|
||||
<Compile Include="ContentSystem\ContentData.cs" />
|
||||
<Compile Include="ContentSystem\ContentManagerController.cs" />
|
||||
<Compile Include="ContentSystem\ContentResolvers\FontContentResolver.cs" />
|
||||
<Compile Include="ContentSystem\ContentResolvers\ResolutionContentResolver.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user