|
- using System;
- using System.Collections;
- using UnityEngine;
-
- namespace Inno.DLC
- {
- public class DLCDebugger : MonoBehaviour
- {
- public static void DownloadAllDLC()
- {
- if (!Application.isPlaying)
- {
- return;
- }
- new GameObject().AddComponent<DLCDebugger>();
- }
-
- private void Start()
- {
- base.StartCoroutine(this.DownloadAll());
- }
-
- private IEnumerator DownloadAll()
- {
- float t = Time.realtimeSinceStartup;
- DLCManager manager = new DLCManager("dlc.properties");
- UnityEngine.Debug.Log(string.Format("Parsing config and checking files cost {0} seconds", Time.realtimeSinceStartup - t));
- foreach (DLCGroup group in manager.AllGroups)
- {
- foreach (DLCFile file in group.AllFiles)
- {
- if (file.Exists)
- {
- UnityEngine.Debug.Log(string.Format("{0} exists", file.Name));
- }
- else
- {
- DLCDownloadTask task = file.Download();
- yield return task.WaitAndStore();
- if (task.IsSuccess)
- {
- UnityEngine.Debug.Log(string.Format("Download of {0} successful, Check returns {1}.", file.Name, file.Check()));
- }
- else
- {
- UnityEngine.Debug.Log(string.Format("Download of {0} failed!", file.Name));
- }
- }
- }
- }
- UnityEngine.Object.Destroy(base.gameObject);
- yield break;
- }
- }
- }
|