Пример #1
0
        public override void Remove(CacheItem item, string key, bool isMainSlbServer = true)
        {
            var cacheKey = GenerateCacheKey(item, key);

            if (CachePool.Contains(cacheKey))
            {
                CachePool.Remove(cacheKey);
            }
        }
Пример #2
0
 public static void UnloadSoundAsset(AudioSource audioSource, int soundId)
 {
     if (audioSource != null)
     {
         SoundDeploy deploy = _soundTableT.GetSection(soundId);
         CachePool.Remove(deploy.resource);
         Resources.UnloadAsset(audioSource.clip);
     }
 }
Пример #3
0
 public static void FadeOutMusic(float fade = 1f)
 {
     if (_music != null && _music.AudioSource != null)
     {
         CachePool.Remove(_music.Resources);
         Resources.UnloadAsset(_music.AudioSource.clip);
         Object.Destroy(_music.AudioSource.gameObject);
     }
 }
Пример #4
0
 public static void StopEnvironmentMusic(float fade = 3f)
 {
     if (_environment != null && _environment.AudioSource != null)
     {
         CachePool.Remove(_environment.Resources);
         Resources.UnloadAsset(_environment.AudioSource.clip);
         Object.Destroy(_environment.AudioSource.gameObject);
     }
 }
Пример #5
0
 public override void ClearAll()
 {
     lock (Padlock)
     {
         foreach (var cacheItem in CachePool)
         {
             CachePool.Remove(cacheItem.Key);
         }
     }
 }
Пример #6
0
 public override void ClearItem(CacheItem item, bool isMainSlbServer = true)
 {
     lock (Padlock)
     {
         foreach (var cacheItem in CachePool.Where(p => p.Key.StartsWith(item.ToString())))
         {
             CachePool.Remove(cacheItem.Key);
         }
     }
 }
Пример #7
0
 public static void StopMusic()
 {
     if (_music != null && _music.AudioSource != null)
     {
         CachePool.Remove(_music.Resources);
         Resources.UnloadAsset(_music.AudioSource.clip);
         Object.Destroy(_music.AudioSource.gameObject);
         _music.AudioSource = null;
     }
 }