Enable nullability for timing screen

This commit is contained in:
ansel 2023-01-14 02:23:21 +03:00
parent 92062e4bb1
commit 78adaa9b03
19 changed files with 58 additions and 96 deletions

View File

@ -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.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -15,10 +13,10 @@ namespace osu.Game.Screens.Edit.Timing
{ {
internal partial class EffectSection : Section<EffectControlPoint> internal partial class EffectSection : Section<EffectControlPoint>
{ {
private LabelledSwitchButton kiai; private LabelledSwitchButton kiai = null!;
private LabelledSwitchButton omitBarLine; private LabelledSwitchButton omitBarLine = null!;
private SliderWithTextBoxInput<double> scrollSpeedSlider; private SliderWithTextBoxInput<double> scrollSpeedSlider = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -55,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing
private bool isRebinding; private bool isRebinding;
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point) protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint?> point)
{ {
if (point.NewValue != null) if (point.NewValue != null)
{ {

View File

@ -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.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -17,21 +15,21 @@ namespace osu.Game.Screens.Edit.Timing
{ {
internal partial class GroupSection : CompositeDrawable internal partial class GroupSection : CompositeDrawable
{ {
private LabelledTextBox textBox; private LabelledTextBox textBox = null!;
private OsuButton button; private OsuButton button = null!;
[Resolved] [Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } = null!;
[Resolved] [Resolved]
protected EditorBeatmap Beatmap { get; private set; } protected EditorBeatmap Beatmap { get; private set; } = null!;
[Resolved] [Resolved]
private EditorClock clock { get; set; } private EditorClock clock { get; set; } = null!;
[Resolved(canBeNull: true)] [Resolved]
private IEditorChangeHandler changeHandler { get; set; } private IEditorChangeHandler? changeHandler { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -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 System.Globalization; using System.Globalization;
using osu.Framework.Bindables; using osu.Framework.Bindables;

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -35,7 +33,7 @@ namespace osu.Game.Screens.Edit.Timing
set => current.Current = value; set => current.Current = value;
} }
private OsuNumberBox numeratorBox; private OsuNumberBox numeratorBox = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -1,10 +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.
#nullable disable
using System; using System;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
@ -28,24 +25,23 @@ namespace osu.Game.Screens.Edit.Timing
{ {
public partial class MetronomeDisplay : BeatSyncedContainer public partial class MetronomeDisplay : BeatSyncedContainer
{ {
private Container swing; private Container swing = null!;
private OsuSpriteText bpmText; private OsuSpriteText bpmText = null!;
private Drawable weight; private Drawable weight = null!;
private Drawable stick; private Drawable stick = null!;
private IAdjustableClock metronomeClock; private IAdjustableClock metronomeClock = null!;
private Sample sampleTick; private Sample? sampleTick;
private Sample sampleTickDownbeat; private Sample? sampleTickDownbeat;
private Sample sampleLatch; private Sample? sampleLatch;
[CanBeNull] private ScheduledDelegate? tickPlaybackDelegate;
private ScheduledDelegate tickPlaybackDelegate;
[Resolved] [Resolved]
private OverlayColourProvider overlayColourProvider { get; set; } private OverlayColourProvider overlayColourProvider { get; set; } = null!;
public bool EnableClicking { get; set; } = true; public bool EnableClicking { get; set; } = true;
@ -225,13 +221,13 @@ namespace osu.Game.Screens.Edit.Timing
private double beatLength; private double beatLength;
private TimingControlPoint timingPoint; private TimingControlPoint timingPoint = null!;
private bool isSwinging; private bool isSwinging;
private readonly BindableInt interpolatedBpm = new BindableInt(); private readonly BindableInt interpolatedBpm = new BindableInt();
private ScheduledDelegate latchDelegate; private ScheduledDelegate? latchDelegate;
protected override void LoadComplete() protected override void LoadComplete()
{ {

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
@ -23,10 +21,10 @@ namespace osu.Game.Screens.Edit.Timing
private readonly Drawable button; private readonly Drawable button;
private Sample sample; private Sample? sample;
public Action RepeatBegan; public Action? RepeatBegan;
public Action RepeatEnded; public Action? RepeatEnded;
/// <summary> /// <summary>
/// An additive modifier for the frequency of the sample played on next actuation. /// An additive modifier for the frequency of the sample played on next actuation.
@ -61,7 +59,7 @@ namespace osu.Game.Screens.Edit.Timing
base.OnMouseUp(e); base.OnMouseUp(e);
} }
private ScheduledDelegate adjustDelegate; private ScheduledDelegate? adjustDelegate;
private double adjustDelay = initial_delay; private double adjustDelay = initial_delay;
private void beginRepeat() private void beginRepeat()

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -21,9 +19,9 @@ namespace osu.Game.Screens.Edit.Timing
private readonly string label; private readonly string label;
protected Drawable Background { get; private set; } protected Drawable Background { get; private set; } = null!;
protected FillFlowContainer Content { get; private set; } protected FillFlowContainer Content { get; private set; } = null!;
public RowAttribute(ControlPoint point, string label) public RowAttribute(ControlPoint point, string label)
{ {

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -15,7 +13,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
private readonly BindableNumber<double> speedMultiplier; private readonly BindableNumber<double> speedMultiplier;
private OsuSpriteText text; private OsuSpriteText text = null!;
public DifficultyRowAttribute(DifficultyControlPoint difficulty) public DifficultyRowAttribute(DifficultyControlPoint difficulty)
: base(difficulty, "difficulty") : base(difficulty, "difficulty")

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -16,9 +14,9 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
private readonly Bindable<bool> omitBarLine; private readonly Bindable<bool> omitBarLine;
private readonly BindableNumber<double> scrollSpeed; private readonly BindableNumber<double> scrollSpeed;
private AttributeText kiaiModeBubble; private AttributeText kiaiModeBubble = null!;
private AttributeText omitBarLineBubble; private AttributeText omitBarLineBubble = null!;
private AttributeText text; private AttributeText text = null!;
public EffectRowAttribute(EffectControlPoint effect) public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect") : base(effect, "effect")

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -13,8 +11,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
public partial class SampleRowAttribute : RowAttribute public partial class SampleRowAttribute : RowAttribute
{ {
private AttributeText sampleText; private AttributeText sampleText = null!;
private OsuSpriteText volumeText; private OsuSpriteText volumeText = null!;
private readonly Bindable<string> sampleBank; private readonly Bindable<string> sampleBank;
private readonly BindableNumber<int> volume; private readonly BindableNumber<int> volume;

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions; using osu.Framework.Extensions;
@ -17,7 +15,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{ {
private readonly BindableNumber<double> beatLength; private readonly BindableNumber<double> beatLength;
private readonly Bindable<TimeSignature> timeSignature; private readonly Bindable<TimeSignature> timeSignature;
private OsuSpriteText text; private OsuSpriteText text = null!;
public TimingRowAttribute(TimingControlPoint timing) public TimingRowAttribute(TimingControlPoint timing)
: base(timing, "timing") : base(timing, "timing")

View File

@ -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.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -19,23 +17,23 @@ namespace osu.Game.Screens.Edit.Timing
internal abstract partial class Section<T> : CompositeDrawable internal abstract partial class Section<T> : CompositeDrawable
where T : ControlPoint where T : ControlPoint
{ {
private OsuCheckbox checkbox; private OsuCheckbox checkbox = null!;
private Container content; private Container content = null!;
protected FillFlowContainer Flow { get; private set; } protected FillFlowContainer Flow { get; private set; } = null!;
protected Bindable<T> ControlPoint { get; } = new Bindable<T>(); protected Bindable<T?> ControlPoint { get; } = new Bindable<T?>();
private const float header_height = 50; private const float header_height = 50;
[Resolved] [Resolved]
protected EditorBeatmap Beatmap { get; private set; } protected EditorBeatmap Beatmap { get; private set; } = null!;
[Resolved] [Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } = null!;
[Resolved(canBeNull: true)] [Resolved]
protected IEditorChangeHandler ChangeHandler { get; private set; } protected IEditorChangeHandler? ChangeHandler { get; private set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colours) private void load(OverlayColourProvider colours)
@ -128,7 +126,7 @@ namespace osu.Game.Screens.Edit.Timing
ControlPoint.BindValueChanged(OnControlPointChanged, true); ControlPoint.BindValueChanged(OnControlPointChanged, true);
} }
protected abstract void OnControlPointChanged(ValueChangedEvent<T> point); protected abstract void OnControlPointChanged(ValueChangedEvent<T?> point);
protected abstract T CreatePoint(); protected abstract T CreatePoint();
} }

View File

@ -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 System.Globalization; using System.Globalization;
using osu.Framework.Bindables; using osu.Framework.Bindables;

View File

@ -37,10 +37,10 @@ namespace osu.Game.Screens.Edit.Timing
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!; private OverlayColourProvider colourProvider { get; set; } = null!;
[Resolved(canBeNull: true)] [Resolved]
private Bindable<ControlPointGroup>? selectedGroup { get; set; } private Bindable<ControlPointGroup>? selectedGroup { get; set; }
[Resolved(canBeNull: true)] [Resolved]
private IBeatSyncProvider? beatSyncSource { get; set; } private IBeatSyncProvider? beatSyncSource { get; set; }
private Circle hoverLayer = null!; private Circle hoverLayer = null!;

View File

@ -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 System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -22,7 +20,7 @@ namespace osu.Game.Screens.Edit.Timing
/// </summary> /// </summary>
public partial class TimingAdjustButton : CompositeDrawable public partial class TimingAdjustButton : CompositeDrawable
{ {
public Action<double> Action; public Action<double>? Action;
private readonly double adjustAmount; private readonly double adjustAmount;
@ -44,10 +42,10 @@ namespace osu.Game.Screens.Edit.Timing
private readonly RepeatingButtonBehaviour repeatBehaviour; private readonly RepeatingButtonBehaviour repeatBehaviour;
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; } = null!;
[Resolved] [Resolved]
private EditorBeatmap editorBeatmap { get; set; } private EditorBeatmap editorBeatmap { get; set; } = null!;
public TimingAdjustButton(double adjustAmount) public TimingAdjustButton(double adjustAmount)
{ {
@ -104,7 +102,7 @@ namespace osu.Game.Screens.Edit.Timing
if (hoveredBox == null) if (hoveredBox == null)
return false; return false;
Action(adjustAmount * hoveredBox.Multiplier); Action?.Invoke(adjustAmount * hoveredBox.Multiplier);
hoveredBox.Flash(); hoveredBox.Flash();
@ -119,6 +117,9 @@ namespace osu.Game.Screens.Edit.Timing
private readonly Box box; private readonly Box box;
private readonly OsuSpriteText text; private readonly OsuSpriteText text;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public IncrementBox(int index, double amount) public IncrementBox(int index, double amount)
{ {
Multiplier = Math.Sign(index) * convertMultiplier(index); Multiplier = Math.Sign(index) * convertMultiplier(index);
@ -156,9 +157,6 @@ namespace osu.Game.Screens.Edit.Timing
}; };
} }
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();

View File

@ -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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -13,8 +11,8 @@ namespace osu.Game.Screens.Edit.Timing
{ {
internal partial class TimingSection : Section<TimingControlPoint> internal partial class TimingSection : Section<TimingControlPoint>
{ {
private LabelledTimeSignature timeSignature; private LabelledTimeSignature timeSignature = null!;
private BPMTextBox bpmTextEntry; private BPMTextBox bpmTextEntry = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -45,7 +43,7 @@ namespace osu.Game.Screens.Edit.Timing
private bool isRebinding; private bool isRebinding;
protected override void OnControlPointChanged(ValueChangedEvent<TimingControlPoint> point) protected override void OnControlPointChanged(ValueChangedEvent<TimingControlPoint?> point)
{ {
if (point.NewValue != null) if (point.NewValue != null)
{ {