|
- using System;
- using CIG.Translation;
- using Inno.DLC;
- using SUISS.Core;
- using SUISS.Scheduling;
- using UnityEngine;
-
- public class DownloadChoicePopupState : PopupBaseState
- {
- public void Setup(DLCGroup group)
- {
- this._background = group.FileSelection("Type", "Background");
- this._music = group.FileSelection("Type", "Music");
- ((DownloadChoicePopupView)this.View).SetupViews(this._background.RemainingDownloadSize, this._music.RemainingDownloadSize);
- }
-
- public void StartDownload(bool background, bool music)
- {
- DLCGroup group = null;
- if (background)
- {
- if (music)
- {
- group = DLCGroup.Merge(new DLCGroup[]
- {
- this._background,
- this._music
- });
- }
- else
- {
- group = this._background;
- }
- }
- else if (music)
- {
- group = this._music;
- }
- else
- {
- UnityEngine.Debug.LogError("No download groups selected!");
- }
- if (group != null)
- {
- Action action = delegate()
- {
- SingletonMonobehaviour<PopupManager>.Instance.RequestFirstPopup<DownloadProgressPopupState>(delegate(State state)
- {
- ((DownloadProgressPopupState)state).Setup(group);
- });
- };
- if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
- {
- action();
- }
- else
- {
- ILocalizedString title;
- if (Application.internetReachability == NetworkReachability.NotReachable)
- {
- title = Localization.Key("no_internet_connection");
- }
- else
- {
- title = Localization.Key("download_manager_no_wifi");
- }
- 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);
- }
- base.ClosePopup();
- }
- }
-
- public void DontAsk()
- {
- CIGDLCDownloader.AllowedToAskTimestamp = Timing.UtcNow + 259200.0;
- base.ClosePopup();
- }
-
- public override void Enter(State oldState)
- {
- base.Enter(oldState);
- }
-
- public override void Leave(State newState)
- {
- base.Leave(newState);
- this._background = null;
- this._music = null;
- }
-
- private DLCGroup _background;
-
- private DLCGroup _music;
- }
|