Esempio n. 1
0
        protected Sprite GetSpriteFromLookup(ISkin skin, LegacyKaraokeSkinConfigurationLookups lookup, LegacyKaraokeSkinNoteLayer layer)
        {
            var name = GetTextureNameFromLookup(lookup, layer);

            switch (layer)
            {
            case LegacyKaraokeSkinNoteLayer.Background:
            case LegacyKaraokeSkinNoteLayer.Border:
                return(getSpriteByName(name) ?? new Sprite());

            case LegacyKaraokeSkinNoteLayer.Foreground:
                return(getSpriteByName(name)
                       ?? getSpriteByName(GetTextureNameFromLookup(lookup, LegacyKaraokeSkinNoteLayer.Background))
                       ?? new Sprite());

            default:
                return(null);
            }

            Sprite getSpriteByName(string spriteName) => (Sprite)skin.GetAnimation(spriteName, true, true).With(d =>
            {
                switch (d)
                {
                case null:
                    return;

                case TextureAnimation animation:
                    animation.IsPlaying = false;
                    break;
                }
            });
        }
 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);
 }
Esempio n. 3
0
        protected Drawable GetAnimationFromLookup(ISkin skin, LegacyManiaSkinConfigurationLookups lookup)
        {
            string suffix = string.Empty;

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

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

            string noteImage = GetColumnSkinConfig <string>(skin, lookup)?.Value
                               ?? $"mania-note{FallbackColumnIndex}{suffix}";

            return(skin.GetAnimation(noteImage, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true));
        }
Esempio n. 4
0
            protected LegacyFill(ISkin skin)
            {
                // required for sizing correctly..
                var firstFrame = getTexture(skin, "colour-0");

                if (firstFrame == null)
                {
                    InternalChild = new Sprite {
                        Texture = getTexture(skin, "colour")
                    };
                    Size = InternalChild.Size;
                }
                else
                {
                    InternalChild = skin.GetAnimation("scorebar-colour", true, true, startAtCurrentTime: false, applyConfigFrameRate: true) ?? Empty();
                    Size          = new Vector2(firstFrame.DisplayWidth, firstFrame.DisplayHeight);
                }

                Masking = true;
            }
Esempio n. 5
0
 public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-",
                                     bool startAtCurrentTime = true, double?frameLength = null)
 => source.GetAnimation(componentName, default, default, animatable, looping, applyConfigFrameRate, animationSeparator, startAtCurrentTime, frameLength);
 private bool animationExist(params string[] textureNames)
 => textureNames.All(x => source.GetAnimation(x, true, false) != null);