Пример #1
0
 private void YesClick()
 {
     modal.Hide(true);
     OnConfirm?.Invoke();
     OnConfirm = null;
     //modal.HandleBlockerButtonClicked();
 }
Пример #2
0
 private void FinishCurrentChange()
 {
     ChangeModal.Hide(true, () =>
     {
         CurrentChange = null;
         TryProcessNextChange();
     });
 }
        internal async System.Threading.Tasks.Task DownloadPlaylistAsync()
        {
            IAnnotatedBeatmapLevelCollection selectedPlaylist = annotatedBeatmapLevelCollectionsViewController.selectedAnnotatedBeatmapLevelCollection;
            List <IPlaylistSong>             missingSongs;

            if (selectedPlaylist is BlistPlaylist)
            {
                missingSongs = ((BlistPlaylist)selectedPlaylist).Where(s => s.PreviewBeatmapLevel == null).Select(s => s).ToList();
            }
            else if (selectedPlaylist is LegacyPlaylist)
            {
                missingSongs = ((LegacyPlaylist)selectedPlaylist).Where(s => s.PreviewBeatmapLevel == null).Select(s => s).ToList();
            }
            else
            {
                modalMessage.text = "Error: The selected playlist cannot be downloaded.";
                modalState        = ModalState.OkModal;
                modal.Show(true);
                return;
            }
            modalMessage.text = string.Format("{0}/{1} songs downloaded", 0, missingSongs.Count);
            modalState        = ModalState.DownloadingModal;
            modal.Show(true);
            tokenSource.Dispose();
            tokenSource = new CancellationTokenSource();
            for (int i = 0; i < missingSongs.Count; i++)
            {
                try
                {
                    if (!string.IsNullOrEmpty(missingSongs[i].Key))
                    {
                        await DownloaderUtils.instance.BeatmapDownloadByKey(missingSongs[i].Key, tokenSource.Token);
                    }
                    else if (!string.IsNullOrEmpty(missingSongs[i].Hash))
                    {
                        await DownloaderUtils.instance.BeatmapDownloadByHash(missingSongs[i].Hash, tokenSource.Token);
                    }
                    modalMessage.text = string.Format("{0}/{1} songs downloaded", i + 1, missingSongs.Count);
                }
                catch (Exception e)
                {
                    if (e is TaskCanceledException)
                    {
                        Plugin.Log.Warn("Song Download Aborted.");
                    }
                    else
                    {
                        Plugin.Log.Critical("Failed to download Song!");
                    }
                    break;
                }
            }
            modal.Hide(true);
            SongCore.Loader.Instance.RefreshSongs(false);
            downloadingBeatmapCollectionIdx = annotatedBeatmapLevelCollectionsViewController.selectedItemIndex;
            LevelFilteringNavigationController_UpdateSecondChildControllerContent.SecondChildControllerUpdatedEvent += LevelFilteringNavigationController_UpdateSecondChildControllerContent_SecondChildControllerUpdatedEvent;
        }
        private void FinishCurrentChange()
        {
            ChangeModal.Hide(true, () =>
            {
                siraLog.Debug("Hiding change");

                CurrentChange = null;
                TryProcessNextChange();
            });
        }
 internal void OnCellSelect(TableView tableView, int index)
 {
     loadedplaylists[index].Add(standardLevelDetailViewController.selectedDifficultyBeatmap.level);
     customListTableData.tableView.ClearSelection();
     if (annotatedBeatmapLevelCollectionsViewController.isActiveAndEnabled && AnnotatedBeatmapLevelCollectionsViewController_SetData.isCustomBeatmapLevelPack)
     {
         annotatedBeatmapLevelCollectionsViewController.SetData(AnnotatedBeatmapLevelCollectionsViewController_SetData.otherCustomBeatmapLevelCollections, annotatedBeatmapLevelCollectionsViewController.selectedItemIndex, false);
     }
     PlaylistLibUtils.playlistManager.StorePlaylist(loadedplaylists[index]);
     modal.Hide(true);
 }
        public override void HandleType(ComponentTypeWithData componentType, BSMLParserParams parserParams)
        {
            try
            {
                ModalView modalView      = componentType.component as ModalView;
                Transform originalParent = modalView.transform.parent;
                bool      moveToCenter   = true;
                if (componentType.data.TryGetValue("moveToCenter", out string moveToCenterString))
                {
                    moveToCenter = bool.Parse(moveToCenterString);
                }

                if (componentType.data.TryGetValue("showEvent", out string showEvent))
                {
                    parserParams.AddEvent(showEvent, delegate
                    {
                        modalView.Show(true, moveToCenter);
                    });
                }

                if (componentType.data.TryGetValue("hideEvent", out string hideEvent))
                {
                    parserParams.AddEvent(hideEvent, delegate
                    {
                        modalView.Hide(true, () => modalView.transform.SetParent(originalParent, true));
                    });
                }

                if (componentType.data.TryGetValue("clickOffCloses", out string clickOffCloses) && Parse.Bool(clickOffCloses))
                {
                    modalView._blockerClickedEvent += delegate
                    {
                        modalView.Hide(true, () => modalView.transform.SetParent(originalParent, true));
                    };
                }
            }
            catch (Exception ex)
            {
                Logger.log?.Error(ex);
            }
        }
 public void OnEnter(string value)
 {
     associatedValue?.SetValue(value);
     onEnter?.Invoke(value);
     modalView.Hide(true);
 }
Пример #8
0
 private void YesClick()
 {
     modal.Hide(true);
     OnConfirm?.Invoke();
     OnConfirm = null;
 }