diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 0cdc1694f4..1bebe9dae0 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -16,29 +16,13 @@ namespace osu.Game.Rulesets.Catch.Beatmaps { public override void PostProcess(Beatmap beatmap) { - if (beatmap.ComboColours.Count == 0) - return; - - int index = 0; - int colourIndex = 0; - - CatchHitObject lastObj = null; - initialiseHyperDash(beatmap.HitObjects); + base.PostProcess(beatmap); + + int index = 0; foreach (var obj in beatmap.HitObjects) - { - if (obj.NewCombo) - { - if (lastObj != null) lastObj.LastInCombo = true; - colourIndex = (colourIndex + 1) % beatmap.ComboColours.Count; - } - obj.IndexInBeatmap = index++; - obj.ComboColour = beatmap.ComboColours[colourIndex]; - - lastObj = obj; - } } private void initialiseHyperDash(List objects) diff --git a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs index 89bd73f8fb..487345019b 100644 --- a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs @@ -3,7 +3,6 @@ using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Types; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects { @@ -32,25 +31,11 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new Banana { Samples = Samples, - ComboColour = getNextComboColour(), StartTime = i, X = RNG.NextSingle() }); } - private Color4 getNextComboColour() - { - switch (RNG.Next(0, 3)) - { - default: - return new Color4(255, 240, 0, 255); - case 1: - return new Color4(255, 192, 0, 255); - case 2: - return new Color4(214, 221, 28, 255); - } - } - public double EndTime => StartTime + Duration; public double Duration { get; set; } diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 559bf47842..1a0ccc9b1e 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -5,24 +5,25 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects { - public abstract class CatchHitObject : HitObject, IHasXPosition, IHasCombo + public abstract class CatchHitObject : HitObject, IHasXPosition, IHasComboInformation { public const double OBJECT_RADIUS = 44; public float X { get; set; } - public Color4 ComboColour { get; set; } - public int IndexInBeatmap { get; set; } public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4); public virtual bool NewCombo { get; set; } + public int IndexInCurrentCombo { get; set; } + + public int ComboIndex { get; set; } + /// /// The next fruit starts a new combo. Used for explodey. /// diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index f05f51052d..719cf0a110 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -5,28 +5,39 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableDroplet : PalpableCatchHitObject { + private Pulp pulp; + public DrawableDroplet(Droplet h) : base(h) { Origin = Anchor.Centre; Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 4; - AccentColour = h.ComboColour; Masking = false; } [BackgroundDependencyLoader] private void load() { - InternalChild = new Pulp + InternalChild = pulp = new Pulp { - AccentColour = AccentColour, Size = Size }; } + + public override Color4 AccentColour + { + get { return base.AccentColour; } + set + { + base.AccentColour = value; + pulp.AccentColour = AccentColour; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index dcad82130e..03c2444d8c 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -24,7 +24,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Origin = Anchor.Centre; Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS); - AccentColour = HitObject.ComboColour; Masking = false; Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; @@ -33,6 +32,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable [BackgroundDependencyLoader] private void load() { + // todo: this should come from the skin. + AccentColour = colourForRrepesentation(HitObject.VisualRepresentation); + InternalChildren = new[] { createPulp(HitObject.VisualRepresentation), @@ -273,5 +275,31 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 500, 0, 1); } + + private Color4 colourForRrepesentation(FruitVisualRepresentation representation) + { + switch (representation) + { + default: + case FruitVisualRepresentation.Pear: + return new Color4(17, 136, 170, 255); + case FruitVisualRepresentation.Grape: + return new Color4(204, 102, 0, 255); + case FruitVisualRepresentation.Raspberry: + return new Color4(121, 9, 13, 255); + case FruitVisualRepresentation.Pineapple: + return new Color4(102, 136, 0, 255); + case FruitVisualRepresentation.Banana: + switch (RNG.Next(0, 3)) + { + default: + return new Color4(255, 240, 0, 255); + case 1: + return new Color4(255, 192, 0, 255); + case 2: + return new Color4(214, 221, 28, 255); + } + } + } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs index 0a2763cbea..b3532e2473 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs @@ -33,7 +33,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable var catchObject = (DrawableCatchHitObject)h; catchObject.CheckPosition = o => CheckPosition?.Invoke(o) ?? false; - catchObject.AccentColour = HitObject.ComboColour; dropletContainer.Add(h); base.AddNested(h); diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index e4d5ae698f..29ad3c3956 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -60,7 +60,6 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new Fruit { Samples = Samples, - ComboColour = ComboColour, StartTime = StartTime, X = X }); @@ -90,7 +89,6 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new TinyDroplet { StartTime = t, - ComboColour = ComboColour, X = X + Curve.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH, Samples = new List(Samples.Select(s => new SampleInfo { @@ -106,7 +104,6 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new Droplet { StartTime = time, - ComboColour = ComboColour, X = X + Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH, Samples = new List(Samples.Select(s => new SampleInfo { @@ -123,7 +120,6 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new Fruit { Samples = Samples, - ComboColour = ComboColour, StartTime = spanStartTime + spanDuration, X = X + Curve.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH }); diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 16266196e7..595ca6cb24 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -6,13 +6,11 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Tests.Visual; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Tests { @@ -62,8 +60,6 @@ namespace osu.Game.Rulesets.Catch.Tests Scale = 1.5f, }; - fruit.ComboColour = colourForRrepesentation(fruit.VisualRepresentation); - return new DrawableFruit(fruit) { Anchor = Anchor.Centre, @@ -74,31 +70,5 @@ namespace osu.Game.Rulesets.Catch.Tests LifetimeEnd = double.PositiveInfinity, }; } - - private Color4 colourForRrepesentation(FruitVisualRepresentation representation) - { - switch (representation) - { - default: - case FruitVisualRepresentation.Pear: - return new Color4(17, 136, 170, 255); - case FruitVisualRepresentation.Grape: - return new Color4(204, 102, 0, 255); - case FruitVisualRepresentation.Raspberry: - return new Color4(121, 9, 13, 255); - case FruitVisualRepresentation.Pineapple: - return new Color4(102, 136, 0, 255); - case FruitVisualRepresentation.Banana: - switch (RNG.Next(0, 3)) - { - default: - return new Color4(255, 240, 0, 255); - case 1: - return new Color4(255, 192, 0, 255); - case 2: - return new Color4(214, 221, 28, 255); - } - } - } } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 7c548f70d4..bf2f9db4a8 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -54,7 +54,6 @@ namespace osu.Game.Rulesets.Catch.UI if (caughtFruit == null) return; - caughtFruit.AccentColour = fruit.AccentColour; caughtFruit.RelativePositionAxes = Axes.None; caughtFruit.Position = new Vector2(MovableCatcher.ToLocalSpace(fruit.ScreenSpaceDrawQuad.Centre).X - MovableCatcher.DrawSize.X / 2, 0); diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 6eb34c7005..c3d6a69a72 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -8,7 +8,6 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.Judgements; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Scoring; @@ -24,7 +23,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables private readonly GlowPiece glowPiece; private readonly BodyPiece bodyPiece; - private readonly Container tickContainer; private readonly Container fullHeightContainer; /// @@ -40,6 +38,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public DrawableHoldNote(HoldNote hitObject, ManiaAction action) : base(hitObject, action) { + Container tickContainer; RelativeSizeAxes = Axes.X; InternalChildren = new Drawable[] @@ -57,7 +56,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, }, - tickContainer = new Container { RelativeSizeAxes = Axes.Both }, + tickContainer = new Container + { + RelativeSizeAxes = Axes.Both, + ChildrenEnumerable = HitObject.NestedHitObjects.OfType().Select(tick => new DrawableHoldNoteTick(tick) + { + HoldStartTime = () => holdStartTime + }) + }, head = new DrawableHeadNote(this, action) { Anchor = Anchor.TopCentre, @@ -70,16 +76,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } }; - foreach (var tick in HitObject.NestedHitObjects.OfType()) - { - var drawableTick = new DrawableHoldNoteTick(tick) - { - HoldStartTime = () => holdStartTime - }; - - tickContainer.Add(drawableTick); - AddNested(drawableTick); - } + foreach (var tick in tickContainer) + AddNested(tick); AddNested(head); AddNested(tail); @@ -90,12 +88,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables get { return base.AccentColour; } set { - if (base.AccentColour == value) - return; base.AccentColour = value; - tickContainer.Children.ForEach(t => t.AccentColour = value); - glowPiece.AccentColour = value; bodyPiece.AccentColour = value; head.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index 0a1624b464..3aec8d25f9 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using OpenTK.Graphics; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables @@ -28,16 +27,5 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (action != null) Action = action.Value; } - - public override Color4 AccentColour - { - get { return base.AccentColour; } - set - { - if (base.AccentColour == value) - return; - base.AccentColour = value; - } - } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index c8aa4588a8..c171325fb2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -48,13 +48,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables get { return base.AccentColour; } set { - if (base.AccentColour == value) - return; base.AccentColour = value; - - laneGlowPiece.AccentColour = value; - GlowPiece.AccentColour = value; - headPiece.AccentColour = value; + laneGlowPiece.AccentColour = AccentColour; + GlowPiece.AccentColour = AccentColour; + headPiece.AccentColour = AccentColour; } } diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index bfcdec9321..42b22a71ec 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -13,24 +13,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps public override void PostProcess(Beatmap beatmap) { applyStacking(beatmap); - - if (beatmap.ComboColours.Count == 0) - return; - - int comboIndex = 0; - int colourIndex = 0; - - foreach (var obj in beatmap.HitObjects) - { - if (obj.NewCombo) - { - comboIndex = 0; - colourIndex = (colourIndex + 1) % beatmap.ComboColours.Count; - } - - obj.IndexInCurrentCombo = comboIndex++; - obj.ComboColour = beatmap.ComboColours[colourIndex]; - } + base.PostProcess(beatmap); } private void applyStacking(Beatmap beatmap) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 1f94f49598..9066a9ef92 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -8,6 +8,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -21,7 +22,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly NumberPiece number; private readonly GlowPiece glow; - public DrawableHitCircle(HitCircle h) : base(h) + public DrawableHitCircle(HitCircle h) + : base(h) { Origin = Anchor.Centre; @@ -30,13 +32,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables InternalChildren = new Drawable[] { - glow = new GlowPiece - { - Colour = AccentColour - }, + glow = new GlowPiece(), circle = new CirclePiece { - Colour = AccentColour, Hit = () => { if (AllJudged) @@ -52,15 +50,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, ring = new RingPiece(), flash = new FlashPiece(), - explode = new ExplodePiece - { - Colour = AccentColour, - }, + explode = new ExplodePiece(), ApproachCircle = new ApproachCircle { Alpha = 0, Scale = new Vector2(4), - Colour = AccentColour, } }; @@ -70,6 +64,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; } + public override Color4 AccentColour + { + get { return base.AccentColour; } + set + { + base.AccentColour = value; + explode.Colour = AccentColour; + glow.Colour = AccentColour; + circle.Colour = AccentColour; + ApproachCircle.Colour = AccentColour; + } + } + protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (!userTriggered) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index c8e42fa44f..2e59e2dc60 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -15,7 +15,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) { - AccentColour = HitObject.ComboColour; Alpha = 0; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 9c2d3f5e07..3872821b96 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Osu.Judgements; using osu.Framework.Graphics.Primitives; using osu.Game.Configuration; using osu.Game.Rulesets.Scoring; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -41,7 +42,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Body = new SliderBody(s) { - AccentColour = AccentColour, PathWidth = s.Scale * 64, }, ticks = new Container { RelativeSizeAxes = Axes.Both }, @@ -50,7 +50,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { BypassAutoSizeAxes = Axes.Both, Scale = new Vector2(s.Scale), - AccentColour = AccentColour, AlwaysPresent = true, Alpha = 0 }, @@ -87,6 +86,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; } + public override Color4 AccentColour + { + get { return base.AccentColour; } + set + { + base.AccentColour = value; + Body.AccentColour = AccentColour; + Ball.AccentColour = AccentColour; + } + } + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 8c0eb7ff7d..c59c22c771 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public double? SnakedStart { get; private set; } public double? SnakedEnd { get; private set; } - private Color4 accentColour; + private Color4 accentColour = Color4.White; /// /// Used to colour the path. /// @@ -173,6 +173,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces texture.SetData(upload); path.Texture = texture; + + container.ForceRedraw(); } private void computeSize() diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index d9aed23414..c00c30ced9 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -6,13 +6,11 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; using osu.Game.Rulesets.Objects.Types; -using OpenTK.Graphics; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Edit.Types; namespace osu.Game.Rulesets.Osu.Objects { - public abstract class OsuHitObject : HitObject, IHasCombo, IHasEditablePosition + public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition { public const double OBJECT_RADIUS = 64; @@ -53,10 +51,14 @@ namespace osu.Game.Rulesets.Osu.Objects public float Scale { get; set; } = 1; - public Color4 ComboColour { get; set; } = Color4.Gray; public virtual bool NewCombo { get; set; } + public int IndexInCurrentCombo { get; set; } + public int ComboIndex { get; set; } + + public bool LastInCombo { get; set; } + protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index a633e3957e..469c4ddcb4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -99,10 +99,10 @@ namespace osu.Game.Rulesets.Osu.Objects { StartTime = StartTime, Position = Position, - IndexInCurrentCombo = IndexInCurrentCombo, - ComboColour = ComboColour, Samples = Samples, - SampleControlPoint = SampleControlPoint + SampleControlPoint = SampleControlPoint, + IndexInCurrentCombo = IndexInCurrentCombo, + ComboIndex = ComboIndex, }; TailCircle = new SliderCircle(this) @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Osu.Objects StartTime = EndTime, Position = EndPosition, IndexInCurrentCombo = IndexInCurrentCombo, - ComboColour = ComboColour + ComboIndex = ComboIndex, }; AddNested(HeadCircle); @@ -160,7 +160,6 @@ namespace osu.Game.Rulesets.Osu.Objects Position = Position + Curve.PositionAt(distanceProgress), StackHeight = StackHeight, Scale = Scale, - ComboColour = ComboColour, Samples = sampleList }); } @@ -179,7 +178,6 @@ namespace osu.Game.Rulesets.Osu.Objects Position = Position + Curve.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, - ComboColour = ComboColour, Samples = new List(RepeatSamples[repeatIndex]) }); } diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index f40d9c05d1..b0cfa43f15 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; -using OpenTK.Graphics; using osu.Game.Rulesets.Osu.Judgements; using System.Collections.Generic; using System; @@ -61,7 +60,6 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000 + timeOffset, Position = positionOffset.Value, - ComboColour = Color4.LightSeaGreen }; circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize }); diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index b68f59877b..e819d8fff5 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -117,7 +117,6 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-(distance / 2), 0), - ComboColour = Color4.LightSeaGreen, ControlPoints = new List { Vector2.Zero, @@ -138,7 +137,6 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ComboColour = Color4.LightSeaGreen, ControlPoints = new List { Vector2.Zero, @@ -162,7 +160,6 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ComboColour = Color4.LightSeaGreen, ControlPoints = new List { Vector2.Zero, @@ -189,7 +186,6 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Bezier, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ComboColour = Color4.LightSeaGreen, ControlPoints = new List { Vector2.Zero, @@ -215,7 +211,6 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(0, 0), - ComboColour = Color4.LightSeaGreen, ControlPoints = new List { Vector2.Zero, @@ -245,7 +240,6 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-100, 0), - ComboColour = Color4.LightSeaGreen, CurveType = CurveType.Catmull, ControlPoints = new List { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index f98e6b936e..2bb2d478c3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -20,11 +20,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public class DrawableDrumRoll : DrawableTaikoHitObject { /// - /// Number of rolling hits required to reach the dark/final accent colour. + /// Number of rolling hits required to reach the dark/final colour. /// - private const int rolling_hits_for_dark_accent = 5; - - private Color4 accentDarkColour; + private const int rolling_hits_for_engaged_colour = 5; /// /// Rolling number of tick hits. This increases for hits and decreases for misses. @@ -53,11 +51,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) => false; + private Color4 colourIdle; + private Color4 colourEngaged; + [BackgroundDependencyLoader] private void load(OsuColour colours) { - MainPiece.AccentColour = AccentColour = colours.YellowDark; - accentDarkColour = colours.YellowDarker; + MainPiece.AccentColour = colourIdle = colours.YellowDark; + colourEngaged = colours.YellowDarker; } private void onTickJudgement(DrawableHitObject obj, Judgement judgement) @@ -67,10 +68,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables else rollingHits--; - rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent); + rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour); - Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); - MainPiece.FadeAccent(newAccent, 100); + Color4 newColour = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_engaged_colour, colourIdle, colourEngaged, 0, 1); + MainPiece.FadeAccent(newColour, 100); } protected override void CheckForJudgements(bool userTriggered, double timeOffset) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 9b528699ef..f2cc419043 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -1,7 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps { @@ -19,6 +21,29 @@ namespace osu.Game.Beatmaps /// /// /// The Beatmap to process. - public virtual void PostProcess(Beatmap beatmap) { } + public virtual void PostProcess(Beatmap beatmap) + { + IHasComboInformation lastObj = null; + + foreach (var obj in beatmap.HitObjects.OfType()) + { + if (obj.NewCombo) + { + obj.IndexInCurrentCombo = 0; + if (lastObj != null) + { + lastObj.LastInCombo = true; + obj.ComboIndex = lastObj.ComboIndex + 1; + } + } + else if (lastObj != null) + { + obj.IndexInCurrentCombo = lastObj.IndexInCurrentCombo + 1; + obj.ComboIndex = lastObj.ComboIndex; + } + + lastObj = obj; + } + } } } diff --git a/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs b/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs new file mode 100644 index 0000000000..1d4f4e0f90 --- /dev/null +++ b/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Objects.Types +{ + /// + /// A HitObject that is part of a combo and has extended information about its position relative to other combo objects. + /// + public interface IHasComboInformation : IHasCombo + { + /// + /// The offset of this hitobject in the current combo. + /// + int IndexInCurrentCombo { get; set; } + + /// + /// The offset of this combo in relation to the beatmap. + /// + int ComboIndex { get; set; } + + /// + /// Whether this is the last object in the current combo. + /// + bool LastInCombo { get; set; } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b325e52ed1..53e3c54ab9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -374,6 +374,7 @@ +