progress of content loading is no longer bound to event system

This commit is contained in:
Harrison Deng 2018-11-01 00:12:43 -05:00
parent f6fbb366a3
commit df8397c0c7

View File

@ -21,7 +21,7 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
readonly Queue<LoadableContent> queue;
Dictionary<string, IDisposable> assets;
public readonly Dictionary<Type, IContentPathModifier> contentPathModifier;
float progress;
public ContentSystem(ContentManager contentManager)
{
this.contentManager = contentManager;
@ -93,7 +93,8 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
LoadableContent content = queue.Dequeue();
Load(content.assetName, content.type, content.usePathModifier);
tasksCompleted++;
OnProgress(content.assetName, (float)tasksCompleted / totalTasks);
progress = (float)tasksCompleted / totalTasks;
OnProgress(content.assetName, progress);
}
}
}
@ -151,5 +152,13 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
{
UpdateEvent?.Invoke(fileName, progress);
}
public float Progress
{
get
{
return progress;
}
}
}
}