private void load(ISkinSource skin, DrawableHitObject drawableHitObject)
        {
            Drawable getDrawableFor(string lookup)
            {
                const string normal_hit = "taikohit";
                const string big_hit    = "taikobig";

                string prefix = ((drawableHitObject.HitObject as TaikoStrongableHitObject)?.IsStrong ?? false) ? big_hit : normal_hit;

                return(skin.GetAnimation($"{prefix}{lookup}", true, false) ??
                       // fallback to regular size if "big" version doesn't exist.
                       skin.GetAnimation($"{normal_hit}{lookup}", true, false));
            }

            // backgroundLayer is guaranteed to exist due to the pre-check in TaikoLegacySkinTransformer.
            AddInternal(backgroundLayer = getDrawableFor("circle"));

            var foregroundLayer = getDrawableFor("circleoverlay");

            if (foregroundLayer != null)
            {
                AddInternal(foregroundLayer);
            }

            // Animations in taiko skins are used in a custom way (>150 combo and animating in time with beat).
            // For now just stop at first frame for sanity.
            foreach (var c in InternalChildren)
            {
                (c as IFramedAnimation)?.Stop();

                c.Anchor = Anchor.Centre;
                c.Origin = Anchor.Centre;
            }
        }
Esempio n. 2
0
 private void load(ISkinSource skin)
 {
     InternalChild = skin.GetAnimation(@"fruit-ryuuta", true, true, true).With(d =>
     {
         d.Anchor           = Anchor.TopCentre;
         d.Origin           = Anchor.TopCentre;
         d.RelativeSizeAxes = Axes.Both;
         d.Size             = Vector2.One;
         d.FillMode         = FillMode.Fit;
     });
 }
Esempio n. 3
0
        private void load(ISkinSource skin)
        {
            foreach (var state in Enum.GetValues(typeof(CatcherAnimationState)).Cast <CatcherAnimationState>())
            {
                AddInternal(drawables[state] = getDrawableFor(state).With(d =>
                {
                    d.Anchor           = Anchor.TopCentre;
                    d.Origin           = Anchor.TopCentre;
                    d.RelativeSizeAxes = Axes.Both;
                    d.Size             = Vector2.One;
                    d.FillMode         = FillMode.Fit;
                    d.Alpha            = 0;
                }));
            }

            currentDrawable = drawables[CatcherAnimationState.Idle];

            Drawable getDrawableFor(CatcherAnimationState state) =>
            skin.GetAnimation(@$ "fruit-catcher-{state.ToString().ToLowerInvariant()}", true, true, true) ??
            skin.GetAnimation(@"fruit-catcher-idle", true, true, true);
        }
Esempio n. 4
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string imageName = GetManiaSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.ExplosionImage)?.Value
                               ?? "lightingN";

            float explosionScale = GetManiaSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.ExplosionScale)?.Value
                                   ?? 1;

            // Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
            // This animation is discarded and re-queried with the appropriate frame length afterwards.
            var    tmp         = skin.GetAnimation(imageName, true, false);
            double frameLength = 0;

            if (tmp is IAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
            {
                frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
            }

            explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true, frameLength: frameLength).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                d.Origin   = Anchor.Centre;
                d.Blending = BlendingParameters.Additive;
                d.Scale    = new Vector2(explosionScale);
            });

            if (explosion != null)
            {
                InternalChild = explosion;
            }

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Esempio n. 5
0
            public LegacyOldStyleFill(ISkinSource 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) ?? Drawable.Empty();
                    Size          = new Vector2(firstFrame.DisplayWidth, firstFrame.DisplayHeight);
                }

                Position = new Vector2(3, 10) * 1.6f;
                Masking  = true;
            }
Esempio n. 6
0
        private void load(ISkinSource skin)
        {
            var animated = skin.GetConfig <TauSkinConfiguration, bool>(TauSkinConfiguration.AnimateKiai)?.Value ?? false;

            if (animated)
            {
                var container = new Container
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Child  = skin.GetAnimation($"{TauRuleset.SHORT_NAME}-kiai" + (circular ? "-big" : string.Empty), true, false, true).With(a =>
                    {
                        a.FillMode         = FillMode.Fit;
                        a.RelativeSizeAxes = Axes.Both;
                    }),
                    Clock = new FramedClock()
                };

                if (circular)
                {
                    container.RelativeSizeAxes = Axes.Both;
                }
                else
                {
                    container.Size = new Vector2(RNG.NextSingle(25, 25));
                }

                container.Delay(1500).Expire();

                AddInternal(container);
            }
            else
            {
                AddInternal(new KiaiHitExplosionEmitter(colour, circular, inversed, particleAmount)
                {
                    Angle = Angle
                });
            }
        }
Esempio n. 7
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string bottomImage = skin.GetManiaSkinConfig <string>(LegacyManiaSkinConfigurationLookups.BottomStageImage)?.Value
                                 ?? "mania-stage-bottom";

            sprite = skin.GetAnimation(bottomImage, true, true)?.With(d =>
            {
                if (d == null)
                {
                    return;
                }

                d.Scale = new Vector2(1.6f);
            });

            if (sprite != null)
            {
                InternalChild = sprite;
            }

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Esempio n. 8
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo, DrawableHitObject drawableObject)
        {
            string imageName = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage)?.Value
                               ?? $"mania-note{FallbackColumnIndex}L";

            sprite = skin.GetAnimation(imageName, true, true).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                if (d is TextureAnimation animation)
                {
                    animation.IsPlaying = false;
                }

                d.Anchor           = Anchor.TopCentre;
                d.RelativeSizeAxes = Axes.Both;
                d.Size             = Vector2.One;
                d.FillMode         = FillMode.Stretch;
                // Todo: Wrap
            });

            if (sprite != null)
            {
                InternalChild = sprite;
            }

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);

            var holdNote = (DrawableHoldNote)drawableObject;

            isHitting.BindTo(holdNote.IsHitting);
            isHitting.BindValueChanged(onIsHittingChanged, true);
        }
Esempio n. 9
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo, DrawableHitObject drawableObject)
        {
            holdNote = (DrawableHoldNote)drawableObject;

            string imageName = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage)?.Value
                               ?? $"mania-note{FallbackColumnIndex}L";

            string lightImage = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightImage)?.Value
                                ?? "lightingL";

            float lightScale = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightScale)?.Value
                               ?? 1;

            // Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
            // This animation is discarded and re-queried with the appropriate frame length afterwards.
            var    tmp         = skin.GetAnimation(lightImage, true, false);
            double frameLength = 0;

            if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
            {
                frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
            }

            light = skin.GetAnimation(lightImage, true, true, frameLength: frameLength).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                d.Origin   = Anchor.Centre;
                d.Blending = BlendingParameters.Additive;
                d.Scale    = new Vector2(lightScale);
            });

            if (light != null)
            {
                lightContainer = new HitTargetInsetContainer
                {
                    Alpha = 0,
                    Child = light
                };
            }

            bodySprite = skin.GetAnimation(imageName, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                if (d is TextureAnimation animation)
                {
                    animation.IsPlaying = false;
                }

                d.Anchor           = Anchor.TopCentre;
                d.RelativeSizeAxes = Axes.Both;
                d.Size             = Vector2.One;
                d.FillMode         = FillMode.Stretch;
                // Todo: Wrap
            });

            if (bodySprite != null)
            {
                InternalChild = bodySprite;
            }

            direction.BindTo(scrollingInfo.Direction);
            isHitting.BindTo(holdNote.IsHitting);
        }