/// <summary> /// Invokes visual scenario editor exit after a single frame update /// </summary> /// <returns>IEnumerator</returns> private IEnumerator DelayedExitEditor(LoadingPanel.LoadingProcess loadingProcess) { yield return(null); loadingProcess.Update("Exiting the visual scenario editor."); Loader.ExitScenarioEditor(); //Do not turn off loading process - loading panel will be destroyed within the scene //loadingProcess.Update("Exited Visual scenario editor.", true); }
/// <summary> /// Coroutine invoking map load after a single frame update /// </summary> /// <param name="mapName">Name of map which should be loaded</param> /// <returns>IEnumerator</returns> private async Task DelayedSelectMap(string mapName, LoadingPanel.LoadingProcess loadingProcess) { await Task.Delay(20); await ScenarioManager.Instance.GetExtension <ScenarioMapManager>().LoadMapAsync(mapName); loadingProcess.Update($"Switched to the {mapName} map."); loadingProcess.NotifyCompletion(); }
/// <summary> /// Downloads selected map asynchronously and updates the loading information /// </summary> /// <param name="map">Map to download</param> /// <param name="loadingProcess">Loading process to update with progress</param> /// <returns>Task</returns> private async Task DownloadMap(MapMetaData map, LoadingPanel.LoadingProcess loadingProcess) { mapBeingDownloaded = map.assetGuid; var progressUpdate = new Progress <Tuple <string, float> >(p => { loadingProcess?.Update($"Downloading {p.Item1} {p.Item2:F}%."); }); map.assetModel = await DownloadManager.GetAsset(BundleConfig.BundleTypes.Environment, map.assetGuid, map.name, progressUpdate); mapBeingDownloaded = null; }
/// <summary> /// Downloads selected map asynchronously and updates the loading information /// </summary> /// <param name="map">Map to download</param> /// <param name="loadingProcess">Loading process to update with progress</param> /// <returns>Task</returns> private async Task DownloadMap(MapMetaData map, LoadingPanel.LoadingProcess loadingProcess) { ScenarioManager.Instance.ReportAssetDownload(map.assetGuid); var progressUpdate = new Progress <Tuple <string, float> >(p => { loadingProcess?.Update($"Downloading {p.Item1} {p.Item2:F}%."); }); map.assetModel = await DownloadManager.GetAsset(BundleConfig.BundleTypes.Environment, map.assetGuid, map.name, progressUpdate); ScenarioManager.Instance.ReportAssetFinishedDownload(map.assetGuid); }