using System; using CIG.Translation; using UnityEngine; using UnityEngine.UI; public class DownloadProgressPopupView : PopupBaseView { public void SetStart(long totalSize) { this.SetProgress(0f); this._titleLabel.LocalizedString = Localization.Key("download_manager_downloading"); this._downloadFailedObject.SetActive(false); this._cancelButton.SetActive(true); this._greenButton.SetActive(false); this._sizeLabel.LocalizedString = Localization.Format("({0})", new ILocalizedString[] { CIGUtilities.SizeToString(totalSize) }); } public void SetFailed() { this._titleLabel.LocalizedString = Localization.Key("download_manager_notice"); this._downloadFailedObject.SetActive(true); this._cancelButton.SetActive(true); this._greenButton.SetActive(true); this._greenButtonText.LocalizedString = Localization.Key("download_manager_retry"); } public void SetFinished() { this._cancelButton.SetActive(false); this._greenButton.SetActive(true); this._greenButtonText.LocalizedString = Localization.Key("ok"); } public void SetProgress(float progress) { this._progressBarSlider.value = progress; this._progressBarLabel.LocalizedString = Localization.Percentage(progress, 0); } public void OnGreenButtonClicked() { ((DownloadProgressPopupState)this.State).GreenButton(); } public void OnCancelClicked() { ((DownloadProgressPopupState)this.State).CancelRequested(); } public override void OnBlackOverlayClicked() { } [SerializeField] private LocalizedText _titleLabel; [SerializeField] private GameObject _downloadFailedObject; [SerializeField] private Slider _progressBarSlider; [SerializeField] private LocalizedText _progressBarLabel; [SerializeField] private LocalizedText _sizeLabel; [SerializeField] private GameObject _greenButton; [SerializeField] private LocalizedText _greenButtonText; [SerializeField] private GameObject _cancelButton; }