Example #1
0
        protected override void OnSelected(InputState state)
        {
            if (player != null)
            {
                return;
            }

            if (state?.Keyboard.ControlPressed == true)
            {
                var auto     = Ruleset.Value.CreateInstance().GetAutoplayMod();
                var autoType = auto.GetType();

                var mods = modSelect.SelectedMods.Value;
                if (mods.All(m => m.GetType() != autoType))
                {
                    modSelect.SelectedMods.Value = mods.Concat(new[] { auto });
                    removeAutoModOnResume        = true;
                }
            }

            Beatmap.Value.Track.Looping = false;
            Beatmap.Disabled            = true;

            LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
        }
Example #2
0
        protected override bool OnStart()
        {
            if (player != null)
            {
                return(false);
            }

            // Ctrl+Enter should start map with autoplay enabled.
            if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
            {
                var auto     = Ruleset.Value.CreateInstance().GetAutoplayMod();
                var autoType = auto.GetType();

                var mods = Mods.Value;

                if (mods.All(m => m.GetType() != autoType))
                {
                    Mods.Value            = mods.Append(auto).ToArray();
                    removeAutoModOnResume = true;
                }
            }

            Beatmap.Value.Track.Looping = false;

            SampleConfirm?.Play();

            this.Push(player = new PlayerLoader(() => new Player()));

            return(true);
        }
Example #3
0
        private void setTarget(OsuScreen target)
        {
            if (target == null)
            {
                return;
            }

            Debug.Assert(skinEditor != null);

            if (!target.IsLoaded)
            {
                Scheduler.AddOnce(setTarget, target);
                return;
            }

            if (skinEditor.State.Value == Visibility.Visible)
            {
                skinEditor.UpdateTargetScreen(target);
            }
            else
            {
                skinEditor.Hide();
                skinEditor.Expire();
                skinEditor = null;
            }
        }
Example #4
0
        private void screenChanged(Screen newScreen)
        {
            currentScreen = newScreen as OsuScreen;

            if (currentScreen == null)
            {
                Exit();
                return;
            }

            //central game mode change logic.
            if (!currentScreen.ShowOverlays)
            {
                options.State         = Visibility.Hidden;
                Toolbar.State         = Visibility.Hidden;
                musicController.State = Visibility.Hidden;
                chat.State            = Visibility.Hidden;
            }
            else
            {
                Toolbar.State = Visibility.Visible;
            }

            ScreenChanged?.Invoke(newScreen);
        }
Example #5
0
        private void screenChanged(Screen newScreen)
        {
            currentScreen = newScreen as OsuScreen;

            if (currentScreen == null)
            {
                Exit();
                return;
            }

            //central game screen change logic.
            if (!currentScreen.ShowOverlays)
            {
                foreach (var container in overlayContainers(true))
                {
                    container.State = Visibility.Hidden;
                }
            }
            else
            {
                Toolbar.State = Visibility.Visible;
            }

            ScreenChanged?.Invoke(newScreen);
        }
Example #6
0
File: OsuGame.cs Project: mist9/osu
        private void screenChanged(Screen newScreen)
        {
            currentScreen = newScreen as OsuScreen;

            if (currentScreen == null)
            {
                Exit();
                return;
            }

            //central game screen change logic.
            if (!currentScreen.ShowOverlays)
            {
                settings.State        = Visibility.Hidden;
                Toolbar.State         = Visibility.Hidden;
                musicController.State = Visibility.Hidden;
                chat.State            = Visibility.Hidden;
                direct.State          = Visibility.Hidden;
                social.State          = Visibility.Hidden;
                userProfile.State     = Visibility.Hidden;
            }
            else
            {
                Toolbar.State = Visibility.Visible;
            }

            ScreenChanged?.Invoke(newScreen);
        }
Example #7
0
        private void screenAdded(Screen newScreen)
        {
            currentScreen = (OsuScreen)newScreen;

            newScreen.ModePushed += screenAdded;
            newScreen.Exited     += screenRemoved;
        }
