public void Unload() { var application = new ApplicationConfigured(new ApplicationResources { new ApplicationConfig { Modules = { (IApplicationModuleBuilder)Resources.Load("Module", typeof(IApplicationModuleBuilder)) } } }); application.Initialize(); var module = application.GetModule <IAssetModule>(); object asset = module.Load <Material>("7ab173a97bcf2bc44b710c33213fa557"); Assert.NotNull(asset); Assert.IsInstanceOf <Material>(asset); module.Unload("7ab173a97bcf2bc44b710c33213fa557", asset, AssetUnloadParameters.Empty); Assert.Null(asset); }
public void Uninitialize() { var application = new ApplicationConfigured(new ApplicationResources { new ApplicationConfig { Modules = { (IApplicationModuleBuilder)Resources.Load("Module", typeof(IApplicationModuleBuilder)) } } }); application.Initialize(); var module = application.GetModule <IAssetModule>(); object asset1 = module.Load <Material>("7ab173a97bcf2bc44b710c33213fa557"); object asset2 = module.Load <Material>("7ab173a97bcf2bc44b710c33213fa557"); Assert.NotNull(asset1); Assert.NotNull(asset2); Assert.AreEqual(asset1, asset2); Assert.IsNotEmpty(module.Tracker.Entries); Assert.AreEqual(1, module.Tracker.Entries.Count); Assert.AreEqual(2, module.Tracker.Get("7ab173a97bcf2bc44b710c33213fa557").Count); application.Uninitialize(); Assert.AreEqual(null, asset1); Assert.AreEqual(null, asset2); Assert.IsEmpty(module.Tracker.Entries); Assert.AreEqual(0, module.Tracker.Entries.Count); Assert.False(module.Tracker.TryGet("7ab173a97bcf2bc44b710c33213fa557", out _)); }
public IEnumerator Preload() { var application = new ApplicationConfigured(new ApplicationResources { new ApplicationConfig { Modules = { (IApplicationModuleBuilder)Resources.Load("Module2", typeof(IApplicationModuleBuilder)) } } }); application.Initialize(); var module = application.GetModule <IAssetModule>(); Assert.AreEqual(1, module.Tracker.Entries.Count); Assert.True(module.Tracker.Entries.ContainsKey("6ecbdf2a84bc4b94794d0ccbb7164158")); Assert.False(module.Tracker.Entries.ContainsKey("7532bc5c40ab10644812b87b664d33ba")); Task task = application.InitializeAsync(); while (!task.IsCompleted) { yield return(null); } Assert.AreEqual(2, module.Tracker.Entries.Count); Assert.True(module.Tracker.Entries.ContainsKey("6ecbdf2a84bc4b94794d0ccbb7164158")); Assert.True(module.Tracker.Entries.ContainsKey("7532bc5c40ab10644812b87b664d33ba")); }
public void LoadReferenced() { var application = new ApplicationConfigured(new ApplicationResources { new ApplicationConfig { Modules = { (IApplicationModuleBuilder)Resources.Load("Module", typeof(IApplicationModuleBuilder)) } } }); application.Initialize(); var module = application.GetModule <IAssetModule>(); object asset = module.Load <Material>("d307b79fb3863804f8298a0390544dc6"); Assert.NotNull(asset); Assert.IsInstanceOf <Material>(asset); Assert.AreEqual("AssetReferenced", ((Material)asset).name); }
public void Load() { var application = new ApplicationConfigured(new ApplicationResources { new ApplicationConfig { Modules = { (IApplicationModuleBuilder)Resources.Load("Module", typeof(IApplicationModuleBuilder)) } } }); application.Initialize(); var module = application.GetModule <IAssetModule>(); object asset = module.Load <Material>("7ab173a97bcf2bc44b710c33213fa557"); Assert.NotNull(asset); Assert.IsInstanceOf <Material>(asset); Assert.AreEqual("Asset", ((Material)asset).name); }