Exemple #1
0
 private void load([CanBeNull] IBindable <SolosuAction> action, [NotNull] IScrollingInfo scrollingInfo)
 {
     if (action != null)
     {
         Action.BindTo(action);
     }
     Direction.BindTo(scrollingInfo.Direction);
     Direction.BindValueChanged(OnDirectionChanged, true);
 }
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string lightImage = skin.GetConfig <LegacyManiaSkinConfigurationLookup, string>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LightImage, 0))?.Value
                                ?? "mania-stage-light";

            float leftLineWidth = skin.GetConfig <LegacyManiaSkinConfigurationLookup, float>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LeftLineWidth, column.Index))
                                  ?.Value ?? 1;
            float rightLineWidth = skin.GetConfig <LegacyManiaSkinConfigurationLookup, float>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.RightLineWidth, column.Index))
                                   ?.Value ?? 1;

            bool hasLeftLine  = leftLineWidth > 0;
            bool hasRightLine = rightLineWidth > 0 && skin.GetConfig <LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.4m ||
                                stage == null || column.Index == stage.Columns.Count - 1;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black
                },
                new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = leftLineWidth,
                    Alpha            = hasLeftLine ? 1 : 0
                },
                new Box
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Y,
                    Width            = rightLineWidth,
                    Alpha            = hasRightLine ? 1 : 0
                },
                lightContainer = new Container
                {
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.Both,
                    Child            = light = new Sprite
                    {
                        Anchor           = Anchor.BottomCentre,
                        Origin           = Anchor.BottomCentre,
                        Texture          = skin.GetTexture(lightImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1,
                        Alpha            = 0
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
        private void load([CanBeNull] IBindable <ManiaAction> action, [NotNull] IScrollingInfo scrollingInfo)
        {
            if (action != null)
            {
                Action.BindTo(action);
            }

            Direction.BindTo(scrollingInfo.Direction);
        }
Exemple #4
0
        private void load(IScrollingInfo scrollingInfo)
        {
            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(dir =>
            {
                Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;

                hitTarget.Anchor = hitTarget.Origin = anchor;
            }, true);
        }
Exemple #5
0
        private void load([NotNull] IScrollingInfo scrollingInfo, [CanBeNull] DrawableHitObject drawableObject)
        {
            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);

            if (drawableObject != null)
            {
                accentColour.BindTo(drawableObject.AccentColour);
                accentColour.BindValueChanged(onAccentChanged, true);
            }
        }
Exemple #6
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            InternalChild = new Sprite
            {
                Anchor  = Anchor.BottomRight,
                Origin  = Anchor.BottomRight,
                Texture = getTexture(skin)
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(OnDirectionChanged, true);
        }
Exemple #7
0
        protected ManiaPlacementBlueprintTestScene()
        {
            scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;

            Add(column = new Column(0)
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                AccentColour = Color4.OrangeRed,
                Clock        = new FramedClock(new StopwatchClock()), // No scroll
            });
        }
Exemple #8
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            InternalChild = directionContainer = new Container
            {
                Origin           = Anchor.BottomCentre,
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Child            = noteSprite = new Sprite {
                    Texture = GetTexture(skin)
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(OnDirectionChanged, true);
        }
Exemple #9
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            minimumColumnWidth = skin.GetConfig <ManiaSkinConfigurationLookup, float>(new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.MinimumColumnWidth))?.Value;

            InternalChild = directionContainer = new Container
            {
                Origin           = Anchor.BottomCentre,
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Child            = noteAnimation = GetAnimation(skin) ?? Empty()
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(OnDirectionChanged, true);
        }
Exemple #10
0
        private void load(IScrollingInfo scrollingInfo)
        {
            InternalChild = directionContainer = new Container
            {
                RelativeSizeAxes = Axes.X,
                Height           = ManiaStage.HIT_TARGET_POSITION,
                Children         = new[]
                {
                    gradient = new Box
                    {
                        Name             = "Key gradient",
                        RelativeSizeAxes = Axes.Both,
                        Alpha            = 0.5f
                    },
                    keyIcon = new Container
                    {
                        Name            = "Key icon",
                        Anchor          = Anchor.Centre,
                        Origin          = Anchor.Centre,
                        Size            = new Vector2(key_icon_size),
                        Masking         = true,
                        CornerRadius    = key_icon_corner_radius,
                        BorderThickness = 2,
                        BorderColour    = Color4.White, // Not true
                        Children        = new[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = 0,
                                AlwaysPresent    = true
                            }
                        }
                    }
                }
            };

            keyIcon.EdgeEffect = new EdgeEffectParameters
            {
                Type   = EdgeEffectType.Glow,
                Radius = 5,
                Colour = column.AccentColour.Opacity(0.5f),
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Exemple #11
0
        private void load(IBindable <CrossAction> action, IScrollingInfo scrollingInfo)
        {
            this.action.BindTo(action);

            Drawable gradient;

            InternalChildren = new[]
            {
                gradient = new Box
                {
                    Name             = "Key gradient",
                    RelativeSizeAxes = Axes.Both,
                    Alpha            = 0.5f
                },
                keyIcon = new Container
                {
                    Name            = "Key icon",
                    Anchor          = Anchor.Centre,
                    Origin          = Anchor.Centre,
                    Size            = new Vector2(key_icon_size),
                    Masking         = true,
                    CornerRadius    = key_icon_corner_radius,
                    BorderThickness = 2,
                    BorderColour    = Color4.White, // Not true
                    Children        = new[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0,
                            AlwaysPresent    = true
                        }
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(dir =>
            {
                gradient.Colour = ColourInfo.GradientVertical(
                    dir.NewValue == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0),
                    dir.NewValue == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black);
            }, true);
        }
Exemple #12
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string upImage = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.KeyImage)?.Value
                             ?? $"mania-key{FallbackColumnIndex}";

            string downImage = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.KeyImageDown)?.Value
                               ?? $"mania-key{FallbackColumnIndex}D";

            InternalChild = directionContainer = new Container
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    upSprite = new Sprite
                    {
                        Origin           = Anchor.BottomCentre,
                        Texture          = skin.GetTexture(upImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1
                    },
                    downSprite = new Sprite
                    {
                        Origin           = Anchor.BottomCentre,
                        Texture          = skin.GetTexture(downImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1,
                        Alpha            = 0
                    }
                }
            };

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

            if (GetColumnSkinConfig <bool>(skin, LegacyManiaSkinConfigurationLookups.KeysUnderNotes)?.Value ?? false)
            {
                Column.UnderlayElements.Add(CreateProxy());
            }
        }
