1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00

Merge branch 'master' into fix-mania-selection

This commit is contained in:
smoogipoo 2020-04-28 13:00:33 +09:00
commit 799b5179ed
36 changed files with 554 additions and 140 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.421.0" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -0,0 +1,29 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
namespace osu.Game.Rulesets.Taiko.Tests
{
internal class DrawableTestHit : DrawableTaikoHitObject
{
private readonly HitResult type;
public DrawableTestHit(Hit hit, HitResult type = HitResult.Great)
: base(hit)
{
this.type = type;
}
[BackgroundDependencyLoader]
private void load()
{
Result.Type = type;
}
public override bool OnPressed(TaikoAction action) => false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,111 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{
[TestFixture]
public class TestSceneDrawableBarLine : TaikoSkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
{
typeof(DrawableBarLine),
typeof(LegacyBarLine),
typeof(BarLine),
}).ToList();
[Cached(typeof(IScrollingInfo))]
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
{
Direction = { Value = ScrollingDirection.Left },
TimeRange = { Value = 5000 },
};
[BackgroundDependencyLoader]
private void load()
{
AddStep("Bar line", () => SetContents(() =>
{
ScrollingHitObjectContainer hoc;
var cont = new Container
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
};
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
}));
AddStep("Bar line (major)", () => SetContents(() =>
{
ScrollingHitObjectContainer hoc;
var cont = new Container
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
};
hoc.Add(new DrawableBarLineMajor(createBarLineAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
}));
}
private BarLine createBarLineAtCurrentTime(bool major = false)
{
var barline = new BarLine
{
Major = major,
StartTime = Time.Current + 2000,
};
var cpi = new ControlPointInfo();
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
barline.ApplyDefaults(cpi, new BeatmapDifficulty());
return barline;
}
}
}

View File