Example #8
0
        protected override void Start()
        {
            if (player != null)
            {
                return;
            }

            // Ctrl+Enter should start map with autoplay enabled.
            if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
            {
                var auto     = Ruleset.Value.CreateInstance().GetAutoplayMod();
                var autoType = auto.GetType();

                var mods = modSelect.SelectedMods.Value;
                if (mods.All(m => m.GetType() != autoType))
                {
                    modSelect.SelectedMods.Value = mods.Concat(new[] { auto });
                    removeAutoModOnResume        = true;
                }
            }

            Beatmap.Value.Track.Looping = false;
            Beatmap.Disabled            = true;

            sampleConfirm?.Play();

            LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
        }
Example #9
0
        protected override bool OnStart()
        {
            if (player != null) return false;

            // Ctrl+Enter should start map with autoplay enabled.
            if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
            {
                var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
                var autoType = auto.GetType();

                var mods = SelectedMods.Value;
                if (mods.All(m => m.GetType() != autoType))
                {
                    SelectedMods.Value = mods.Append(auto);
                    removeAutoModOnResume = true;
                }
            }

            Beatmap.Value.Track.Looping = false;
            Beatmap.Disabled = true;

            SampleConfirm?.Play();

            LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
            {
                if (this.IsCurrentScreen())this.Push(player);
            });

            return true;
        }
Example #10
0
        private void screenAdded(Screen newScreen)
        {
            currentScreen = (OsuScreen)newScreen;
            Logger.Log($"Screen changed → {currentScreen}");

            newScreen.ModePushed += screenAdded;
            newScreen.Exited     += screenRemoved;
        }
Example #11
0
 protected void LoadScreen(OsuScreen screen)
 {
     if (stack.CurrentScreen != null)
     {
         stack.Exit();
     }
     stack.Push(screen);
 }
Example #12
0
        private void screenAdded(Screen newScreen)
        {
            currentSubScreen = (OsuScreen)newScreen;
            updatePollingRate(isIdle.Value);

            newScreen.ModePushed += screenAdded;
            newScreen.Exited     += screenRemoved;
        }
Example #13
0
        protected override void OnResuming(Screen last)
        {
            player = null;

            Beatmap.Value.Track.Looping = true;

            base.OnResuming(last);
        }
Example #14
0
        public void OnResuming(IScreen last)
        {
            this.FadeIn(250);
            this.ScaleTo(1, 250, Easing.OutSine);

            logo?.AppendAnimatingAction(() => OsuScreen.ApplyLogoArrivingDefaults(logo), true);

            updatePollingRate(isIdle.Value);
        }
Example #15
0
        private void screenRemoved(Screen newScreen)
        {
            currentScreen = (OsuScreen)newScreen;

            if (newScreen == null)
            {
                Exit();
            }
        }
Example #16
0
        protected void PrepareMenuLoad()
        {
            nextScreen = createNextScreen?.Invoke();

            if (nextScreen != null)
            {
                LoadComponentAsync(nextScreen);
            }
        }
Example #17
0
        public override void OnResuming(ScreenTransitionEvent e)
        {
            base.OnResuming(e);

            if (playerLoader != null)
            {
                Mods.Value   = modsAtGameplayStart;
                playerLoader = null;
            }
        }
Example #18
0
        public override void OnResuming(IScreen last)
        {
            base.OnResuming(last);

            if (playerLoader != null)
            {
                Mods.Value   = modsAtGameplayStart;
                playerLoader = null;
            }
        }
Example #19
0
        private void screenRemoved(Screen newScreen)
        {
            if (currentSubScreen is MatchSubScreen)
            {
                cancelLooping();
            }

            currentSubScreen = (OsuScreen)newScreen;
            updatePollingRate(isIdle.Value);
        }
Example #20
0
        private void screenRemoved(Screen newScreen)
        {
            currentScreen = (OsuScreen)newScreen;
            Logger.Log($"Screen changed ← {currentScreen}");

            if (newScreen == null)
            {
                Exit();
            }
        }
Example #21
0
        protected override void OnSelected()
        {
            if (player != null)
            {
                return;
            }

            Beatmap.Value.Track.Looping = false;

            LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
        }
Example #22
0
        protected override void OnSelected()
        {
            if (player != null)
            {
                return;
            }

            (player = new PlayerLoader(new Player
            {
                Beatmap = Beatmap, //eagerly set this so it's present before push.
            })).LoadAsync(Game, l => Push(player));
        }