Exemple #13
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string targetImage = skin.GetManiaSkinConfig <string>(LegacyManiaSkinConfigurationLookups.HitTargetImage)?.Value
                                 ?? "mania-stage-hint";

            bool showJudgementLine = skin.GetManiaSkinConfig <bool>(LegacyManiaSkinConfigurationLookups.ShowJudgementLine)?.Value
                                     ?? true;

            Color4 lineColour = skin.GetManiaSkinConfig <Color4>(LegacyManiaSkinConfigurationLookups.JudgementLineColour)?.Value
                                ?? Color4.White;

            InternalChild = directionContainer = new Container
            {
                Origin           = Anchor.CentreLeft,
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    new Sprite
                    {
                        Texture          = skin.GetTexture(targetImage),
                        Scale            = new Vector2(1, 0.9f * 1.6025f),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1
                    },
                    new Box
                    {
                        Anchor           = Anchor.CentreLeft,
                        RelativeSizeAxes = Axes.X,
                        Height           = 1,
                        Colour           = LegacyColourCompatibility.DisallowZeroAlpha(lineColour),
                        Alpha            = showJudgementLine ? 0.9f : 0
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
        private void load(IScrollingInfo scrollingInfo)
        {
            direction.BindTo(scrollingInfo.Direction);

            InternalChildren = new Drawable[]
            {
                new HoldNoteNoteOverlay(this, HoldNotePosition.Start),
                new HoldNoteNoteOverlay(this, HoldNotePosition.End),
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking = true,
                    BorderThickness = 1,
                    BorderColour = colours.Yellow,
                    Child = new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Alpha = 0,
                        AlwaysPresent = true,
                    }
                }
            };
        }
