Exemplo n.º 1
0
        private void RewindScore(int destinationBeat)
        {
            ScoreListItem scoreListItem;

            // Loop through and log the data for all scores saved in the scoresDict
            String message = "\n";

            foreach (int key in scoresDict.Keys)
            {
                scoreListItem = scoresDict[key];
                message       = message + "key: " + key
                                + " scoreListItem baseScore:" + scoreListItem.baseScore
                                + " previousScore:" + scoreListItem.previousScore
                                + " multiplier:" + scoreListItem.multiplier
                                + " multiplierIncreaseProgress:" + scoreListItem.multiplierIncreaseProgress
                                + " multiplierIncreaseMaxProgress:" + scoreListItem.multiplierIncreaseMaxProgress
                                + " combo:" + scoreListItem.combo
                                + " maxCombo:" + scoreListItem.maxCombo
                                + " playerHeadWasInObstacle:" + scoreListItem.playerHeadWasInObstacle
                                + "\n";
            }

            Log(message);

            // Get the score at the destination beat
            scoreListItem = scoresDict[destinationBeat];

            Log("destinationBeat: " + destinationBeat
                + " scoreListItem baseScore:" + scoreListItem.baseScore
                + " previousScore:" + scoreListItem.previousScore
                + " multiplier:" + scoreListItem.multiplier
                + " multiplierIncreaseProgress:" + scoreListItem.multiplierIncreaseProgress
                + " multiplierIncreaseMaxProgress:" + scoreListItem.multiplierIncreaseMaxProgress
                + " combo:" + scoreListItem.combo
                + " maxCombo:" + scoreListItem.maxCombo
                + " playerHeadWasInObstacle:" + scoreListItem.playerHeadWasInObstacle
                + "\n");

            // Get the score data at the destination beat
            ReflectionUtil.SetPrivateField(scoreController, "_baseScore", scoreListItem.baseScore);
            ReflectionUtil.SetPrivateField(scoreController, "_prevFrameScore", scoreListItem.previousScore); // <-------- Trying to force scoreDidChangeEvent
            ReflectionUtil.SetPrivateField(scoreController, "_multiplier", scoreListItem.multiplier);
            ReflectionUtil.SetPrivateField(scoreController, "_multiplierIncreaseProgress", scoreListItem.multiplierIncreaseProgress);
            ReflectionUtil.SetPrivateField(scoreController, "_multiplierIncreaseMaxProgress", scoreListItem.multiplierIncreaseMaxProgress);
            ReflectionUtil.SetPrivateField(scoreController, "_combo", scoreListItem.combo);
            ReflectionUtil.SetPrivateField(scoreController, "_maxCombo", scoreListItem.maxCombo);
            ReflectionUtil.SetPrivateField(scoreController, "_playerHeadWasInObstacle", scoreListItem.playerHeadWasInObstacle);
            ReflectionUtil.SetPrivateField(scoreController, "_afterCutScoreBuffers", scoreListItem.afterCutScoreBuffers);

            // Trigger the scoreController's late update to unsure a scoreDidChangeEvent
            scoreController.LateUpdate();
        }
Exemplo n.º 2
0
        private void Rewind(int destinationBeat)
        {
            previousBeat = destinationBeat;

            var destinationTime = destinationBeat * 60f / gameSongController.beatsPerMinute; // Convert beats to time in sec

            Log("Rewinding to beat:" + destinationBeat + " at time:" + destinationTime);

            DeleteExistingNotes();

            WalkBackIndexes(destinationTime);

            _songAudio.timeSamples = (int)(destinationTime * sampleRate);                                  // Rewind the audio file
            ReflectionUtil.SetPrivateField(_audioTimeSync, "_prevAudioSamplePos", _songAudio.timeSamples); // This must be set or song will end instantly

            RewindScore(destinationBeat);
        }