Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

56 строки
1.3 KiB

  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. namespace Inno.DLC
  5. {
  6. public class DLCDebugger : MonoBehaviour
  7. {
  8. public static void DownloadAllDLC()
  9. {
  10. if (!Application.isPlaying)
  11. {
  12. return;
  13. }
  14. new GameObject().AddComponent<DLCDebugger>();
  15. }
  16. private void Start()
  17. {
  18. base.StartCoroutine(this.DownloadAll());
  19. }
  20. private IEnumerator DownloadAll()
  21. {
  22. float t = Time.realtimeSinceStartup;
  23. DLCManager manager = new DLCManager("dlc.properties");
  24. UnityEngine.Debug.Log(string.Format("Parsing config and checking files cost {0} seconds", Time.realtimeSinceStartup - t));
  25. foreach (DLCGroup group in manager.AllGroups)
  26. {
  27. foreach (DLCFile file in group.AllFiles)
  28. {
  29. if (file.Exists)
  30. {
  31. UnityEngine.Debug.Log(string.Format("{0} exists", file.Name));
  32. }
  33. else
  34. {
  35. DLCDownloadTask task = file.Download();
  36. yield return task.WaitAndStore();
  37. if (task.IsSuccess)
  38. {
  39. UnityEngine.Debug.Log(string.Format("Download of {0} successful, Check returns {1}.", file.Name, file.Check()));
  40. }
  41. else
  42. {
  43. UnityEngine.Debug.Log(string.Format("Download of {0} failed!", file.Name));
  44. }
  45. }
  46. }
  47. }
  48. UnityEngine.Object.Destroy(base.gameObject);
  49. yield break;
  50. }
  51. }
  52. }