Ejemplo n.º 1
0
        /// <summary>
        /// Event called from dropdown context when a menu iten has been selected.
        /// </summary>
        private void OnDropdownSelection(DropdownData data)
        {
            if (mapsetForDropdown == null)
            {
                return;
            }

            int action = (int)data.ExtraData;

            switch (action)
            {
            case SongDeleteAction:
                bool   preferUnicode = PreferUnicode.Value;
                string artist        = mapsetForDropdown.Metadata.GetArtist(preferUnicode);
                string title         = mapsetForDropdown.Metadata.GetTitle(preferUnicode);
                // Confirm with the user first.
                var dialogModel = OverlayNavigator.Show <DialogOverlay>().Model;
                dialogModel.SetMessage($"Are you sure you want to delete this mapset?\n{artist} - {title}");
                dialogModel.AddConfirmCancel(
                    onConfirm: () => MapManager.DeleteMapset(mapsetForDropdown)
                    );
                break;

            case SongOffsetAction:
                var offsetsModel = OverlayNavigator.Show <OffsetsOverlay>().Model;
                offsetsModel.SetMap(mapsetForDropdown);
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Navigates away toward game screen.
 /// </summary>
 public void NavigateToGame()
 {
     ScreenNavigator.Hide <PrepareScreen>();
     OverlayNavigator.Show <GameLoadOverlay>().Model.StartLoad(new GameParameter()
     {
         Map = SelectedMap.Value,
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Shows the dialog overlay.
        /// </summary>
        private void ShowDialogOverlay()
        {
            var overlay = OverlayNavigator.Show <DialogOverlay>();

            // Hide the pause overlay when the dialog closes.
            overlay.OnHide += OnDialogOverlayHide;

            dialogModel = overlay.Model;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Event called on selecting offset option.
        /// </summary>
        private void OnOffsetOption()
        {
            // Show the offset overlay.
            OffsetsOverlay overlay = OverlayNavigator.Show <OffsetsOverlay>();

            // Bind temporary hide event listener to overlay.
            EventBinder <Action> closeBinder = new EventBinder <Action>(
                e => overlay.OnHide += e,
                e => overlay.OnHide -= e
                );

            closeBinder.IsOneTime = true;

            // Show pause overlay once the offset overlay has been closed.
            closeBinder.SetHandler(() => OverlayNavigator.Show <PauseOverlay>());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Shows the home menu overlay.
        /// </summary>
        public void ShowHomeMenuOverlay()
        {
            if (isHomeMenuShown.Value)
            {
                return;
            }

            var homeMenuOverlay = OverlayNavigator.Show <HomeMenuOverlay>();

            if (homeMenuOverlay != null)
            {
                isHomeMenuShown.Value = true;
                BgOverlay.Color       = Color.gray;

                homeMenuOverlay.OnHide += OnHomeMenuHide;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns the appropriate menu overlay for the specified type.
        /// </summary>
        private INavigationView GetMenuFor(MenuType type)
        {
            switch (type)
            {
            case MenuType.Music: return(OverlayNavigator.Show <MusicMenuOverlay>());

            case MenuType.Notification: return(OverlayNavigator.Show <NotificationMenuOverlay>());

            case MenuType.Profile: return(OverlayNavigator.Show <ProfileMenuOverlay>());

            case MenuType.Mode: return(OverlayNavigator.Show <ModeMenuOverlay>());

            case MenuType.Quick: return(OverlayNavigator.Show <QuickMenuOverlay>());

            case MenuType.Settings: return(OverlayNavigator.Show <SettingsMenuOverlay>());
            }
            return(null);
        }
Ejemplo n.º 7
0
        public void InvokePause()
        {
            if (IsPaused)
            {
                return;
            }
            if (GameProcessor.CurrentTime < 0f)
            {
                return;
            }
            if (MusicController.IsPlaying)
            {
                MusicController.Pause();
            }

            var pauseOverlay = OverlayNavigator.Show <PauseOverlay>();

            IsPaused = true;
            OnPause?.Invoke();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Shows the map actions dialog overlay.
        /// </summary>
        public void ShowMapActions(IOriginalMap map)
        {
            if (map == null)
            {
                Logger.LogWarning("Attempted to show map actions for a null map.");
                return;
            }

            var dialogModel = OverlayNavigator.Show <DialogOverlay>().Model;

            dialogModel.SetMessage($"Select an action for the version ({map.Detail.Version})");
            dialogModel.AddOption(new DialogOption()
            {
                Callback = () => OnMapActionDelete(map),
                Label    = "Delete",
                Color    = ColorPreset.Warning
            });
            dialogModel.AddOption(new DialogOption()
            {
                Label = "Cancel",
                Color = ColorPreset.Negative
            });
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Navigates away to the next view.
 /// </summary>
 public void NavigateToNext()
 {
     OverlayNavigator.Show <SystemOverlay>();
     OverlayNavigator.Show <BackgroundOverlay>();
     ScreenNavigator.Show <HomeScreen>();
 }
 private IEnumerator AssignSettingsData()
 {
     overlay = OverlayNavigator.Show<SettingsMenuOverlay>();
     overlay.Model.SetSettingsData(settingsData);
     yield break;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Shows the offset overlay for current selection.
 /// </summary>
 public void ShowOffset() => OverlayNavigator.Show <OffsetsOverlay>();