@ -21,8 +21,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
{
typeof(DrawableHit),
typeof(DrawableCentreHit),
typeof(DrawableRimHit),
typeof(LegacyHit),
typeof(LegacyCirclePiece),
}).ToList();
@ -30,25 +28,25 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[BackgroundDependencyLoader]
private void load()
{
AddStep("Centre hit", () => SetContents(() => new DrawableCentreHit(createHitAtCurrentTime())
AddStep("Centre hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableCentreHit(createHitAtCurrentTime(true))
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Rim hit", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime())
AddStep("Rim hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime(true))
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -0,0 +1,58 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning;
using osu.Game.Rulesets.Taiko.UI;
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{
[TestFixture]
public class TestSceneHitExplosion : TaikoSkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
{
typeof(HitExplosion),
typeof(LegacyHitExplosion),
typeof(DefaultHitExplosion),
}).ToList();
[BackgroundDependencyLoader]
private void load()
{
AddStep("Great", () => SetContents(() => getContentFor(HitResult.Great)));
AddStep("Good", () => SetContents(() => getContentFor(HitResult.Good)));
AddStep("Miss", () => SetContents(() => getContentFor(HitResult.Miss)));
}
private Drawable getContentFor(HitResult type)
{
DrawableTaikoHitObject hit;
return new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
hit = createHit(type),
new HitExplosion(hit)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
}
};
}
private DrawableTaikoHitObject createHit(HitResult type) => new DrawableTestHit(new Hit { StartTime = Time.Current }, type);
}
}

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
[TestFixture]
public class TestSceneHits : OsuTestScene
{
private const double default_duration = 1000;
private const double default_duration = 3000;
private const float scroll_time = 1000;
protected override double TimePerAction => default_duration * 2;
@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
AddStep("Miss :(", addMissJudgement);
AddStep("DrumRoll", () => addDrumRoll(false));
AddStep("Strong DrumRoll", () => addDrumRoll(true));
AddStep("Kiai DrumRoll", () => addDrumRoll(true, kiai: true));
AddStep("Swell", () => addSwell());
AddStep("Centre", () => addCentreHit(false));
AddStep("Strong Centre", () => addCentreHit(true));
@ -148,6 +149,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
Add(h);
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
}
@ -163,6 +166,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
Add(h);
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
}
@ -192,7 +197,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
drawableRuleset.Playfield.Add(new DrawableSwell(swell));
}
private void addDrumRoll(bool strong, double duration = default_duration)
private void addDrumRoll(bool strong, double duration = default_duration, bool kiai = false)
{
addBarLine(true);
addBarLine(true, scroll_time + duration);
@ -202,9 +207,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
IsStrong = strong,
Duration = duration,
TickRate = 8,
};
d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
var cpi = new ControlPointInfo();
cpi.Add(-10000, new EffectControlPoint { KiaiMode = kiai });
d.ApplyDefaults(cpi, new BeatmapDifficulty());
drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
}
@ -219,7 +228,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
drawableRuleset.Playfield.Add(new DrawableCentreHit(h));
drawableRuleset.Playfield.Add(new DrawableHit(h));
}
private void addRimHit(bool strong)
@ -232,7 +241,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
drawableRuleset.Playfield.Add(new DrawableRimHit(h));
drawableRuleset.Playfield.Add(new DrawableHit(h));
}
private class TestStrongNestedHit : DrawableStrongNestedHit
@ -244,13 +253,5 @@ namespace osu.Game.Rulesets.Taiko.Tests
public override bool OnPressed(TaikoAction action) => false;
}
private class DrawableTestHit : DrawableHitObject<TaikoHitObject>
{
public DrawableTestHit(TaikoHitObject hitObject)
: base(hitObject)
{
}
}
}
}

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects;
using osuTK;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// <summary>
/// The visual line tracker.
/// </summary>
protected Box Tracker;
protected SkinnableDrawable Line;
/// <summary>
/// The bar line.
@ -45,13 +46,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y;
Width = tracker_width;
AddInternal(Tracker = new Box
AddInternal(Line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box
{
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
})
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
Alpha = 0.75f,
});
}

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
}
});
Tracker.Alpha = 1f;
Line.Alpha = 1f;
}
protected override void LoadComplete()

View File

@ -1,21 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableCentreHit : DrawableHit
{
public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftCentre, TaikoAction.RightCentre };
public DrawableCentreHit(Hit hit)
: base(hit)
{
}
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.CentreHit),
_ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
}
}

View File

@ -121,8 +121,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return;
int countHit = NestedHitObjects.Count(o => o.IsHit);
if (countHit >= HitObject.RequiredGoodHits)
{
ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
}
else
ApplyResult(r => r.Type = HitResult.Miss);
}

View File

@ -12,14 +12,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
{
/// <summary>
/// The hit type corresponding to the <see cref="TaikoAction"/> that the user pressed to hit this <see cref="DrawableDrumRollTick"/>.
/// </summary>
public HitType JudgementType;
public DrawableDrumRollTick(DrumRollTick tick)
: base(tick)
{
FillMode = FillMode.Fit;
}
public override bool DisplayResult => false;
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece
{
@ -51,7 +54,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
}
}
public override bool OnPressed(TaikoAction action) => UpdateResult(true);
public override bool OnPressed(TaikoAction action)
{
JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
return UpdateResult(true);
}
protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this);

View File

@ -0,0 +1,31 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
/// <summary>
/// A hit used specifically for drum rolls, where spawning flying hits is required.
/// </summary>
public class DrawableFlyingHit : DrawableHit
{
public DrawableFlyingHit(DrawableDrumRollTick drumRollTick)
: base(new IgnoreHit
{
StartTime = drumRollTick.HitObject.StartTime + drumRollTick.Result.TimeOffset,
IsStrong = drumRollTick.HitObject.IsStrong,
Type = drumRollTick.JudgementType
})
{
HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
}
protected override void LoadComplete()
{
base.LoadComplete();
ApplyResult(r => r.Type = r.Judgement.MaxResult);
}
}
}

