コード例 #1
0
        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);
        }
コード例 #2
0
        /// <summary>
        /// Resets currentlying previewing mapset.
        /// </summary>
        private void ResetPreviewingMapset()
        {
            if (previewingMapset.Value == null)
            {
                return;
            }

            MusicController.Stop();
            MusicController.MountAudio(null);
            musicAgent.Remove();
            previewingMapset.Value = null;
        }
コード例 #3
0
        /// <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;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Unloads the loaded background asset.
 /// </summary>
 private void UnloadBackground()
 {
     backgroundAgent.Remove();
     bindableBackground.Value = emptyBackground;
 }
コード例 #5
0
 /// <summary>
 /// Unloads the loaded music asset.
 /// </summary>
 private void UnloadMusic()
 {
     musicAgent.Remove();
     bindableMusic.Value = null;
 }