public IEnumerator TestRemoveImmediate() { var cacher = new DummyCacher(); var agent = new CacherAgent <string, DummyCacherData>(cacher); Assert.AreEqual(cacher, agent.Cacher); agent.UseDelayedRemove = false; agent.RemoveDelay = 0f; Assert.IsNull(agent.Listener); Assert.IsFalse(cacher.IsCached("A")); agent.Request("A"); Assert.IsFalse(cacher.IsCached("A")); Assert.IsNull(agent.Listener.Value); yield return(new WaitForSecondsRealtime(1.5f)); var value = agent.Listener.Value; Assert.IsTrue(cacher.IsCached("A")); Assert.IsNotNull(value); Assert.IsFalse(value.IsDestroyed); agent.Remove(); Assert.IsFalse(cacher.IsCached("A")); Assert.IsNull(agent.Listener); Assert.IsTrue(value.IsDestroyed); }
/// <summary> /// Resets currentlying previewing mapset. /// </summary> private void ResetPreviewingMapset() { if (previewingMapset.Value == null) { return; } MusicController.Stop(); MusicController.MountAudio(null); musicAgent.Remove(); previewingMapset.Value = null; }
/// <summary> /// Loads background asset from current mapset. /// </summary> private void LoadBackground() { backgroundAgent.Remove(); SetHighlightColor(Color.white); thumbImage.Texture = null; thumbImage.Alpha = 0f; // Background asset should be loaded after a certain delay. if (Mapset != null) { isBackgroundWait = true; if (BackgroundCacher.IsCached(Mapset.Maps[0])) { bgWaitTime = 0f; } else { bgWaitTime = BackgroundLoadWait; } } }
/// <summary> /// Unloads the loaded background asset. /// </summary> private void UnloadBackground() { backgroundAgent.Remove(); bindableBackground.Value = emptyBackground; }
/// <summary> /// Unloads the loaded music asset. /// </summary> private void UnloadMusic() { musicAgent.Remove(); bindableMusic.Value = null; }