View File

@ -8,31 +8,45 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public abstract class DrawableHit : DrawableTaikoHitObject<Hit>
public class DrawableHit : DrawableTaikoHitObject<Hit>
{
/// <summary>
/// A list of keys which can result in hits for this HitObject.
/// </summary>
public abstract TaikoAction[] HitActions { get; }
public TaikoAction[] HitActions { get; }
/// <summary>
/// The action that caused this <see cref="DrawableHit"/> to be hit.
/// </summary>
public TaikoAction? HitAction { get; private set; }
public TaikoAction? HitAction
{
get;
private set;
}
private bool validActionPressed;
private bool pressHandledThisFrame;
protected DrawableHit(Hit hit)
public DrawableHit(Hit hit)
: base(hit)
{
FillMode = FillMode.Fit;
HitActions =
HitObject.Type == HitType.Centre
? new[] { TaikoAction.LeftCentre, TaikoAction.RightCentre }
: new[] { TaikoAction.LeftRim, TaikoAction.RightRim };
}
protected override SkinnableDrawable CreateMainPiece() => HitObject.Type == HitType.Centre
? new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.CentreHit), _ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit)
: new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.RimHit), _ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
Debug.Assert(HitObject.HitWindows != null);
@ -58,7 +72,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
if (pressHandledThisFrame)
return true;
if (Judged)
return false;
@ -66,14 +79,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
// Only count this as handled if the new judgement is a hit
var result = UpdateResult(true);
if (IsHit)
HitAction = action;
// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
pressHandledThisFrame = true;
return result;
}
@ -81,7 +92,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
if (action == HitAction)
HitAction = null;
base.OnReleased(action);
}

View File

@ -1,21 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableRimHit : DrawableHit
{
public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftRim, TaikoAction.RightRim };
public DrawableRimHit(Hit hit)
: base(hit)
{
}
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.RimHit),
_ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
}
}

View File

@ -0,0 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Taiko.Objects
{
public class IgnoreHit : Hit
{
public override Judgement CreateJudgement() => new IgnoreJudgement();
}
}

View File

@ -0,0 +1,27 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class LegacyBarLine : Sprite
{
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Texture = skin.GetTexture("taiko-barline");
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(1, 0.88f);
FillMode = FillMode.Fill;
}
}
}

View File

@ -0,0 +1,29 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class LegacyHitExplosion : CompositeDrawable
{
public LegacyHitExplosion(Drawable sprite)
{
InternalChild = sprite;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeIn(120);
this.ScaleTo(0.6f).Then().ScaleTo(1, 240, Easing.OutElastic);
}
}
}

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{
Texture = skin.GetTexture("approachcircle"),
Scale = new Vector2(0.73f),
Alpha = 0.7f,
Alpha = 0.47f, // eyeballed to match stable
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{
Texture = skin.GetTexture("taikobigcircle"),
Scale = new Vector2(0.7f),
Alpha = 0.5f,
Alpha = 0.22f, // eyeballed to match stable
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
@ -75,11 +76,44 @@ namespace osu.Game.Rulesets.Taiko.Skinning
return Drawable.Empty();
return null;
case TaikoSkinComponents.BarLine:
if (GetTexture("taiko-barline") != null)
return new LegacyBarLine();
return null;
case TaikoSkinComponents.TaikoExplosionGood:
case TaikoSkinComponents.TaikoExplosionGreat:
case TaikoSkinComponents.TaikoExplosionMiss:
var sprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
if (sprite != null)
return new LegacyHitExplosion(sprite);
return null;
}
return source.GetDrawableComponent(component);
}
private string getHitName(TaikoSkinComponents component)
{
switch (component)
{
case TaikoSkinComponents.TaikoExplosionMiss:
return "taiko-hit0";
case TaikoSkinComponents.TaikoExplosionGood:
return "taiko-hit100";
case TaikoSkinComponents.TaikoExplosionGreat:
return "taiko-hit300";
}
throw new ArgumentOutOfRangeException(nameof(component), "Invalid result type");
}
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
public SampleChannel GetSample(ISampleInfo sampleInfo) => source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));

