-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfbf30f
commit 16edf45
Showing
14 changed files
with
244 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Hypercube.Client/Resources/Caching/CacheManager.Preload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Diagnostics; | ||
using Hypercube.Shared.Dependency; | ||
using Hypercube.Shared.Logging; | ||
|
||
namespace Hypercube.Client.Resources.Caching; | ||
|
||
public partial class CacheManager | ||
{ | ||
public void PreloadTextures() | ||
{ | ||
var logger = LoggingManager.GetLogger("cache.preload"); | ||
|
||
PreloadTextures(logger); | ||
} | ||
private void PreloadTextures(Logger logger) | ||
{ | ||
var container = DependencyManager.GetContainer(); | ||
logger.EngineInfo("Preloading textures..."); | ||
var st = Stopwatch.StartNew(); | ||
|
||
var texDict = GetTypeDict<TextureResource>(); | ||
|
||
var files = _resourceManager.FindContentFiles("/Textures/") | ||
.Where(p => !texDict.ContainsKey(p) && p.Extension == ".png") | ||
.Select(p => new TextureResource() { Path = p}); | ||
|
||
|
||
foreach (var file in files) | ||
{ | ||
file.Load(file.Path, container); | ||
|
||
texDict[file.Path] = file; | ||
} | ||
} | ||
} |
Oops, something went wrong.