Пример #1
0
 public static void ScrollDown()
 {
     SongSelectionMovement.SongMovementBefore(CurrentSongIndex, CurrentFolderIndex, CurrentLevelIndex, -Globals.CardOffset);
     if (SelectedFolderIndex == -1)
     {
         CurrentFolderIndex = CurrentFolderIndex < (FolderParams.Count - 1) ? ++CurrentFolderIndex : FolderParams.Count - 1;
     }
     else if (FolderParams[SelectedFolderIndex].Type == SortType.Level && SelectedLevelIndex == -1)
     {
         CurrentLevelIndex = CurrentLevelIndex < 9 ? ++CurrentLevelIndex : 9;
     }
     else
     {
         CurrentSongIndex = CurrentSongIndex < (Songlist.Count - 1) ? ++CurrentSongIndex : Songlist.Count - 1;
         //UpdateMetaLabels(); // FIXME
     }
     SongSelectionMovement.SongMovementAfter(CurrentSongIndex, CurrentFolderIndex, CurrentLevelIndex);
 }
Пример #2
0
 public static void ScrollUp()
 {
     SongSelectionMovement.SongMovementBefore(CurrentSongIndex, CurrentFolderIndex, CurrentLevelIndex, Globals.CardOffset);
     if (SelectedFolderIndex == -1)
     {
         CurrentFolderIndex = CurrentFolderIndex > 0 ? --CurrentFolderIndex : 0;
     }
     else if (FolderParams[SelectedFolderIndex].Type == SortType.Level && SelectedLevelIndex == -1)
     {
         CurrentLevelIndex = CurrentLevelIndex > 0 ? --CurrentLevelIndex : 0;
     }
     else
     {
         CurrentSongIndex = CurrentSongIndex > 0 ? --CurrentSongIndex : 0;
         //UpdateMetaLabels(); // FIXME
     }
     SongSelectionMovement.SongMovementAfter(CurrentSongIndex, CurrentFolderIndex, CurrentLevelIndex);
 }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (!init)
        {
            return;
        }

        // Wait until the scene is fully loaded
        if (!transitionFinished)
        {
            return;
        }

        // Always draw cards (this has to happen before the loading screen slides open)
        if (SongSelection.Songlist.Count > 0)
        {
            Util.TranslateRawImage(ref backgroundImage, Globals.BackgroundOffset);
            if (SongSelection.SelectedFolderIndex == -1)
            {
                folderCards.SetActive(true);
                levelCards.SetActive(false);
                songCards.SetActive(false);
                UpdateMetadata(false);
                UpdateLoopedSong(true);

                for (int i = 0; i < folderCards.Count; i++)
                {
                    folderCards[i].Shift(i, SongSelection.CurrentFolderIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y);
                }
            }
            else
            {
                if (SongSelection.FolderParams[SongSelection.SelectedFolderIndex].Type == SortType.Level && SongSelection.SelectedLevelIndex == -1)
                {
                    folderCards.SetActive(false);
                    levelCards.SetActive(true);
                    songCards.SetActive(false);
                    UpdateMetadata(false);
                    UpdateLoopedSong(true);

                    for (int i = 0; i < levelCards.Count; i++)
                    {
                        levelCards[i].Shift(i, SongSelection.CurrentLevelIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y);
                    }
                }
                else
                {
                    folderCards.SetActive(false);
                    levelCards.SetActive(false);
                    songCards.SetActive(true);
                    UpdateMetadata(true);
                    UpdateLoopedSong(false);

                    for (int i = 0; i < SongSelection.Songlist.Count; i++)
                    {
                        var card = songCards.FirstOrDefault(x => ((SongCard)x).SongID == SongSelection.Songlist[i].SongID);

                        card.Shift(i, SongSelection.CurrentSongIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y);
                        int diff = i == SongSelection.CurrentSongIndex ? SongSelection.CurrentSongLevelIndex : -1;
                        ((SongCard)card).SetDifficulty(diff);
                    }
                }
            }
        }

        this.transform.Find("AutoModeText").gameObject.SetActive(GameState.CurrentSettings.AutoSetting != Settings.AutoMode.Off);

        float ratio;

        switch (GameState.TransitionState)
        {
        case TransitionState.LeavingLoadScreen:
            ratio = DrawLoadingScreenTransition(false);
            if (ratio >= 1.0f)
            {
                GameState.TransitionState = TransitionState.ScreenActive;
                GameState.GameMode        = Mode.SongSelect;
            }
            break;

        case TransitionState.ScreenActive:
            transitionStartTime = -1;
            break;

        case TransitionState.EnteringLoadingScreen:
            ratio = DrawLoadingScreenTransition(true);
            if (ratio <= 0.0f)
            {
                GameState.TransitionState = TransitionState.SwitchingScreens;
                loadStarted = false;
            }
            break;

        case TransitionState.SwitchingScreens:
            if (!loadStarted)
            {
                Globals.CurrentNoteCollection = new NoteCollection(SongSelection.GetSelectedMetadata());
                Globals.CurrentSongMetadata   = Globals.CurrentNoteCollection.ParseFile();

                // If music is currently looping, cease it now.
                Globals.MusicManager.EndSongLoop(this);

                Globals.MusicManager.LoadSong(Globals.CurrentSongMetadata.FilePath + Globals.CurrentSongMetadata.SongFilename, Globals.CurrentSongMetadata.BpmEvents);
                Globals.MusicManager.Offset = Globals.CurrentSongMetadata.PlaybackOffset * 1000;

                StartCoroutine(Util.SwitchSceneAsync());
                loadStarted = true;
            }
            break;

        default:
            break;
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        // Prevent inputs while the game is transitioning between screens or cards
        if (GameState.TransitionState == TransitionState.EnteringLoadingScreen ||
            GameState.TransitionState == TransitionState.LeavingLoadScreen)
        {
            return;
        }

        // Prevent inputs while the menus are animating
        if (SongSelectionMovement.IsAnimating())
        {
            SongSelectionMovement.IncrementFrame(); // increment by one frame
            return;
        }

        if (Input.GetButtonDown("Down"))
        {
            SongSelection.ScrollDown();
        }
        else if (Input.GetButtonDown("Up"))
        {
            SongSelection.ScrollUp();
        }
        else if (Input.GetButtonDown("Left"))
        {
            SongSelection.GoBack();
        }
        else if (Input.GetButtonDown("Right"))
        {
            SongSelection.CycleDifficulty();
        }
        else if (Input.GetButtonDown("Auto"))
        {
            switch (GameState.CurrentSettings.AutoSetting)
            {
            case Settings.AutoMode.Off:
                GameState.CurrentSettings.AutoSetting = Settings.AutoMode.Auto;
                break;

            case Settings.AutoMode.Auto:
                GameState.CurrentSettings.AutoSetting = Settings.AutoMode.Off;
                break;

            case Settings.AutoMode.AutoDown:
                break;

            default:
                break;
            }
        }
        else if (Input.GetButtonDown("Select"))
        {
            if (SongSelection.Select())
            {
                GameState.TransitionState = TransitionState.EnteringLoadingScreen;
                GameState.Destination     = Mode.GamePlay;
            }
        }
        else if (Input.GetButtonDown("GameSettings"))
        {
            GameState.TransitionState = TransitionState.EnteringLoadingScreen;
            GameState.Destination     = Mode.GameSettings;
        }
    }