Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

95 rindas
2.2 KiB

  1. using System;
  2. using CIG.Translation;
  3. using Inno.DLC;
  4. using SUISS.Core;
  5. using SUISS.Scheduling;
  6. using UnityEngine;
  7. public class DownloadChoicePopupState : PopupBaseState
  8. {
  9. public void Setup(DLCGroup group)
  10. {
  11. this._background = group.FileSelection("Type", "Background");
  12. this._music = group.FileSelection("Type", "Music");
  13. ((DownloadChoicePopupView)this.View).SetupViews(this._background.RemainingDownloadSize, this._music.RemainingDownloadSize);
  14. }
  15. public void StartDownload(bool background, bool music)
  16. {
  17. DLCGroup group = null;
  18. if (background)
  19. {
  20. if (music)
  21. {
  22. group = DLCGroup.Merge(new DLCGroup[]
  23. {
  24. this._background,
  25. this._music
  26. });
  27. }
  28. else
  29. {
  30. group = this._background;
  31. }
  32. }
  33. else if (music)
  34. {
  35. group = this._music;
  36. }
  37. else
  38. {
  39. UnityEngine.Debug.LogError("No download groups selected!");
  40. }
  41. if (group != null)
  42. {
  43. Action action = delegate()
  44. {
  45. SingletonMonobehaviour<PopupManager>.Instance.RequestFirstPopup<DownloadProgressPopupState>(delegate(State state)
  46. {
  47. ((DownloadProgressPopupState)state).Setup(group);
  48. });
  49. };
  50. if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
  51. {
  52. action();
  53. }
  54. else
  55. {
  56. ILocalizedString title;
  57. if (Application.internetReachability == NetworkReachability.NotReachable)
  58. {
  59. title = Localization.Key("no_internet_connection");
  60. }
  61. else
  62. {
  63. title = Localization.Key("download_manager_no_wifi");
  64. }
  65. SingletonMonobehaviour<PopupManager>.Instance.RequestFirstGenericPopup(null, title, Localization.Key("download_manager_mobile_data_confirm"), Localization.Key("download_manager_confirm"), Localization.Key("download_manager_cancel"), action, null, null, true);
  66. }
  67. base.ClosePopup();
  68. }
  69. }
  70. public void DontAsk()
  71. {
  72. CIGDLCDownloader.AllowedToAskTimestamp = Timing.UtcNow + 259200.0;
  73. base.ClosePopup();
  74. }
  75. public override void Enter(State oldState)
  76. {
  77. base.Enter(oldState);
  78. }
  79. public override void Leave(State newState)
  80. {
  81. base.Leave(newState);
  82. this._background = null;
  83. this._music = null;
  84. }
  85. private DLCGroup _background;
  86. private DLCGroup _music;
  87. }