Exemple #17
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string upImage = skin.GetConfig <LegacyManiaSkinConfigurationLookup, string>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.KeyImage, column.Index))?.Value
                             ?? $"mania-key{FallbackColumnIndex}";

            string downImage = skin.GetConfig <LegacyManiaSkinConfigurationLookup, string>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.KeyImageDown, column.Index))?.Value
                               ?? $"mania-key{FallbackColumnIndex}D";

            InternalChild = directionContainer = new Container
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    upSprite = new Sprite
                    {
                        Origin           = Anchor.BottomCentre,
                        Texture          = skin.GetTexture(upImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1
                    },
                    downSprite = new Sprite
                    {
                        Origin           = Anchor.BottomCentre,
                        Texture          = skin.GetTexture(downImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1,
                        Alpha            = 0
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Exemple #18
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);
        }
Exemple #19
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string targetImage = skin.GetConfig <LegacyManiaSkinConfigurationLookup, string>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.HitTargetImage))?.Value
                                 ?? "mania-stage-hint";

            bool showJudgementLine = skin.GetConfig <LegacyManiaSkinConfigurationLookup, bool>(
                new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.ShowJudgementLine))?.Value
                                     ?? true;

            InternalChild = directionContainer = new Container
            {
                Origin           = Anchor.CentreLeft,
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Children         = new Drawable[]
                {
                    new Sprite
                    {
                        Texture          = skin.GetTexture(targetImage),
                        Scale            = new Vector2(1, 0.9f * 1.6025f),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1
                    },
                    new Box
                    {
                        Anchor           = Anchor.CentreLeft,
                        RelativeSizeAxes = Axes.X,
                        Height           = 1,
                        Alpha            = showJudgementLine ? 0.9f : 0
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Exemple #20
0
        private void load(IScrollingInfo scrollingInfo)
        {
            Drawable hitTargetBar;

            InternalChildren = new[]
            {
                hitTargetBar = new Box
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = hit_target_height,
                    Colour           = Color4.Black
                },
                hitTargetLine = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = hit_target_bar_height,
                    Masking          = true,
                    Child            = new Box {
                        RelativeSizeAxes = Axes.Both
                    }
                },
                content = new Container
                {
                    Name             = "Hit objects",
                    RelativeSizeAxes = Axes.Both,
                },
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(direction =>
            {
                Anchor anchor = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;

                hitTargetBar.Anchor  = hitTargetBar.Origin = anchor;
                hitTargetLine.Anchor = hitTargetLine.Origin = anchor;
            }, true);
        }
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string lightImage = skin.GetManiaSkinConfig <string>(LegacyManiaSkinConfigurationLookups.LightImage)?.Value
                                ?? "mania-stage-light";

            float lightPosition = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.LightPosition)?.Value
                                  ?? 0;

            Color4 lightColour = GetColumnSkinConfig <Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLightColour)?.Value
                                 ?? Color4.White;

            InternalChildren = new[]
            {
                lightContainer = new Container
                {
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Bottom = lightPosition
                    },
                    Child = light = new Sprite
                    {
                        Anchor           = Anchor.BottomCentre,
                        Origin           = Anchor.BottomCentre,
                        Colour           = lightColour,
                        Texture          = skin.GetTexture(lightImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1,
                        Alpha            = 0
                    }
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
Exemple #22
0
 private void load([NotNull] IScrollingInfo scrollingInfo)
 {
     Direction.BindTo(scrollingInfo.Direction);
     Direction.BindValueChanged(OnDirectionChanged, true);
 }
Exemple #23
0
        private void load(OsuColour colours, IScrollingInfo scrollingInfo)
        {
            body.BorderColour = colours.Yellow;

            direction.BindTo(scrollingInfo.Direction);
        }
Exemple #24
0
        private void load(IScrollingInfo scrollingInfo)
        {
            const float angle_variance = 15; // should be less than 45
            const float roundness      = 80;
            const float initial_height = 10;

            var colour = Interpolation.ValueAt(0.4f, column.AccentColour, Color4.White, 0, 1);

            InternalChildren = new Drawable[]
            {
                largeFaint = new CircularContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    // we want our size to be very small so the glow dominates it.
                    Size       = new Vector2(default_large_faint_size),
                    Blending   = BlendingParameters.Additive,
                    EdgeEffect = new EdgeEffectParameters
                    {
                        Type      = EdgeEffectType.Glow,
                        Colour    = Interpolation.ValueAt(0.1f, column.AccentColour, Color4.White, 0, 1).Opacity(0.3f),
                        Roundness = 160,
                        Radius    = 200,
                    },
                },
                mainGlow1 = new CircularContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Blending         = BlendingParameters.Additive,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type      = EdgeEffectType.Glow,
                        Colour    = Interpolation.ValueAt(0.6f, column.AccentColour, Color4.White, 0, 1),
                        Roundness = 20,
                        Radius    = 50,
                    },
                },
                new CircularContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Size             = new Vector2(0.01f, initial_height),
                    Blending         = BlendingParameters.Additive,
                    Rotation         = RNG.NextSingle(-angle_variance, angle_variance),
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type      = EdgeEffectType.Glow,
                        Colour    = colour,
                        Roundness = roundness,
                        Radius    = 40,
                    },
                },
                new CircularContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Size             = new Vector2(0.01f, initial_height),
                    Blending         = BlendingParameters.Additive,
                    Rotation         = RNG.NextSingle(-angle_variance, angle_variance),
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type      = EdgeEffectType.Glow,
                        Colour    = colour,
                        Roundness = roundness,
                        Radius    = 40,
                    },
                }
            };

            direction.BindTo(scrollingInfo.Direction);
            direction.BindValueChanged(onDirectionChanged, true);
        }
 private void load(IScrollingInfo scrollingInfo)
 {
     direction.BindTo(scrollingInfo.Direction);
 }
 private void load(IScrollingInfo scrollingInfo)
 {
     direction.BindTo(scrollingInfo.Direction);
     direction.BindValueChanged(direction => Direction.Value = direction, true);
 }