View File

@ -13,6 +13,10 @@ namespace osu.Game.Rulesets.Taiko
Swell,
HitTarget,
PlayfieldBackgroundLeft,
PlayfieldBackgroundRight
PlayfieldBackgroundRight,
BarLine,
TaikoExplosionMiss,
TaikoExplosionGood,
TaikoExplosionGreat,
}
}

View File

@ -0,0 +1,54 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.UI
{
internal class DefaultHitExplosion : CircularContainer
{
[Resolved]
private DrawableHitObject judgedObject { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
RelativeSizeAxes = Axes.Both;
BorderColour = Color4.White;
BorderThickness = 1;
Alpha = 0.15f;
Masking = true;
if (judgedObject.Result.Type == HitResult.Miss)
return;
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
InternalChildren = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
this.ScaleTo(3f, 1000, Easing.OutQuint);
}
}
}

View File

@ -49,10 +49,7 @@ namespace osu.Game.Rulesets.Taiko.UI
switch (h)
{
case Hit hit:
if (hit.Type == HitType.Centre)
return new DrawableCentreHit(hit);
else
return new DrawableRimHit(hit);
return new DrawableHit(hit);
case DrumRoll drumRoll:
return new DrawableDrumRoll(drumRoll);

View File

@ -0,0 +1,35 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Taiko.UI
{
internal class DrumRollHitContainer : ScrollingHitObjectContainer
{
protected override void Update()
{
base.Update();
// Remove any auxiliary hit notes that were spawned during a drum roll but subsequently rewound.
for (var i = AliveInternalChildren.Count - 1; i >= 0; i--)
{
var flyingHit = (DrawableFlyingHit)AliveInternalChildren[i];
if (Time.Current <= flyingHit.HitObject.StartTime)
Remove(flyingHit);
}
}
protected override void OnChildLifetimeBoundaryCrossed(LifetimeBoundaryCrossedEvent e)
{
base.OnChildLifetimeBoundaryCrossed(e);
// ensure all old hits are removed on becoming alive (may miss being in the AliveInternalChildren list above).
if (e.Kind == LifetimeBoundaryKind.Start && e.Direction == LifetimeBoundaryCrossingDirection.Backward)
Remove((DrawableHitObject)e.Child);
}
}
}

View File

@ -1,15 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.UI
{
@ -20,16 +20,11 @@ namespace osu.Game.Rulesets.Taiko.UI
{
public override bool RemoveWhenNotAlive => true;
[Cached(typeof(DrawableHitObject))]
public readonly DrawableHitObject JudgedObject;
private readonly Box innerFill;
private readonly bool isRim;
public HitExplosion(DrawableHitObject judgedObject, bool isRim)
public HitExplosion(DrawableHitObject judgedObject)
{
this.isRim = isRim;
JudgedObject = judgedObject;
Anchor = Anchor.Centre;
@ -39,35 +34,36 @@ namespace osu.Game.Rulesets.Taiko.UI
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE);
RelativePositionAxes = Axes.Both;
BorderColour = Color4.White;
BorderThickness = 1;
Alpha = 0.15f;
Masking = true;
Children = new[]
{
innerFill = new Box
{
RelativeSizeAxes = Axes.Both,
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker;
Child = new SkinnableDrawable(new TaikoSkinComponent(getComponentName(JudgedObject.Result?.Type ?? HitResult.Great)), _ => new DefaultHitExplosion());
}
private TaikoSkinComponents getComponentName(HitResult resultType)
{
switch (resultType)
{
case HitResult.Miss:
return TaikoSkinComponents.TaikoExplosionMiss;
case HitResult.Good:
return TaikoSkinComponents.TaikoExplosionGood;
case HitResult.Great:
return TaikoSkinComponents.TaikoExplosionGreat;
}
throw new ArgumentOutOfRangeException(nameof(resultType), "Invalid result type");
}
protected override void LoadComplete()
{
base.LoadComplete();
this.ScaleTo(3f, 1000, Easing.OutQuint);
this.FadeOut(500);
Expire(true);
}

View File

@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Taiko.UI
public override bool RemoveWhenNotAlive => true;
public readonly DrawableHitObject JudgedObject;
private readonly HitType type;
private readonly bool isRim;
public KiaiHitExplosion(DrawableHitObject judgedObject, bool isRim)
public KiaiHitExplosion(DrawableHitObject judgedObject, HitType type)
{
this.isRim = isRim;
JudgedObject = judgedObject;
this.type = type;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
@ -53,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.UI
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker,
Radius = 60,
};
}

View File

@ -30,6 +30,7 @@ namespace osu.Game.Rulesets.Taiko.UI
private Container<HitExplosion> hitExplosionContainer;
private Container<KiaiHitExplosion> kiaiExplosionContainer;
private JudgementContainer<DrawableTaikoJudgement> judgementContainer;
private ScrollingHitObjectContainer drumRollHitContainer;
internal Drawable HitTarget;
private ProxyContainer topLevelHitContainer;
@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
InternalChildren = new Drawable[]
InternalChildren = new[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
rightArea = new Container
@ -88,7 +89,11 @@ namespace osu.Game.Rulesets.Taiko.UI
{
Name = "Hit objects",
RelativeSizeAxes = Axes.Both,
Child = HitObjectContainer
Children = new Drawable[]
{
HitObjectContainer,
drumRollHitContainer = new DrumRollHitContainer()
}
},
kiaiExplosionContainer = new Container<KiaiHitExplosion>
{
@ -127,7 +132,8 @@ namespace osu.Game.Rulesets.Taiko.UI
{
Name = "Top level hit objects",
RelativeSizeAxes = Axes.Both,
}
},
drumRollHitContainer.CreateProxy()
};
}
@ -144,7 +150,6 @@ namespace osu.Game.Rulesets.Taiko.UI
public override void Add(DrawableHitObject h)
{
h.OnNewResult += OnNewResult;
base.Add(h);
switch (h)
@ -163,7 +168,6 @@ namespace osu.Game.Rulesets.Taiko.UI
{
if (!DisplayJudgements.Value)
return;
if (!judgedObject.DisplayResult)
return;
@ -174,6 +178,15 @@ namespace osu.Game.Rulesets.Taiko.UI
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
break;
case TaikoDrumRollTickJudgement _:
if (!result.IsHit)
break;
var drawableTick = (DrawableDrumRollTick)judgedObject;
addDrumRollHit(drawableTick);
break;
default:
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
{
@ -186,17 +199,23 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!result.IsHit)
break;
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
addExplosion(judgedObject, type);
break;
}
}
private void addDrumRollHit(DrawableDrumRollTick drawableTick) =>
drumRollHitContainer.Add(new DrawableFlyingHit(drawableTick));
private void addExplosion(DrawableHitObject drawableObject, HitType type)
{
hitExplosionContainer.Add(new HitExplosion(drawableObject));
if (drawableObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
}
private class ProxyContainer : LifetimeManagementContainer
{
public new MarginPadding Padding

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="DeepEqual" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
</ItemGroup>

View File

@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats
}
else
{
if (hitObject is IHasEndTime _)
if (hitObject is IHasEndTime)
addEndTimeData(writer, hitObject);
writer.Write(getSampleBank(hitObject.Samples));

View File

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.421.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
<PackageReference Include="Sentry" Version="2.1.1" />
<PackageReference Include="SharpCompress" Version="0.25.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -71,7 +71,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.421.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies">