1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Enable nullability on TimelineHitObjectBlueprint

This commit is contained in:
Dean Herbert 2022-09-05 14:50:43 +09:00
parent 07d4a025b0
commit 57954bb8f5

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -33,19 +31,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
private const float circle_size = 38;
private Container repeatsContainer;
private Container? repeatsContainer;
public Action<DragEvent> OnDragHandled;
public Action<DragEvent?>? OnDragHandled = null!;
[UsedImplicitly]
private readonly Bindable<double> startTime;
private Bindable<int> indexInCurrentComboBindable;
private Bindable<int>? indexInCurrentComboBindable;
private Bindable<int> comboIndexBindable;
private Bindable<int> comboIndexWithOffsetsBindable;
private Bindable<int>? comboIndexBindable;
private Bindable<int>? comboIndexWithOffsetsBindable;
private Bindable<Color4> displayColourBindable;
private Bindable<Color4> displayColourBindable = null!;
private readonly ExtendableCircle circle;
private readonly Border border;
@ -54,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly OsuSpriteText comboIndexText;
[Resolved]
private ISkinSource skin { get; set; }
private ISkinSource skin { get; set; } = null!;
public TimelineHitObjectBlueprint(HitObject item)
: base(item)
@ -124,7 +122,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
case IHasComboInformation comboInfo:
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
indexInCurrentComboBindable.BindValueChanged(_ => updateComboIndex(), true);
indexInCurrentComboBindable.BindValueChanged(_ =>
{
comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
}, true);
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
comboIndexWithOffsetsBindable = comboInfo.ComboIndexWithOffsetsBindable.GetBoundCopy();
@ -149,8 +150,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
updateColour();
}
private void updateComboIndex() => comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
private void updateColour()
{
Color4 colour;
@ -183,11 +182,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
colouredComponents.Colour = OsuColour.ForegroundTextColourFor(averageColour);
}
private SamplePointPiece sampleOverrideDisplay;
private DifficultyPointPiece difficultyOverrideDisplay;
private SamplePointPiece? sampleOverrideDisplay;
private DifficultyPointPiece? difficultyOverrideDisplay;
private DifficultyControlPoint difficultyControlPoint;
private SampleControlPoint sampleControlPoint;
private DifficultyControlPoint difficultyControlPoint = null!;
private SampleControlPoint sampleControlPoint = null!;
protected override void Update()
{
@ -276,16 +275,27 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public class DragArea : Circle
{
private readonly HitObject hitObject;
private readonly HitObject? hitObject;
[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 DragArea(HitObject hitObject)
public DragArea(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);
}
[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)
{
changeHandler?.BeginChange();
return true;
}
private ScheduledDelegate dragOperation;
protected override void OnDrag(DragEvent e)
{
base.OnDrag(e);