예제 #1
0
        private static void AddStillFrame(string stillFrame)
        {
            string animatedVersion = stillFrame.Insert(stillFrame.IndexOf("."), "-{n}");

            if (skinConditions.Any(condition => condition.elementNames.Contains(animatedVersion)))
            {
                AddElement(stillFrame, beatmapSet => !beatmapSet.songFilePaths.Any(
                               path => IsAnimationFrameOf(PathStatic.CutPath(path), animatedVersion)));
            }
        }
예제 #2
0
        private static void Initialize()
        {
            // modes, doing or-gates on standard for everything because conversions
            AddElements(skinGeneral);
            AddElements(skinStandard, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap => beatmap.generalSettings.mode == Beatmap.Mode.Standard
                            ));
            AddElements(skinCatch, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            beatmap.generalSettings.mode == Beatmap.Mode.Catch ||
                            beatmap.generalSettings.mode == Beatmap.Mode.Standard
                            ));
            AddElements(skinMania, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            beatmap.generalSettings.mode == Beatmap.Mode.Mania ||
                            beatmap.generalSettings.mode == Beatmap.Mode.Standard
                            ));
            AddElements(skinTaiko, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            beatmap.generalSettings.mode == Beatmap.Mode.Taiko ||
                            beatmap.generalSettings.mode == Beatmap.Mode.Standard
                            ));
            AddElements(skinNotMania, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap => beatmap.generalSettings.mode != Beatmap.Mode.Mania
                            ));

            // TODO: Taiko skin conversion, see issue #6

            /*AddElements(mSkinTaiko, beatmapSet => beatmapSet.mBeatmaps.Any(
             *  beatmap => beatmap.mGeneralSettings.mMode == Beatmap.Mode.Taiko
             || beatmap.mGeneralSettings.mMode == Beatmap.Mode.Standard));*/

            // only used in specific cases
            AddElements(skinCountdown, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap => beatmap.generalSettings.countdown > 0
                            ));
            AddElement("reversearrow.png", beatmapSet => beatmapSet.beatmaps.Any(
                           beatmap => beatmap.hitObjects.Any(hitObject => (hitObject as Slider)?.edgeAmount > 1)
                           ));
            AddElements(skinBreak, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap => beatmap.breaks.Any()
                            ));

            // sliders
            AddElements(skinStandardSlider, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            beatmap.generalSettings.mode == Beatmap.Mode.Standard &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Slider)
                            ));
            AddElements(skinTaikoSlider, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            (beatmap.generalSettings.mode == Beatmap.Mode.Taiko ||
                             beatmap.generalSettings.mode == Beatmap.Mode.Standard) &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Slider)
                            ));
            AddElements(skinCatchSlider, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            (beatmap.generalSettings.mode == Beatmap.Mode.Catch ||
                             beatmap.generalSettings.mode == Beatmap.Mode.Standard) &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Slider)
                            ));

            // spinners
            AddElements(skinStandardSpinner, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            beatmap.generalSettings.mode == Beatmap.Mode.Standard &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Spinner)
                            ));
            AddElements(skinTaikoSpinner, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            (beatmap.generalSettings.mode == Beatmap.Mode.Taiko ||
                             beatmap.generalSettings.mode == Beatmap.Mode.Standard) &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Spinner)
                            ));
            AddElements(skinCatchSpinner, beatmapSet => beatmapSet.beatmaps.Any(
                            beatmap =>
                            (beatmap.generalSettings.mode == Beatmap.Mode.Catch ||
                             beatmap.generalSettings.mode == Beatmap.Mode.Standard) &&
                            beatmap.hitObjects.Any(hitObject => hitObject is Spinner)
                            ));

            // depending on other skin elements
            AddElements(skinNotSliderb, beatmapSet => !beatmapSet.songFilePaths.Any(
                            path => PathStatic.CutPath(path) == "sliderb.png"));
            AddElement("particle50.png", beatmapSet => beatmapSet.songFilePaths.Any(
                           path => PathStatic.CutPath(path) == "hit50.png"));
            AddElement("particle100.png", beatmapSet => beatmapSet.songFilePaths.Any(
                           path => PathStatic.CutPath(path) == "hit100.png"));
            AddElement("particle300.png", beatmapSet => beatmapSet.songFilePaths.Any(
                           path => PathStatic.CutPath(path) == "hit300.png"));

            // animatable elements (animation takes priority over still frame)
            foreach (SkinCondition skinCondition in skinConditions.ToList())
            {
                foreach (string elementName in skinCondition.elementNames)
                {
                    if (elementName.Contains("-{n}"))
                    {
                        AddStillFrame(elementName.Replace("-{n}", ""));
                    }
                }
            }

            isInitialized = true;
        }