Beispiel #1
0
        protected override void OnEntering(GameMode last)
        {
            OsuGameMode lastOsu = last as OsuGameMode;

            BackgroundMode bg = CreateBackground();

            if (lastOsu?.Background != null)
            {
                if (bg == null || lastOsu.Background.Equals(bg))
                {
                    //we can keep the previous mode's background.
                    Background = lastOsu.Background;
                }
                else
                {
                    lastOsu.Background.Push(Background = bg);
                }
            }
            else if (bg != null)
            {
                AddInternal(new ParallaxContainer
                {
                    Depth    = float.MinValue,
                    Children = new[]
                    {
                        Background = bg
                    }
                });
            }

            base.OnEntering(last);
        }
Beispiel #2
0
        public override bool Push(GameMode mode)
        {
            OsuGameMode nextOsu = mode as OsuGameMode;

            if (nextOsu != null)
            {
                nextOsu.beatmap = beatmap;
            }

            return(base.Push(mode));
        }
Beispiel #3
0
        protected override bool OnExiting(GameMode next)
        {
            OsuGameMode nextOsu = next as OsuGameMode;

            if (Background != null && !Background.Equals(nextOsu?.Background))
            {
                if (nextOsu != null)
                {
                    //We need to use MakeCurrent in case we are jumping up multiple game modes.
                    nextOsu.Background.MakeCurrent();
                }
                else
                {
                    Background.Exit();
                }
            }

            return(base.OnExiting(next));
        }