1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-21 13:57:45 +08:00

Add bindables for IHasComboInformation properties

This commit is contained in:
smoogipoo 2019-09-26 16:55:08 +09:00
parent 78503987d8
commit bbf0544a8d
3 changed files with 58 additions and 7 deletions

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 osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.Beatmaps;
@ -37,9 +38,21 @@ namespace osu.Game.Rulesets.Catch.Objects
public int ComboOffset { get; set; }
public int IndexInCurrentCombo { get; set; }
public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();
public int ComboIndex { get; set; }
public int IndexInCurrentCombo
{
get => IndexInCurrentComboBindable.Value;
set => IndexInCurrentComboBindable.Value = value;
}
public Bindable<int> ComboIndexBindable { get; } = new Bindable<int>();
public int ComboIndex
{
get => ComboIndexBindable.Value;
set => ComboIndexBindable.Value = value;
}
/// <summary>
/// Difference between the distance to the next object
@ -48,10 +61,16 @@ namespace osu.Game.Rulesets.Catch.Objects
/// </summary>
public float DistanceToHyperDash { get; set; }
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();
/// <summary>
/// The next fruit starts a new combo. Used for explodey.
/// </summary>
public virtual bool LastInCombo { get; set; }
public virtual bool LastInCombo
{
get => LastInComboBindable.Value;
set => LastInComboBindable.Value = value;
}
public float Scale { get; set; } = 1;

View File

@ -58,13 +58,37 @@ namespace osu.Game.Rulesets.Osu.Objects
public virtual bool NewCombo { get; set; }
public int ComboOffset { get; set; }
public readonly Bindable<int> ComboOffsetBindable = new Bindable<int>();
public virtual int IndexInCurrentCombo { get; set; }
public int ComboOffset
{
get => ComboOffsetBindable.Value;
set => ComboOffsetBindable.Value = value;
}
public virtual int ComboIndex { get; set; }
public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();
public bool LastInCombo { get; set; }
public virtual int IndexInCurrentCombo
{
get => IndexInCurrentComboBindable.Value;
set => IndexInCurrentComboBindable.Value = value;
}
public Bindable<int> ComboIndexBindable { get; } = new Bindable<int>();
public virtual int ComboIndex
{
get => ComboIndexBindable.Value;
set => ComboIndexBindable.Value = value;
}
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();
public bool LastInCombo
{
get => LastInComboBindable.Value;
set => LastInComboBindable.Value = value;
}
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{

View File

@ -1,6 +1,8 @@
// 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.Bindables;
namespace osu.Game.Rulesets.Objects.Types
{
/// <summary>
@ -8,16 +10,22 @@ namespace osu.Game.Rulesets.Objects.Types
/// </summary>
public interface IHasComboInformation : IHasCombo
{
Bindable<int> IndexInCurrentComboBindable { get; }
/// <summary>
/// The offset of this hitobject in the current combo.
/// </summary>
int IndexInCurrentCombo { get; set; }
Bindable<int> ComboIndexBindable { get; }
/// <summary>
/// The offset of this combo in relation to the beatmap.
/// </summary>
int ComboIndex { get; set; }
Bindable<bool> LastInComboBindable { get; }
/// <summary>
/// Whether this is the last object in the current combo.
/// </summary>