예제 #1
0
    static IEnumerator LoadResource()
    {
        for (int i = 0; i < entries.Count; i++)
        {
            Entry entry = entries[i];

            if (entry.isDirectory)
            {
                yield return(null);

                continue;
            }

            if ((entry.songInfo.background || string.IsNullOrEmpty(entry.songInfo.backgroundPath)) &&
                (entry.songInfo.banner || string.IsNullOrEmpty(entry.songInfo.bannerPath)))
            {
                yield return(null);

                continue;
            }

            FileInfo fileInfo       = new FileInfo(GetAbsolutePath(entry.songInfo.filePath));
            var      resourceLoader = new ResourceLoader(fileInfo.Directory.FullName);

            if (!entry.songInfo.background && !string.IsNullOrEmpty(entry.songInfo.backgroundPath))
            {
                var backgroundObj = new ResourceObject(-1, ResourceType.bmp, entry.songInfo.backgroundPath);
                yield return(SmartCoroutineLoadBalancer.StartCoroutine(bmsManager, resourceLoader.LoadResource(backgroundObj)));

                entry.songInfo.background = backgroundObj.texture;
            }

            if (!entry.songInfo.banner && !string.IsNullOrEmpty(entry.songInfo.bannerPath))
            {
                var bannerObj = new ResourceObject(-2, ResourceType.bmp, entry.songInfo.bannerPath);
                yield return(SmartCoroutineLoadBalancer.StartCoroutine(bmsManager, resourceLoader.LoadResource(bannerObj)));

                entry.songInfo.banner = bannerObj.texture;
            }

            entries[i] = entry;
            cachedEntries[fileInfo.FullName] = entry;

            if (selectedEntry.HasValue &&
                string.Equals(entry.songInfo.filePath, selectedEntry.Value.filePath, StringComparison.Ordinal))
            {
                selectedEntry = entry.songInfo;
                if (OnSelectionChanged != null)
                {
                    OnSelectionChanged.Invoke(selectedEntry);
                }
            }

            InvokeListUpdated();
            yield return(null);
        }
        loadResourceCoroutine = null;
        yield break;
    }
예제 #2
0
 void ReloadResources()
 {
     if (reloadResourceCoroutine != null)
     {
         StopCoroutine(reloadResourceCoroutine);
     }
     reloadResourceCoroutine = SmartCoroutineLoadBalancer.StartCoroutine(this, ReloadResourcesCoroutine(resourcePath), Time.maximumDeltaTime);
 }
예제 #3
0
 static void UpdateList()
 {
     loadResourceCoroutine = SmartCoroutineLoadBalancer.StartCoroutine(bmsManager, LoadResource());
     InvokeListUpdated();
     SelectedSong = null;
 }