Ejemplo n.º 1
0
        protected override void InitializeReplay()
        {
            replayOverlay = new ReplayOverlay(this);
            replayOverlay.Initialize();

            //Reset some replay vars.
            GameBase.TestMode         = false;
            InputManager.ReplayModeFF = ReplaySpeed.Normal;
            InputManager.ReplayFrame  = 0;

            InputManager.ResetButtons();

            if (!InputManager.ReplayStreaming)
            {
                StreamingManager.Reset();
            }

            if (InputManager.ReplayStartTime > 0)
            {
                //Streaming score uses replayscore for all scoring.
                currentScore = InputManager.ReplayScore;

                //Initialize a new hpgraph since we don't receive this in replay data.
                currentScore.HpGraph   = new List <Vector2>();
                currentScore.HitErrors = new List <int>(BeatmapManager.Current.ObjectCount);

                ResetScore(hitObjectManager.Beatmap);
            }

            //Fixes a bug that is hard-recorded into many replays where the first two invisible-mouse frames are the wrong way around.
            if (InputManager.ReplayScore.Replay.Count >= 2 && InputManager.ReplayScore.Replay[1].time < InputManager.ReplayScore.Replay[0].time)
            {
                InputManager.ReplayScore.Replay[1].time = InputManager.ReplayScore.Replay[0].time;
                InputManager.ReplayScore.Replay[0].time = 0;
            }

            //Fixes a bug that is hard-recorded into many replays where the first two invisible-mouse frames are happening after the replay started (if the replay starts before 0)
            if (InputManager.ReplayScore.Replay.Count >= 3 && InputManager.ReplayScore.Replay[0].time > InputManager.ReplayScore.Replay[2].time)
            {
                InputManager.ReplayScore.Replay[0].time = InputManager.ReplayScore.Replay[1].time = InputManager.ReplayScore.Replay[2].time;
            }

            Debug.Print("Replay has " + InputManager.ReplayScore.Replay.Count + " frames");
            Debug.Print("Replay has " +
                        InputManager.ReplayScore.Replay.FindAll(f => f.mouseLeft || f.mouseRight).Count +
                        " mousedown frames");
        }