Exemple #27
0
 private void load(IScrollingInfo scrollingInfo)
 {
     scrollDirection.BindTo(scrollingInfo.Direction);
     scrollDirection.BindValueChanged(onScrollDirectionChanged, true);
 }
Exemple #28
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);
        }
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
        {
            string lightImage = skin.GetManiaSkinConfig <string>(LegacyManiaSkinConfigurationLookups.LightImage)?.Value
                                ?? "mania-stage-light";

            float leftLineWidth = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.LeftLineWidth)
                                  ?.Value ?? 1;
            float rightLineWidth = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.RightLineWidth)
                                   ?.Value ?? 1;

            bool hasLeftLine  = leftLineWidth > 0;
            bool hasRightLine = rightLineWidth > 0 && skin.GetConfig <LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.4m ||
                                isLastColumn;

            float lightPosition = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.LightPosition)?.Value
                                  ?? 0;

            Color4 lineColour = GetColumnSkinConfig <Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLineColour)?.Value
                                ?? Color4.White;

            Color4 backgroundColour = GetColumnSkinConfig <Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnBackgroundColour)?.Value
                                      ?? Color4.Black;

            Color4 lightColour = GetColumnSkinConfig <Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLightColour)?.Value
                                 ?? Color4.White;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = backgroundColour
                },
                new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = leftLineWidth,
                    Scale            = new Vector2(0.740f, 1),
                    Colour           = lineColour,
                    Alpha            = hasLeftLine ? 1 : 0
                },
                new Box
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Y,
                    Width            = rightLineWidth,
                    Scale            = new Vector2(0.740f, 1),
                    Colour           = lineColour,
                    Alpha            = hasRightLine ? 1 : 0
                },
                lightContainer = new Container
                {
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Bottom = lightPosition
                    },
                    Child = light = new Sprite
                    {
                        Anchor           = Anchor.BottomCentre,
                        Origin           = Anchor.BottomCentre,
                        Colour           = lightColour,
                        Texture          = skin.GetTexture(lightImage),
                        RelativeSizeAxes = Axes.X,
                        Width            = 1,
                        Alpha            = 0
                    }
                }
            };

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