using System; using CIG; using CIG.Translation; using UnityEngine; public class DownloadChoicePopupView : PopupBaseView { public void SetupViews(long backgroundSize, long musicSize) { if (backgroundSize > 0L) { this._backgroundOptionSizeLabel.LocalizedString = Localization.Format("({0})", new ILocalizedString[] { CIGUtilities.SizeToString(backgroundSize) }); this._backgroundOptionContainer.SetActive(true); this._backgroundChecked = true; } else { this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_soundtrack_available"); this._backgroundOptionContainer.SetActive(false); this._backgroundOptionToggle.SetActive(false); this._musicOptionToggle.SetActive(false); this._backgroundChecked = false; } if (musicSize > 0L) { this._musicOptionSizeLabel.LocalizedString = Localization.Format("({0})", new ILocalizedString[] { CIGUtilities.SizeToString(musicSize) }); this._musicOptionContainer.SetActive(true); this._musicChecked = true; } else { this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_viewing_low_res"); this._musicOptionContainer.SetActive(false); this._backgroundOptionToggle.SetActive(false); this._musicOptionToggle.SetActive(false); this._musicChecked = false; } if (this._backgroundChecked && this._musicChecked) { this._bodyTextLabel.LocalizedString = Localization.Key("download_manager_island_and_soundtrack_available"); this._backgroundOptionToggle.SetActive(true); this._musicOptionToggle.SetActive(true); } this.UpdateButtons(); } public void RedButtonPressed() { ((DownloadChoicePopupState)this.State).ClosePopup(); } public void GreenButtonPressed() { ((DownloadChoicePopupState)this.State).StartDownload(this._backgroundChecked, this._musicChecked); } public void BlueButtonPressed() { ((DownloadChoicePopupState)this.State).DontAsk(); } public void BackgroundCheckPressed() { this._backgroundChecked = !this._backgroundChecked; this.UpdateButtons(); } public void MusicCheckPressed() { this._musicChecked = !this._musicChecked; this.UpdateButtons(); } private void UpdateButtons() { this._backgroundOptionCheckmark.SetActive(this._backgroundChecked); this._musicOptionCheckmark.SetActive(this._musicChecked); this._downloadButton.Interactable = (this._musicChecked || this._backgroundChecked); } [SerializeField] private LocalizedText _bodyTextLabel; [SerializeField] private InteractableButton _downloadButton; [SerializeField] [Header("Island Background Content")] private GameObject _backgroundOptionContainer; [SerializeField] private GameObject _backgroundOptionToggle; [SerializeField] private GameObject _backgroundOptionCheckmark; [SerializeField] private LocalizedText _backgroundOptionSizeLabel; [SerializeField] [Header("Music")] private GameObject _musicOptionContainer; [SerializeField] private GameObject _musicOptionToggle; [SerializeField] private GameObject _musicOptionCheckmark; [SerializeField] private LocalizedText _musicOptionSizeLabel; private bool _backgroundChecked; private bool _musicChecked; }