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.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Collections.Generic;
using osu.Framework.Graphics;

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

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

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

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

View File

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

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 osu.Framework.Allocation;
using osu.Framework.Audio;
@ -23,10 +21,10 @@ namespace osu.Game.Screens.Edit.Timing
private readonly Drawable button;
private Sample sample;
private Sample? sample;
public Action RepeatBegan;
public Action RepeatEnded;
public Action? RepeatBegan;
public Action? RepeatEnded;
/// <summary>
/// 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);
}
private ScheduledDelegate adjustDelegate;
private ScheduledDelegate? adjustDelegate;
private double adjustDelay = initial_delay;
private void beginRepeat()

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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -21,9 +19,9 @@ namespace osu.Game.Screens.Edit.Timing
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)
{

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

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

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

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

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

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

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

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

View File

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

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

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