Beispiel #1
0
    private void UpdateSongFinishedStats()
    {
        List <SongStatistic> songStatistics = PlayerControllers
                                              .Select(playerController => new SongStatistic(playerController.PlayerProfile.Name,
                                                                                            playerController.PlayerProfile.Difficulty,
                                                                                            playerController.PlayerScoreController.TotalScore))
                                              .ToList();

        statistics.RecordSongFinished(SongMeta, songStatistics);
    }
Beispiel #2
0
    public void SkipToNextSentence()
    {
        double nextStartBeat = PlayerControllers.Select(it => it.GetNextStartBeat()).Min();

        if (nextStartBeat < 0)
        {
            return;
        }

        double targetPositionInMillis = BpmUtils.BeatToMillisecondsInSong(SongMeta, nextStartBeat) - 500;

        if (targetPositionInMillis > 0 && targetPositionInMillis > PositionInSongInMillis)
        {
            songAudioPlayer.PositionInSongInMillis = targetPositionInMillis;
        }
    }
Beispiel #3
0
    public void SkipToNextSentence()
    {
        double nextStartBeat = PlayerControllers.Select(it => it.GetNextStartBeat()).Min();

        if (nextStartBeat < 0)
        {
            return;
        }

        // For debugging, go fast to next lyrics. In production, give the player some time to prepare.
        double offsetInMillis         = Application.isEditor ? 500 : 1500;
        double targetPositionInMillis = BpmUtils.BeatToMillisecondsInSong(SongMeta, nextStartBeat) - offsetInMillis;

        if (targetPositionInMillis > 0 && targetPositionInMillis > PositionInSongInMillis)
        {
            songAudioPlayer.PositionInSongInMillis = targetPositionInMillis;
        }
    }
Beispiel #4
0
    public void SkipToNextSingableNote()
    {
        IEnumerable <int> nextSingableNotes = PlayerControllers
                                              .Select(it => it.GetNextSingableNote(CurrentBeat))
                                              .Where(nextSingableNote => nextSingableNote != null)
                                              .Select(nextSingableNote => nextSingableNote.StartBeat);

        if (nextSingableNotes.Count() <= 0)
        {
            return;
        }
        int nextStartBeat = nextSingableNotes.Min();

        // For debugging, go fast to next lyrics. In production, give the player some time to prepare.
        double offsetInMillis         = Application.isEditor ? 500 : 1500;
        double targetPositionInMillis = BpmUtils.BeatToMillisecondsInSong(SongMeta, nextStartBeat) - offsetInMillis;

        if (targetPositionInMillis > 0 && targetPositionInMillis > PositionInSongInMillis)
        {
            SkipToPositionInSong(targetPositionInMillis);
        }
    }
Beispiel #5
0
    public void OpenSongInEditor()
    {
        int maxBeatToScore = PlayerControllers
                             .Select(playerController => playerController.PlayerScoreController.NextBeatToScore)
                             .Max();

        SceneData.NextBeatToScore = Math.Max((int)CurrentBeat, maxBeatToScore);

        SceneData.PlayerProfileToScoreDataMap = new Dictionary <PlayerProfile, PlayerScoreControllerData>();
        foreach (PlayerController playerController in PlayerControllers)
        {
            SceneData.PlayerProfileToScoreDataMap.Add(playerController.PlayerProfile, playerController.PlayerScoreController.ScoreData);
        }

        SongEditorSceneData songEditorSceneData = new SongEditorSceneData();

        songEditorSceneData.PreviousSceneData      = SceneData;
        songEditorSceneData.PreviousScene          = EScene.SingScene;
        songEditorSceneData.PositionInSongInMillis = PositionInSongInMillis;
        songEditorSceneData.SelectedSongMeta       = SongMeta;
        SceneNavigator.Instance.LoadScene(EScene.SongEditorScene, songEditorSceneData);
    }