Пример #1
0
        public void LoadScore([NotNull] Score score)
        {
            if (Score != null)
            {
                throw new InvalidOperationException($"Cannot load a new score on a {nameof(PlayerArea)} that has an existing score.");
            }

            Score = score;

            gameplayContent.Child = new PlayerIsolationContainer(beatmapManager.GetWorkingBeatmap(Score.ScoreInfo.BeatmapInfo), Score.ScoreInfo.Ruleset, Score.ScoreInfo.Mods)
            {
                RelativeSizeAxes = Axes.Both,
                Child            = stack = new OsuScreenStack
                {
                    Name = nameof(PlayerArea),
                }
            };

            stack.Push(new MultiSpectatorPlayerLoader(Score, () =>
            {
                var player = new MultiSpectatorPlayer(Score, GameplayClock);
                player.OnGameplayStarted += () => OnGameplayStarted?.Invoke();
                return(player);
            }));

            loadingLayer.Hide();
        }
Пример #2
0
 void StartGameplay()
 {
     if (player.GetComponent <PlayerMovement>().isGrounded)
     {
         OnGameplayStarted?.Invoke(this, EventArgs.Empty);
         CancelInvoke();
     }
 }
Пример #3
0
        public override void OnEntering(IScreen last)
        {
            base.OnEntering(last);

            if (!LoadedBeatmapSuccessfully)
            {
                return;
            }

            Alpha = 0;
            this
            .ScaleTo(0.7f)
            .ScaleTo(1, 750, Easing.OutQuint)
            .Delay(250)
            .FadeIn(250);

            ApplyToBackground(b =>
            {
                b.IgnoreUserSettings.Value = false;
                b.BlurAmount.Value         = 0;
                b.FadeColour(Color4.White, 250);

                // bind component bindables.
                b.IsBreakTime.BindTo(breakTracker.IsBreakTime);

                b.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);

                failAnimationLayer.Background = b;
            });

            HUDOverlay.IsBreakTime.BindTo(breakTracker.IsBreakTime);
            DimmableStoryboard.IsBreakTime.BindTo(breakTracker.IsBreakTime);

            DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);

            storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;

            foreach (var mod in GameplayState.Mods.OfType <IApplicableToPlayer>())
            {
                mod.ApplyToPlayer(this);
            }

            foreach (var mod in GameplayState.Mods.OfType <IApplicableToHUD>())
            {
                mod.ApplyToHUD(HUDOverlay);
            }

            // Our mods are local copies of the global mods so they need to be re-applied to the track.
            // This is done through the music controller (for now), because resetting speed adjustments on the beatmap track also removes adjustments provided by DrawableTrack.
            // Todo: In the future, player will receive in a track and will probably not have to worry about this...
            musicController.ResetTrackAdjustments();
            foreach (var mod in GameplayState.Mods.OfType <IApplicableToTrack>())
            {
                mod.ApplyToTrack(musicController.CurrentTrack);
            }

            updateGameplayState();

            GameplayClockContainer.FadeInFromZero(750, Easing.OutQuint);

            StartGameplay();
            OnGameplayStarted?.Invoke();
        }