Ejemplo n.º 1
0
        public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
        {
            switch (lookup)
            {
            case OsuSkinColour colour:
                return(source.GetConfig <SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour)));

            case OsuSkinConfiguration osuLookup:
                switch (osuLookup)
                {
                case OsuSkinConfiguration.SliderPathRadius:
                    if (hasHitCircle.Value)
                    {
                        return(SkinUtils.As <TValue>(new BindableFloat(LEGACY_CIRCLE_RADIUS)));
                    }

                    break;

                case OsuSkinConfiguration.HitCircleOverlayAboveNumber:
                    // See https://osu.ppy.sh/help/wiki/Skinning/skin.ini#%5Bgeneral%5D
                    // HitCircleOverlayAboveNumer (with typo) should still be supported for now.
                    return(source.GetConfig <OsuSkinConfiguration, TValue>(OsuSkinConfiguration.HitCircleOverlayAboveNumber) ??
                           source.GetConfig <OsuSkinConfiguration, TValue>(OsuSkinConfiguration.HitCircleOverlayAboveNumer));
                }

                break;
            }

            return(source.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 2
0
        private void onSkinChanged()
        {
            foreach (var col in columnFlow)
            {
                if (col.Index > 0)
                {
                    float spacing = currentSkin.GetConfig <ManiaSkinConfigurationLookup, float>(
                        new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.ColumnSpacing, col.Index - 1))
                                    ?.Value ?? COLUMN_SPACING;

                    col.Margin = new MarginPadding {
                        Left = spacing
                    };
                }

                float?width = currentSkin.GetConfig <ManiaSkinConfigurationLookup, float>(
                    new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.ColumnWidth, col.Index))
                              ?.Value;

                if (width == null)
                {
                    // only used by default skin (legacy skins get defaults set in LegacyManiaSkinConfiguration)
                    col.Width = col.IsSpecial ? Column.SPECIAL_COLUMN_WIDTH : Column.COLUMN_WIDTH;
                }
                else
                {
                    col.Width = width.Value;
                }
            }
        }
Ejemplo n.º 3
0
        public LegacyCatchComboCounter(ISkin skin)
        {
            var fontName    = skin.GetConfig <LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
            var fontOverlap = skin.GetConfig <LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;

            AutoSizeAxes = Axes.Both;

            Alpha  = 0f;
            Anchor = Anchor.Centre;
            Origin = Anchor.Centre;
            Scale  = new Vector2(0.8f);

            InternalChildren = new Drawable[]
            {
                explosion = new LegacyRollingCounter(skin, fontName, fontOverlap)
                {
                    Alpha    = 0.65f,
                    Blending = BlendingParameters.Additive,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Scale    = new Vector2(1.5f),
                },
                counter = new LegacyRollingCounter(skin, fontName, fontOverlap)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                },
            };
        }
Ejemplo n.º 4
0
 private void sourceChanged()
 {
     isLegacySkin  = new Lazy <bool>(() => source.GetConfig <LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
     hasKeyTexture = new Lazy <bool>(() => source.GetAnimation(
                                         GetConfig <ManiaSkinConfigurationLookup, string>(
                                             new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.KeyImage, 0))?.Value
                                         ?? "mania-key1", true, true) != null);
 }
        public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
        {
            switch (lookup)
            {
            case CatchSkinColour colour:
                return(source.GetConfig <SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour)));
            }

            return(source.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 6
0
        private void load()
        {
            var ballColour = skin.GetConfig <OsuSkinColour, Color4>(OsuSkinColour.SliderBall)?.Value ?? Color4.White;

            InternalChildren = new[]
            {
                layerNd = new Sprite
                {
                    Anchor  = Anchor.Centre,
                    Origin  = Anchor.Centre,
                    Texture = skin.GetTexture("sliderb-nd"),
                    Colour  = new Color4(5, 5, 5, 255),
                },
                LegacyColourCompatibility.ApplyWithDoubledAlpha(animationContent.With(d =>
                {
                    d.Anchor = Anchor.Centre;
                    d.Origin = Anchor.Centre;
                }), ballColour),
                layerSpec = new Sprite
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Texture  = skin.GetTexture("sliderb-spec"),
                    Blending = BlendingParameters.Additive,
                },
            };
        }
