diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index 0a4490eac3..fec675be54 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -44,11 +44,8 @@ namespace osu.Game.Modes.Osu.Beatmaps { StartTime = original.StartTime, Sample = original.Sample, - CurveObject = curveData, - Position = positionData?.Position ?? Vector2.Zero, - NewCombo = comboData?.NewCombo ?? false }; } @@ -60,7 +57,6 @@ namespace osu.Game.Modes.Osu.Beatmaps StartTime = original.StartTime, Sample = original.Sample, Position = new Vector2(512, 384) / 2, - EndTime = endTimeData.EndTime }; } @@ -69,9 +65,7 @@ namespace osu.Game.Modes.Osu.Beatmaps { StartTime = original.StartTime, Sample = original.Sample, - Position = positionData?.Position ?? Vector2.Zero, - NewCombo = comboData?.NewCombo ?? false }; } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index fe5b2f9859..3ed3124e14 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -13,8 +13,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - private readonly OsuHitObject osuObject; - public ApproachCircle ApproachCircle; private readonly CirclePiece circle; private readonly RingPiece ring; @@ -27,20 +25,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { Origin = Anchor.Centre; - osuObject = h; - - Position = osuObject.StackedPosition; - Scale = new Vector2(osuObject.Scale); + Position = HitObject.StackedPosition; + Scale = new Vector2(HitObject.Scale); Children = new Drawable[] { glow = new GlowPiece { - Colour = osuObject.ComboColour + Colour = AccentColour }, circle = new CirclePiece { - Colour = osuObject.ComboColour, + Colour = AccentColour, Hit = () => { if (Judgement.Result.HasValue) return false; @@ -58,11 +54,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables flash = new FlashPiece(), explode = new ExplodePiece { - Colour = osuObject.ComboColour, + Colour = AccentColour, }, ApproachCircle = new ApproachCircle { - Colour = osuObject.ComboColour, + Colour = AccentColour, } }; @@ -115,8 +111,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ApproachCircle.FadeOut(); - double endTime = (osuObject as IHasEndTime)?.EndTime ?? osuObject.StartTime; - double duration = endTime - osuObject.StartTime; + double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; + double duration = endTime - HitObject.StartTime; glow.Delay(duration); glow.FadeOut(400); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index b2af678cae..8593430f80 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -13,9 +13,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables public const float TIME_FADEIN = 400; public const float TIME_FADEOUT = 500; - public DrawableOsuHitObject(OsuHitObject hitObject) + protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) { + AccentColour = HitObject.ComboColour; } protected override OsuJudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index f730d55e21..e8f2154d7f 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -39,6 +39,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { body = new SliderBody(s) { + AccentColour = AccentColour, Position = s.StackedPosition, PathWidth = s.Scale * 64, }, @@ -56,6 +57,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ball = new SliderBall(s) { Scale = new Vector2(s.Scale), + AccentColour = AccentColour }, initialCircle = new DrawableHitCircle(new HitCircle { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 988eab45b5..1af9a2b7a2 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -48,7 +48,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables new Box { RelativeSizeAxes = Axes.Both, - Colour = sliderTick.ComboColour, + Colour = AccentColour, Alpha = 0.3f, } }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 8f36321efd..81bf9f0bf1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -48,7 +48,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Alpha = 0, Anchor = Anchor.Centre, Origin = Anchor.Centre, - DiscColour = s.ComboColour + DiscColour = AccentColour }, circleContainer = new Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs index cccd10469d..73a01dfce2 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -12,10 +12,26 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class SliderBall : CircularContainer, ISliderProgress { + private const float width = 128; + + private Color4 accentColour = Color4.Black; + /// + /// The colour that is used for the slider ball. + /// + public Color4 AccentColour + { + get { return accentColour; } + set + { + accentColour = value; + if (ball != null) + ball.Colour = value; + } + } + private readonly Slider slider; private readonly Box follow; - - private const float width = 128; + private readonly Box ball; public SliderBall(Slider slider) { @@ -49,9 +65,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces Alpha = 1, Children = new[] { - new Box + ball = new Box { - Colour = slider.ComboColour, + Colour = AccentColour, Alpha = 0.4f, Width = width, Height = width, diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs index c541a861d4..e7837471ee 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Configuration; using OpenTK; using OpenTK.Graphics.ES30; +using OpenTK.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { @@ -24,15 +25,32 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public float PathWidth { get { return path.PathWidth; } - set - { - path.PathWidth = value; - } + set { path.PathWidth = value; } } public double? SnakedStart { get; private set; } public double? SnakedEnd { get; private set; } + private Color4 accentColour; + /// + /// Used to colour the path. + /// + public Color4 AccentColour + { + get { return accentColour; } + set + { + if (accentColour == value) + return; + accentColour = value; + + if (LoadState == LoadState.Loaded) + Schedule(reloadTexture); + } + } + + private int textureWidth => (int)PathWidth * 2; + private readonly Slider slider; public SliderBody(Slider s) { @@ -82,7 +100,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces snakingIn = config.GetBindable(OsuConfig.SnakingInSliders); snakingOut = config.GetBindable(OsuConfig.SnakingOutSliders); - int textureWidth = (int)PathWidth * 2; + reloadTexture(); + } + + private void reloadTexture() + { + var texture = new Texture(textureWidth, 1); //initialise background var upload = new TextureUpload(textureWidth * 4); @@ -110,14 +133,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { progress -= border_portion; - bytes[i * 4] = (byte)(slider.ComboColour.R * 255); - bytes[i * 4 + 1] = (byte)(slider.ComboColour.G * 255); - bytes[i * 4 + 2] = (byte)(slider.ComboColour.B * 255); - bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (slider.ComboColour.A * 255)); + bytes[i * 4] = (byte)(AccentColour.R * 255); + bytes[i * 4 + 1] = (byte)(AccentColour.G * 255); + bytes[i * 4 + 2] = (byte)(AccentColour.B * 255); + bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (AccentColour.A * 255)); } } - var texture = new Texture(textureWidth, 1); texture.SetData(upload); path.Texture = texture; } diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index 2af669b4ef..fa422834db 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -36,7 +36,7 @@ namespace osu.Game.Modes.Osu.Objects public float Scale { get; set; } = 1; - public Color4 ComboColour { get; set; } + public Color4 ComboColour { get; set; } = Color4.Gray; public virtual bool NewCombo { get; set; } public int ComboIndex { get; set; }