Example #23
0
        protected override void OnResuming(Screen last)
        {
            player = null;

            if (removeAutoModOnResume)
            {
                var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
                ModSelect.DeselectTypes(new[] { autoType }, true);
                removeAutoModOnResume = false;
            }

            base.OnResuming(last);
        }
Example #24
0
        protected override void OnResuming(Screen last)
        {
            player = null;

            changeBackground(Beatmap);
            ensurePlayingSelected();
            base.OnResuming(last);

            Content.FadeIn(250);

            Content.ScaleTo(1, 250, EasingTypes.OutSine);

            filter.Activate();
        }
Example #25
0
        protected override bool OnStart()
        {
            if (playerLoader != null)
            {
                return(false);
            }

            modsAtGameplayStart = Mods.Value;

            // Ctrl+Enter should start map with autoplay enabled.
            if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
            {
                var autoInstance = getAutoplayMod();

                if (autoInstance == null)
                {
                    notifications?.Post(new SimpleNotification
                    {
                        Text = "The current ruleset doesn't have an autoplay mod avalaible!"
                    });
                    return(false);
                }

                var mods = Mods.Value.Append(autoInstance).ToArray();

                if (!ModUtils.CheckCompatibleSet(mods, out var invalid))
                {
                    mods = mods.Except(invalid).Append(autoInstance).ToArray();
                }

                Mods.Value = mods;
            }

            SampleConfirm?.Play();

            this.Push(playerLoader = new PlayerLoader(createPlayer));
            return(true);

            Player createPlayer()
            {
                var replayGeneratingMod = Mods.Value.OfType <ICreateReplayData>().FirstOrDefault();

                if (replayGeneratingMod != null)
                {
                    return(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateScoreFromReplayData(beatmap, mods)));
                }

                return(new SoloPlayer());
            }
        }
Example #26
0
            public void LoadScreen(OsuScreen screen) => Schedule(() =>
            {
                nextScreen = screen;

                if (IsCurrentScreen)
                {
                    Push(screen);
                    nextScreen = null;
                }
                else
                {
                    MakeCurrent();
                }
            });
Example #27
0

        
Example #28
0
        protected override void OnResuming(Screen last)
        {
            player = null;

            if (removeAutoModOnResume)
            {
                var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
                modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
                removeAutoModOnResume        = false;
            }

            Beatmap.Value.Track.Looping = true;

            base.OnResuming(last);
        }
Example #29
0
        protected override bool OnStart()
        {
            if (playerLoader != null)
            {
                return(false);
            }

            // Ctrl+Enter should start map with autoplay enabled.
            if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
            {
                var autoInstance = getAutoplayMod();

                if (autoInstance == null)
                {
                    notifications?.Post(new SimpleNotification
                    {
                        Text = "The current ruleset doesn't have an autoplay mod avalaible!"
                    });
                    return(false);
                }

                var mods = Mods.Value;

                if (mods.All(m => m.GetType() != autoInstance.GetType()))
                {
                    Mods.Value            = mods.Append(autoInstance).ToArray();
                    removeAutoModOnResume = true;
                }
            }

            SampleConfirm?.Play();

            this.Push(playerLoader = new PlayerLoader(createPlayer));
            return(true);

            Player createPlayer()
            {
                var replayGeneratingMod = Mods.Value.OfType <ICreateReplay>().FirstOrDefault();

                if (replayGeneratingMod != null)
                {
                    return(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods)));
                }

                return(new SoloPlayer());
            }
        }
Example #30
0
        /// <summary>
        /// Set a new target screen which will be used to find skinnable components.
        /// </summary>
        public void SetTarget(OsuScreen screen)
        {
            lastTargetScreen = screen;

            if (skinEditor == null)
            {
                return;
            }

            skinEditor.Save();

            // ensure the toolbar is re-hidden even if a new screen decides to try and show it.
            updateComponentVisibility();

            // AddOnce with parameter will ensure the newest target is loaded if there is any overlap.
            Scheduler.AddOnce(setTarget, screen);
        }