Ejemplo n.º 7
0
        private void load(OsuConfigManager config)
        {
            Texture       = skin.GetTexture("cursortrail");
            disjointTrail = skin.GetTexture("cursormiddle") == null;

            if (disjointTrail)
            {
                bool centre = skin.GetConfig <OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;

                TrailOrigin = centre ? Anchor.Centre : Anchor.TopLeft;
                Blending    = BlendingParameters.Inherit;
            }
            else
            {
                Blending = BlendingParameters.Additive;
            }

            if (Texture != null)
            {
                // stable "magic ratio". see OsuPlayfieldAdjustmentContainer for full explanation.
                Texture.ScaleAdjust *= 1.6f;
            }

            cursorSize = config.GetBindable <float>(OsuSetting.GameplayCursorSize).GetBoundCopy();
        }
Ejemplo n.º 8
0
        public static string GetFontPrefix(this ISkin source, LegacyFont font)
        {
            switch (font)
            {
            case LegacyFont.Score:
                return(source.GetConfig <LegacySetting, string>(LegacySetting.ScorePrefix)?.Value ?? "score");

            case LegacyFont.Combo:
                return(source.GetConfig <LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score");

            case LegacyFont.HitCircle:
                return(source.GetConfig <LegacySetting, string>(LegacySetting.HitCirclePrefix)?.Value ?? "default");

            default:
                throw new ArgumentOutOfRangeException(nameof(font));
            }
        }
Ejemplo n.º 9
0
        public static float GetFontOverlap(this ISkin source, LegacyFont font)
        {
            switch (font)
            {
            case LegacyFont.Score:
                return(source.GetConfig <LegacySetting, float>(LegacySetting.ScoreOverlap)?.Value ?? 0f);

            case LegacyFont.Combo:
                return(source.GetConfig <LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? 0f);

            case LegacyFont.HitCircle:
                return(source.GetConfig <LegacySetting, float>(LegacySetting.HitCircleOverlap)?.Value ?? -2f);

            default:
                throw new ArgumentOutOfRangeException(nameof(font));
            }
        }
        public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
        {
            if (AllowConfigurationLookup && skin != null)
            {
                var bindable = skin.GetConfig <TLookup, TValue>(lookup);
                if (bindable != null)
                {
                    return(bindable);
                }
            }

            return(fallbackSource?.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 11
0
        private IBindable <TValue> lookupWithFallback <TLookup, TValue>(TLookup lookup, bool canUseSkinLookup)
        {
            if (canUseSkinLookup)
            {
                var bindable = skin?.GetConfig <TLookup, TValue>(lookup);
                if (bindable != null)
                {
                    return(bindable);
                }
            }

            return(fallbackSource?.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 12
0
        private void load()
        {
            bool centre = skin.GetConfig <OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;

            spin = skin.GetConfig <OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;

            InternalChildren = new[]
            {
                ExpandTarget = new NonPlayfieldSprite
                {
                    Texture = skin.GetTexture("cursor"),
                    Anchor  = Anchor.Centre,
                    Origin  = centre ? Anchor.Centre : Anchor.TopLeft,
                },
                new NonPlayfieldSprite
                {
                    Texture = skin.GetTexture("cursormiddle"),
                    Anchor  = Anchor.Centre,
                    Origin  = centre ? Anchor.Centre : Anchor.TopLeft,
                },
            };
        }
        private static double getFrameLength(ISkin source, bool applyConfigFrameRate, Texture[] textures)
        {
            if (applyConfigFrameRate)
            {
                var iniRate = source.GetConfig<LegacySetting, int>(LegacySetting.AnimationFramerate);

                if (iniRate?.Value > 0)
                    return 1000f / iniRate.Value;

                return 1000f / textures.Length;
            }

            return default_frame_time;
        }
        public override IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
        {
            switch (lookup)
            {
            // Lookup skin by type and index
            case KaraokeSkinLookup skinLookup:
            {
                var config       = skinLookup.Config;
                var lookupNumber = skinLookup.Lookup;

                switch (config)
                {
                case KaraokeSkinConfiguration.LyricStyle:
                    return(SkinUtils.As <TValue>(bindableFonts[lookupNumber]));

                case KaraokeSkinConfiguration.LyricLayout:
                    return(SkinUtils.As <TValue>(bindableLayouts[lookupNumber]));

                case KaraokeSkinConfiguration.NoteStyle:
                    return(SkinUtils.As <TValue>(bindableNotes[lookupNumber]));

                case KaraokeSkinConfiguration.Singer:
                    return(SkinUtils.As <TValue>(bindableSingers[lookupNumber]));
                }

                break;
            }

            // Lookup list of name by type
            case KaraokeIndexLookup indexLookup:
                switch (indexLookup)
                {
                case KaraokeIndexLookup.Layout:
                    return(SkinUtils.As <TValue>(bindableLayoutsLookup));

                case KaraokeIndexLookup.Style:
                    return(SkinUtils.As <TValue>(bindableFontsLookup));

                case KaraokeIndexLookup.Note:
                    return(SkinUtils.As <TValue>(bindableNotesLookup));

                case KaraokeIndexLookup.Singer:
                    return(SkinUtils.As <TValue>(bindableSingersLookup));
                }

                break;
            }

            return(source.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 15
0
            public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
            {
                switch (lookup)
                {
                case GlobalSkinColours _:
                case SkinCustomColourLookup _:
                    if (provider.AllowColourLookup)
                    {
                        return(skin.GetConfig <TLookup, TValue>(lookup));
                    }

                    break;

                default:
                    if (provider.AllowConfigurationLookup)
                    {
                        return(skin.GetConfig <TLookup, TValue>(lookup));
                    }

                    break;
                }

                return(null);
            }
Ejemplo n.º 16
0
        public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup)
        {
            switch (lookup)
            {
            case OsuSkinColour colour:
                return(source.GetConfig <SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour)));

            case OsuSkinConfiguration osuLookup:
                switch (osuLookup)
                {
                case OsuSkinConfiguration.SliderPathRadius:
                    if (hasHitCircle.Value)
                    {
                        return(SkinUtils.As <TValue>(new BindableFloat(LEGACY_CIRCLE_RADIUS)));
                    }

                    break;
                }

                break;
            }

            return(source.GetConfig <TLookup, TValue>(lookup));
        }
Ejemplo n.º 17
0
        private static double getFrameLength(ISkin source, bool applyConfigFrameRate, Texture[] textures)
        {
            if (applyConfigFrameRate)
            {
                var iniRate = source.GetConfig <GlobalSkinConfiguration, int>(GlobalSkinConfiguration.AnimationFramerate);

                if (iniRate?.Value > 0)
                {
                    return(1000f / iniRate.Value);
                }

                return(1000f / textures.Length);
            }

            return(default_frame_time);
        }
Ejemplo n.º 18
0
        protected Texture GetTextureFromLookup(ISkin skin, LegacyManiaSkinConfigurationLookups lookup)
        {
            string suffix = string.Empty;

            switch (lookup)
            {
            case LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage:
                suffix = "H";
                break;

            case LegacyManiaSkinConfigurationLookups.HoldNoteTailImage:
                suffix = "T";
                break;
            }

            string noteImage = skin.GetConfig <LegacyManiaSkinConfigurationLookup, string>(
                new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, Column.Index))?.Value
                               ?? $"mania-note{FallbackColumnIndex}{suffix}";

            return(skin.GetTexture(noteImage));
        }
Ejemplo n.º 19
0
        private void handleColours(TextWriter writer)
        {
            var colours = skin?.GetConfig <GlobalSkinColours, IReadOnlyList <Color4> >(GlobalSkinColours.ComboColours)?.Value;

            if (colours == null || colours.Count == 0)
            {
                return;
            }

            writer.WriteLine("[Colours]");

            for (var i = 0; i < colours.Count; i++)
            {
                var comboColour = colours[i];

                writer.Write(FormattableString.Invariant($"Combo{i}: "));
                writer.Write(FormattableString.Invariant($"{(byte)(comboColour.R * byte.MaxValue)},"));
                writer.Write(FormattableString.Invariant($"{(byte)(comboColour.G * byte.MaxValue)},"));
                writer.Write(FormattableString.Invariant($"{(byte)(comboColour.B * byte.MaxValue)},"));
                writer.Write(FormattableString.Invariant($"{(byte)(comboColour.A * byte.MaxValue)}"));
                writer.WriteLine();
            }
        }
Ejemplo n.º 20
0
 private void sourceChanged()
 {
     isLegacySkin = new Lazy <bool>(() => source.GetConfig <LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
 }
 /// <summary>
 /// Retrieve a per-column-count skin configuration.
 /// </summary>
 /// <param name="skin">The skin from which configuration is retrieved.</param>
 /// <param name="lookup">The value to retrieve.</param>
 /// <param name="index">If not null, denotes the index of the column to which the entry applies.</param>
 public static IBindable <T> GetManiaSkinConfig <T>(this ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int?index = null)
 => skin.GetConfig <ManiaSkinConfigurationLookup, T>(
     new ManiaSkinConfigurationLookup(lookup, index));
Ejemplo n.º 22
0
 /// <summary>
 /// Retrieve a per-column-count skin configuration.
 /// </summary>
 /// <param name="skin">The skin from which configuration is retrieved.</param>
 /// <param name="lookup">The value to retrieve.</param>
 /// <param name="index">If not null, denotes the index of the column to which the entry applies.</param>
 protected virtual IBindable <T> GetKaraokeSkinConfig <T>(ISkin skin, LegacyKaraokeSkinConfigurationLookups lookup, int?index = null)
 => skin.GetConfig <LegacyKaraokeSkinConfigurationLookup, T>(
     new LegacyKaraokeSkinConfigurationLookup(Playfield?.NotePlayfield.Columns ?? 4, lookup, index));
Ejemplo n.º 23
0
 /// <summary>
 /// Retrieve a per-column-count skin configuration.
 /// </summary>
 /// <param name="skin">The skin from which configuration is retrieved.</param>
 /// <param name="lookup">The value to retrieve.</param>
 /// <param name="index">If not null, denotes the index of the column to which the entry applies.</param>
 protected virtual IBindable <T> GetManiaSkinConfig <T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int?index = null)
 => skin.GetConfig <LegacyManiaSkinConfigurationLookup, T>(
     new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, index));
Ejemplo n.º 24
0
 public IBindable <TValue> GetConfig <TLookup, TValue>(TLookup lookup) => source.GetConfig <TLookup, TValue>(lookup);
Ejemplo n.º 25
0
 /// <summary>
 /// Retrieve a per-column-count skin configuration.
 /// </summary>
 /// <param name="skin">The skin from which configuration is retrieved.</param>
 /// <param name="lookup">The value to retrieve.</param>
 /// <param name="index">If not null, denotes the index of the column to which the entry applies.</param>
 protected virtual IBindable <T> GetManiaSkinConfig <T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int?index = null)
 => skin.GetConfig <ManiaSkinConfigurationLookup, T>(
     new ManiaSkinConfigurationLookup(lookup, index));