mirror of
https://github.com/ppy/osu
synced 2025-01-30 01:42:54 +00:00
Run all type and sample mutations through standardising methods
This commit is contained in:
parent
d0d90d77c9
commit
dc322d1c63
@ -2,30 +2,23 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects
|
namespace osu.Game.Rulesets.Taiko.Objects
|
||||||
{
|
{
|
||||||
public class Hit : TaikoStrongableHitObject
|
public class Hit : TaikoStrongableHitObject
|
||||||
{
|
{
|
||||||
public readonly Bindable<HitType> TypeBindable = new Bindable<HitType>();
|
protected override void UpdateTypeFromSamples()
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="HitType"/> that actuates this <see cref="Hit"/>.
|
|
||||||
/// </summary>
|
|
||||||
public HitType Type
|
|
||||||
{
|
{
|
||||||
get => TypeBindable.Value;
|
base.UpdateTypeFromSamples();
|
||||||
set
|
|
||||||
{
|
Type = getRimSamples().Any() ? HitType.Rim : HitType.Centre;
|
||||||
TypeBindable.Value = value;
|
|
||||||
updateSamplesFromType();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSamplesFromType()
|
protected override void UpdateSamplesFromType()
|
||||||
{
|
{
|
||||||
|
base.UpdateSamplesFromType();
|
||||||
|
|
||||||
var rimSamples = getRimSamples();
|
var rimSamples = getRimSamples();
|
||||||
|
|
||||||
bool isRimType = Type == HitType.Rim;
|
bool isRimType = Type == HitType.Rim;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -11,6 +12,17 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
{
|
{
|
||||||
public abstract class TaikoHitObject : HitObject
|
public abstract class TaikoHitObject : HitObject
|
||||||
{
|
{
|
||||||
|
public readonly Bindable<HitType> TypeBindable = new Bindable<HitType>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="HitType"/> that actuates this <see cref="Hit"/>.
|
||||||
|
/// </summary>
|
||||||
|
public HitType Type
|
||||||
|
{
|
||||||
|
get => TypeBindable.Value;
|
||||||
|
set => TypeBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default size of a drawable taiko hit object.
|
/// Default size of a drawable taiko hit object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -19,5 +31,19 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
public override Judgement CreateJudgement() => new TaikoJudgement();
|
public override Judgement CreateJudgement() => new TaikoJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => new TaikoHitWindows();
|
protected override HitWindows CreateHitWindows() => new TaikoHitWindows();
|
||||||
|
|
||||||
|
protected TaikoHitObject()
|
||||||
|
{
|
||||||
|
SamplesBindable.BindCollectionChanged((_, __) => UpdateTypeFromSamples());
|
||||||
|
TypeBindable.BindValueChanged(_ => UpdateSamplesFromType());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateSamplesFromType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateTypeFromSamples()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,25 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
public bool IsStrong
|
public bool IsStrong
|
||||||
{
|
{
|
||||||
get => IsStrongBindable.Value;
|
get => IsStrongBindable.Value;
|
||||||
set
|
set => IsStrongBindable.Value = value;
|
||||||
{
|
|
||||||
IsStrongBindable.Value = value;
|
|
||||||
updateSamplesFromStrong();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSamplesFromStrong()
|
protected TaikoStrongableHitObject()
|
||||||
{
|
{
|
||||||
|
IsStrongBindable.BindValueChanged(_ => UpdateSamplesFromType());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateTypeFromSamples()
|
||||||
|
{
|
||||||
|
base.UpdateTypeFromSamples();
|
||||||
|
|
||||||
|
IsStrong = getStrongSamples().Any();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateSamplesFromType()
|
||||||
|
{
|
||||||
|
base.UpdateSamplesFromType();
|
||||||
|
|
||||||
var strongSamples = getStrongSamples();
|
var strongSamples = getStrongSamples();
|
||||||
|
|
||||||
if (IsStrongBindable.Value != strongSamples.Any())
|
if (IsStrongBindable.Value != strongSamples.Any())
|
||||||
|
Loading…
Reference in New Issue
Block a user