示例#1
0
        private Background createBackground()
        {
            // seasonal background loading gets highest priority.
            Background newBackground = seasonalBackgroundLoader.LoadNextBackground();

            if (newBackground == null && user.Value?.IsSupporter == true)
            {
                switch (mode.Value)
                {
                case BackgroundSource.Beatmap:
                case BackgroundSource.BeatmapWithStoryboard:
                {
                    if (mode.Value == BackgroundSource.BeatmapWithStoryboard && AllowStoryboardBackground)
                    {
                        newBackground = new BeatmapBackgroundWithStoryboard(beatmap.Value, getBackgroundTextureName());
                    }
                    newBackground ??= new BeatmapBackground(beatmap.Value, getBackgroundTextureName());

                    break;
                }

                case BackgroundSource.Skin:
                    // default skins should use the default background rotation, which won't be the case if a SkinBackground is created for them.
                    if (skin.Value is DefaultSkin || skin.Value is DefaultLegacySkin)
                    {
                        break;
                    }

                    newBackground = new SkinBackground(skin.Value, getBackgroundTextureName());
                    break;
                }
            }

            // this method is called in many cases where the background might not necessarily need to change.
            // if an equivalent background is currently being shown, we don't want to load it again.
            if (newBackground?.Equals(background) == true)
            {
                return(background);
            }

            newBackground ??= new Background(getBackgroundTextureName());
            newBackground.Depth = currentDisplay;

            return(newBackground);
        }
示例#2
0
        private Background createBackground()
        {
            // seasonal background loading gets highest priority.
            Background newBackground = seasonalBackgroundLoader.LoadNextBackground();

            if (newBackground == null && user.Value?.IsSupporter == true)
            {
                switch (mode.Value)
                {
                case BackgroundSource.Beatmap:
                case BackgroundSource.BeatmapWithStoryboard:
                {
                    if (mode.Value == BackgroundSource.BeatmapWithStoryboard && AllowStoryboardBackground)
                    {
                        newBackground = new BeatmapBackgroundWithStoryboard(beatmap.Value, getBackgroundTextureName());
                    }
                    newBackground ??= new BeatmapBackground(beatmap.Value, getBackgroundTextureName());

                    // this method is called in many cases where the beatmap hasn't changed (ie. on screen transitions).
                    // if a background is already displayed for the requested beatmap, we don't want to load it again.
                    if (background?.GetType() == newBackground.GetType() &&
                        (background as BeatmapBackground)?.Beatmap == beatmap.Value)
                    {
                        return(background);
                    }

                    break;
                }
                }
            }

            newBackground ??= new Background(getBackgroundTextureName());
            newBackground.Depth = currentDisplay;

            return(newBackground);
        }