您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字
 
 
 

123 行
3.2 KiB

  1. using System;
  2. using CIG;
  3. using CIG.Translation;
  4. using UnityEngine;
  5. public class DownloadChoicePopupView : PopupBaseView
  6. {
  7. public void SetupViews(long backgroundSize, long musicSize)
  8. {
  9. if (backgroundSize > 0L)
  10. {
  11. this._backgroundOptionSizeLabel.LocalizedString = Localization.Format("({0})", new ILocalizedString[]
  12. {
  13. CIGUtilities.SizeToString(backgroundSize)
  14. });
  15. this._backgroundOptionContainer.SetActive(true);
  16. this._backgroundChecked = true;
  17. }
  18. else
  19. {
  20. this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_soundtrack_available");
  21. this._backgroundOptionContainer.SetActive(false);
  22. this._backgroundOptionToggle.SetActive(false);
  23. this._musicOptionToggle.SetActive(false);
  24. this._backgroundChecked = false;
  25. }
  26. if (musicSize > 0L)
  27. {
  28. this._musicOptionSizeLabel.LocalizedString = Localization.Format("({0})", new ILocalizedString[]
  29. {
  30. CIGUtilities.SizeToString(musicSize)
  31. });
  32. this._musicOptionContainer.SetActive(true);
  33. this._musicChecked = true;
  34. }
  35. else
  36. {
  37. this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_viewing_low_res");
  38. this._musicOptionContainer.SetActive(false);
  39. this._backgroundOptionToggle.SetActive(false);
  40. this._musicOptionToggle.SetActive(false);
  41. this._musicChecked = false;
  42. }
  43. if (this._backgroundChecked && this._musicChecked)
  44. {
  45. this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_island_and_soundtrack_available");
  46. this._backgroundOptionToggle.SetActive(true);
  47. this._musicOptionToggle.SetActive(true);
  48. }
  49. this.UpdateButtons();
  50. }
  51. public void RedButtonPressed()
  52. {
  53. ((DownloadChoicePopupState)this.State).ClosePopup();
  54. }
  55. public void GreenButtonPressed()
  56. {
  57. ((DownloadChoicePopupState)this.State).StartDownload(this._backgroundChecked, this._musicChecked);
  58. }
  59. public void BlueButtonPressed()
  60. {
  61. ((DownloadChoicePopupState)this.State).DontAsk();
  62. }
  63. public void BackgroundCheckPressed()
  64. {
  65. this._backgroundChecked = !this._backgroundChecked;
  66. this.UpdateButtons();
  67. }
  68. public void MusicCheckPressed()
  69. {
  70. this._musicChecked = !this._musicChecked;
  71. this.UpdateButtons();
  72. }
  73. private void UpdateButtons()
  74. {
  75. this._backgroundOptionCheckmark.SetActive(this._backgroundChecked);
  76. this._musicOptionCheckmark.SetActive(this._musicChecked);
  77. this._downloadButton.Interactable = (this._musicChecked || this._backgroundChecked);
  78. }
  79. [SerializeField]
  80. private LocalizedText _bodyTextLabel;
  81. [SerializeField]
  82. private InteractableButton _downloadButton;
  83. [SerializeField]
  84. [Header("Island Background Content")]
  85. private GameObject _backgroundOptionContainer;
  86. [SerializeField]
  87. private GameObject _backgroundOptionToggle;
  88. [SerializeField]
  89. private GameObject _backgroundOptionCheckmark;
  90. [SerializeField]
  91. private LocalizedText _backgroundOptionSizeLabel;
  92. [SerializeField]
  93. [Header("Music")]
  94. private GameObject _musicOptionContainer;
  95. [SerializeField]
  96. private GameObject _musicOptionToggle;
  97. [SerializeField]
  98. private GameObject _musicOptionCheckmark;
  99. [SerializeField]
  100. private LocalizedText _musicOptionSizeLabel;
  101. private bool _backgroundChecked;
  102. private bool _musicChecked;
  103. }