mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Enable nullability on TimelineHitObjectBlueprint
This commit is contained in:
parent
07d4a025b0
commit
57954bb8f5
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -33,19 +31,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
private const float circle_size = 38;
|
private const float circle_size = 38;
|
||||||
|
|
||||||
private Container repeatsContainer;
|
private Container? repeatsContainer;
|
||||||
|
|
||||||
public Action<DragEvent> OnDragHandled;
|
public Action<DragEvent?>? OnDragHandled = null!;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private readonly Bindable<double> startTime;
|
private readonly Bindable<double> startTime;
|
||||||
|
|
||||||
private Bindable<int> indexInCurrentComboBindable;
|
private Bindable<int>? indexInCurrentComboBindable;
|
||||||
|
|
||||||
private Bindable<int> comboIndexBindable;
|
private Bindable<int>? comboIndexBindable;
|
||||||
private Bindable<int> comboIndexWithOffsetsBindable;
|
private Bindable<int>? comboIndexWithOffsetsBindable;
|
||||||
|
|
||||||
private Bindable<Color4> displayColourBindable;
|
private Bindable<Color4> displayColourBindable = null!;
|
||||||
|
|
||||||
private readonly ExtendableCircle circle;
|
private readonly ExtendableCircle circle;
|
||||||
private readonly Border border;
|
private readonly Border border;
|
||||||
@ -54,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
private readonly OsuSpriteText comboIndexText;
|
private readonly OsuSpriteText comboIndexText;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ISkinSource skin { get; set; }
|
private ISkinSource skin { get; set; } = null!;
|
||||||
|
|
||||||
public TimelineHitObjectBlueprint(HitObject item)
|
public TimelineHitObjectBlueprint(HitObject item)
|
||||||
: base(item)
|
: base(item)
|
||||||
@ -124,7 +122,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
case IHasComboInformation comboInfo:
|
case IHasComboInformation comboInfo:
|
||||||
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
|
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
|
||||||
indexInCurrentComboBindable.BindValueChanged(_ => updateComboIndex(), true);
|
indexInCurrentComboBindable.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
|
||||||
|
}, true);
|
||||||
|
|
||||||
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
|
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
|
||||||
comboIndexWithOffsetsBindable = comboInfo.ComboIndexWithOffsetsBindable.GetBoundCopy();
|
comboIndexWithOffsetsBindable = comboInfo.ComboIndexWithOffsetsBindable.GetBoundCopy();
|
||||||
@ -149,8 +150,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
updateColour();
|
updateColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateComboIndex() => comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
|
|
||||||
|
|
||||||
private void updateColour()
|
private void updateColour()
|
||||||
{
|
{
|
||||||
Color4 colour;
|
Color4 colour;
|
||||||
@ -183,11 +182,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
colouredComponents.Colour = OsuColour.ForegroundTextColourFor(averageColour);
|
colouredComponents.Colour = OsuColour.ForegroundTextColourFor(averageColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SamplePointPiece sampleOverrideDisplay;
|
private SamplePointPiece? sampleOverrideDisplay;
|
||||||
private DifficultyPointPiece difficultyOverrideDisplay;
|
private DifficultyPointPiece? difficultyOverrideDisplay;
|
||||||
|
|
||||||
private DifficultyControlPoint difficultyControlPoint;
|
private DifficultyControlPoint difficultyControlPoint = null!;
|
||||||
private SampleControlPoint sampleControlPoint;
|
private SampleControlPoint sampleControlPoint = null!;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
@ -276,16 +275,27 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
public class DragArea : Circle
|
public class DragArea : Circle
|
||||||
{
|
{
|
||||||
private readonly HitObject hitObject;
|
private readonly HitObject? hitObject;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Timeline timeline { get; set; }
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
public Action<DragEvent> OnDragHandled;
|
[Resolved]
|
||||||
|
private IBeatSnapProvider beatSnapProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Timeline timeline { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private IEditorChangeHandler? changeHandler { get; set; }
|
||||||
|
|
||||||
|
private ScheduledDelegate? dragOperation;
|
||||||
|
|
||||||
|
public Action<DragEvent?>? OnDragHandled;
|
||||||
|
|
||||||
public override bool HandlePositionalInput => hitObject != null;
|
public override bool HandlePositionalInput => hitObject != null;
|
||||||
|
|
||||||
public DragArea(HitObject hitObject)
|
public DragArea(HitObject? hitObject)
|
||||||
{
|
{
|
||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
||||||
|
|
||||||
@ -356,23 +366,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
this.FadeTo(IsHovered || hasMouseDown ? 1f : 0.9f, 200, Easing.OutQuint);
|
this.FadeTo(IsHovered || hasMouseDown ? 1f : 0.9f, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private EditorBeatmap beatmap { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private IBeatSnapProvider beatSnapProvider { get; set; }
|
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private IEditorChangeHandler changeHandler { get; set; }
|
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
{
|
{
|
||||||
changeHandler?.BeginChange();
|
changeHandler?.BeginChange();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate dragOperation;
|
|
||||||
|
|
||||||
protected override void OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
base.OnDrag(e);
|
base.OnDrag(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user