1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:03:22 +08:00

Merge branch 'master' into move-overlay-ruleset-selectors

This commit is contained in:
Bartłomiej Dach 2023-01-14 15:22:14 +01:00 committed by GitHub
commit 5e1ea8b34f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 319 additions and 410 deletions

View File

@ -188,7 +188,8 @@ namespace osu.Game.Rulesets.Catch.Edit
if (EditorBeatmap.PlacementObject.Value is JuiceStream)
{
// Juice stream path is not subject to snapping.
return null;
if (BlueprintContainer.CurrentPlacement.PlacementActive is PlacementBlueprint.PlacementState.Active)
return null;
}
double timeAtCursor = ((CatchPlayfield)Playfield).TimeAtScreenSpacePosition(inputManager.CurrentState.Mouse.Position);

View File

@ -73,16 +73,6 @@ namespace osu.Game.Tests.Gameplay
}
[Test]
[FlakyTest]
/*
* Fail rate around 0.15%
*
* TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : gameplay clock time = 2500
* --TearDown
* at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
* at osu.Framework.Threading.Scheduler.Update()
* at osu.Framework.Graphics.Drawable.UpdateSubTree()
*/
public void TestSeekPerformsInGameplayTime(
[Values(1.0, 0.5, 2.0)] double clockRate,
[Values(0.0, 200.0, -200.0)] double userOffset,
@ -92,6 +82,9 @@ namespace osu.Game.Tests.Gameplay
ClockBackedTestWorkingBeatmap working = null;
GameplayClockContainer gameplayClockContainer = null;
// ReSharper disable once NotAccessedVariable
BindableDouble trackAdjustment = null; // keeping a reference for track adjustment
if (setAudioOffsetBeforeConstruction)
AddStep($"preset audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
@ -103,16 +96,16 @@ namespace osu.Game.Tests.Gameplay
gameplayClockContainer.Reset(startClock: !whileStopped);
});
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate)));
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, trackAdjustment = new BindableDouble(clockRate)));
if (!setAudioOffsetBeforeConstruction)
AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500));
AddStep("gameplay clock time = 2500", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 2500, 10f));
AddAssert("gameplay clock time = 2500", () => gameplayClockContainer.CurrentTime, () => Is.EqualTo(2500).Within(10f));
AddStep("seek to 10000", () => gameplayClockContainer.Seek(10000));
AddStep("gameplay clock time = 10000", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 10000, 10f));
AddAssert("gameplay clock time = 10000", () => gameplayClockContainer.CurrentTime, () => Is.EqualTo(10000).Within(10f));
}
protected override void Dispose(bool isDisposing)

View File

@ -181,7 +181,8 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed);
AddStep("exit", () => Player.Exit());
AddAssert("ensure failing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == false);
AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
}
[Test]
@ -209,7 +210,9 @@ namespace osu.Game.Tests.Visual.Gameplay
addFakeHit();
AddStep("exit", () => Player.Exit());
AddAssert("ensure failing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == false);
AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
}
[Test]

View File

@ -1,13 +1,16 @@
// 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Comments;
using osuTK;
@ -20,8 +23,8 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
private TestCommentEditor commentEditor;
private TestCancellableCommentEditor cancellableCommentEditor;
private TestCommentEditor commentEditor = null!;
private TestCancellableCommentEditor cancellableCommentEditor = null!;
[SetUp]
public void SetUp() => Schedule(() =>
@ -45,15 +48,16 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("enter text", () => commentEditor.Current.Value = "text");
AddStep("press Enter", () => InputManager.Key(Key.Enter));
AddUntilStep("button is loading", () => commentEditor.IsSpinnerShown);
AddAssert("text committed", () => commentEditor.CommittedText == "text");
AddAssert("button is loading", () => commentEditor.IsLoading);
AddUntilStep("button is not loading", () => !commentEditor.IsSpinnerShown);
}
[Test]
@ -61,14 +65,14 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("press Enter", () => InputManager.Key(Key.Enter));
AddAssert("no text committed", () => commentEditor.CommittedText == null);
AddAssert("button is not loading", () => !commentEditor.IsLoading);
AddAssert("button is not loading", () => !commentEditor.IsSpinnerShown);
AddAssert("no text committed", () => commentEditor.CommittedText.Length == 0);
}
[Test]
@ -76,7 +80,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("enter text", () => commentEditor.Current.Value = "some other text");
@ -87,8 +91,9 @@ namespace osu.Game.Tests.Visual.UserInterface
InputManager.Click(MouseButton.Left);
});
AddUntilStep("button is loading", () => commentEditor.IsSpinnerShown);
AddAssert("text committed", () => commentEditor.CommittedText == "some other text");
AddAssert("button is loading", () => commentEditor.IsLoading);
AddUntilStep("button is not loading", () => !commentEditor.IsSpinnerShown);
}
[Test]
@ -96,7 +101,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click cancel button", () =>
{
InputManager.MoveMouseTo(cancellableCommentEditor.ButtonsContainer);
InputManager.MoveMouseTo(cancellableCommentEditor.ButtonsContainer[1]);
InputManager.Click(MouseButton.Left);
});
@ -108,28 +113,27 @@ namespace osu.Game.Tests.Visual.UserInterface
public new Bindable<string> Current => base.Current;
public new FillFlowContainer ButtonsContainer => base.ButtonsContainer;
public string CommittedText { get; private set; }
public string CommittedText { get; private set; } = string.Empty;
public TestCommentEditor()
{
OnCommit = onCommit;
}
public bool IsSpinnerShown => this.ChildrenOfType<LoadingSpinner>().Single().IsPresent;
private void onCommit(string value)
protected override void OnCommit(string value)
{
ShowLoadingSpinner = true;
CommittedText = value;
Scheduler.AddDelayed(() => IsLoading = false, 1000);
Scheduler.AddDelayed(() => ShowLoadingSpinner = false, 1000);
}
protected override string FooterText => @"Footer text. And it is pretty long. Cool.";
protected override string CommitButtonText => @"Commit";
protected override string TextBoxPlaceholder => @"This text box is empty";
protected override LocalisableString FooterText => @"Footer text. And it is pretty long. Cool.";
protected override LocalisableString CommitButtonText => @"Commit";
protected override LocalisableString TextBoxPlaceholder => @"This text box is empty";
}
private partial class TestCancellableCommentEditor : CancellableCommentEditor
{
public new FillFlowContainer ButtonsContainer => base.ButtonsContainer;
protected override string FooterText => @"Wow, another one. Sicc";
protected override LocalisableString FooterText => @"Wow, another one. Sicc";
public bool Cancelled { get; private set; }
@ -138,8 +142,12 @@ namespace osu.Game.Tests.Visual.UserInterface
OnCancel = () => Cancelled = true;
}
protected override string CommitButtonText => @"Save";
protected override string TextBoxPlaceholder => @"Multiline textboxes soon";
protected override void OnCommit(string text)
{
}
protected override LocalisableString CommitButtonText => @"Save";
protected override LocalisableString TextBoxPlaceholder => @"Multiline textboxes soon";
}
}
}

View File

@ -15,10 +15,52 @@ namespace osu.Game.Localisation
public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"notifications");
/// <summary>
/// "waiting for 'ya"
/// "waiting for &#39;ya"
/// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"waiting for 'ya");
private static string getKey(string key) => $"{prefix}:{key}";
/// <summary>
/// "Running Tasks"
/// </summary>
public static LocalisableString RunningTasks => new TranslatableString(getKey(@"running_tasks"), @"Running Tasks");
/// <summary>
/// "Clear All"
/// </summary>
public static LocalisableString ClearAll => new TranslatableString(getKey(@"clear_all"), @"Clear All");
/// <summary>
/// "Cancel All"
/// </summary>
public static LocalisableString CancelAll => new TranslatableString(getKey(@"cancel_all"), @"Cancel All");
/// <summary>
/// "Your battery level is low! Charge your device to prevent interruptions during gameplay."
/// </summary>
public static LocalisableString BatteryLow => new TranslatableString(getKey(@"battery_low"), @"Your battery level is low! Charge your device to prevent interruptions during gameplay.");
/// <summary>
/// "Your game volume is too low to hear anything! Click here to restore it."
/// </summary>
public static LocalisableString GameVolumeTooLow => new TranslatableString(getKey(@"game_volume_too_low"), @"Your game volume is too low to hear anything! Click here to restore it.");
/// <summary>
/// "The current ruleset doesn&#39;t have an autoplay mod available!"
/// </summary>
public static LocalisableString NoAutoplayMod => new TranslatableString(getKey(@"no_autoplay_mod"), @"The current ruleset doesn't have an autoplay mod available!");
/// <summary>
/// "osu! doesn&#39;t seem to be able to play audio correctly.\n\nPlease try changing your audio device to a working setting."
/// </summary>
public static LocalisableString AudioPlaybackIssue => new TranslatableString(getKey(@"audio_playback_issue"),
@"osu! doesn't seem to be able to play audio correctly.\n\nPlease try changing your audio device to a working setting.");
/// <summary>
/// "The score overlay is currently disabled. You can toggle this by pressing {0}."
/// </summary>
public static LocalisableString ScoreOverlayDisabled(LocalisableString arg0) => new TranslatableString(getKey(@"score_overlay_disabled"),
@"The score overlay is currently disabled. You can toggle this by pressing {0}.", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -8,7 +8,7 @@ namespace osu.Game.Online.API.Requests.Responses
public class APIUserGroup
{
[JsonProperty(@"colour")]
public string Colour { get; set; } = null!;
public string? Colour { get; set; }
[JsonProperty(@"has_listing")]
public bool HasListings { get; set; }

View File

@ -1,76 +1,24 @@
// 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.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
public abstract partial class CancellableCommentEditor : CommentEditor
{
public Action OnCancel;
public Action? OnCancel;
[BackgroundDependencyLoader]
private void load()
{
ButtonsContainer.Add(new CancelButton
ButtonsContainer.Add(new EditorButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Action = () => OnCancel?.Invoke()
Action = () => OnCancel?.Invoke(),
Text = CommonStrings.ButtonsCancel,
});
}
private partial class CancelButton : OsuHoverContainer
{
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly Box background;
public CancelButton()
: base(HoverSampleSet.Button)
{
AutoSizeAxes = Axes.Both;
Child = new CircularContainer
{
Masking = true,
Height = 25,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both
},
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = CommonStrings.ButtonsCancel
}
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Light4;
HoverColour = colourProvider.Light3;
}
}
}
}

View File

@ -1,22 +1,20 @@
// 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.Containers;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Sprites;
using osuTK.Graphics;
using osu.Game.Graphics.UserInterface;
using System.Collections.Generic;
using System;
using osu.Game.Graphics.UserInterfaceV2;
using osuTK;
using osu.Framework.Bindables;
using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
{
@ -24,26 +22,32 @@ namespace osu.Game.Overlays.Comments
{
private const int side_padding = 8;
public Action<string> OnCommit;
protected abstract LocalisableString FooterText { get; }
public bool IsLoading
protected abstract LocalisableString CommitButtonText { get; }
protected abstract LocalisableString TextBoxPlaceholder { get; }
protected FillFlowContainer ButtonsContainer { get; private set; } = null!;
protected readonly Bindable<string> Current = new Bindable<string>(string.Empty);
private RoundedButton commitButton = null!;
private LoadingSpinner loadingSpinner = null!;
protected bool ShowLoadingSpinner
{
get => commitButton.IsLoading;
set => commitButton.IsLoading = value;
set
{
if (value)
loadingSpinner.Show();
else
loadingSpinner.Hide();
updateCommitButtonState();
}
}
protected abstract string FooterText { get; }
protected abstract string CommitButtonText { get; }
protected abstract string TextBoxPlaceholder { get; }
protected FillFlowContainer ButtonsContainer { get; private set; }
protected readonly Bindable<string> Current = new Bindable<string>();
private CommitButton commitButton;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
@ -79,7 +83,7 @@ namespace osu.Game.Overlays.Comments
},
new Container
{
Name = "Footer",
Name = @"Footer",
RelativeSizeAxes = Axes.X,
Height = 35,
Padding = new MarginPadding { Horizontal = side_padding },
@ -92,54 +96,64 @@ namespace osu.Game.Overlays.Comments
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = FooterText
},
ButtonsContainer = new FillFlowContainer
new FillFlowContainer
{
Name = "Buttons",
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Child = commitButton = new CommitButton(CommitButtonText)
Children = new Drawable[]
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Action = () =>
ButtonsContainer = new FillFlowContainer
{
OnCommit?.Invoke(Current.Value);
Current.Value = string.Empty;
}
Name = @"Buttons",
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Child = commitButton = new EditorButton
{
Text = CommitButtonText,
Action = () => OnCommit(Current.Value)
}
},
loadingSpinner = new LoadingSpinner
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Size = new Vector2(18),
},
}
}
},
}
}
}
}
});
textBox.OnCommit += (_, _) =>
{
if (commitButton.IsBlocked.Value)
return;
commitButton.TriggerClick();
};
textBox.OnCommit += (_, _) => commitButton.TriggerClick();
}
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(text => commitButton.IsBlocked.Value = string.IsNullOrEmpty(text.NewValue), true);
Current.BindValueChanged(_ => updateCommitButtonState(), true);
}
protected abstract void OnCommit(string text);
private void updateCommitButtonState() =>
commitButton.Enabled.Value = loadingSpinner.State.Value == Visibility.Hidden && !string.IsNullOrEmpty(Current.Value);
private partial class EditorTextBox : BasicTextBox
{
protected override float LeftRightPadding => side_padding;
protected override Color4 SelectionColour => Color4.Gray;
private OsuSpriteText placeholder;
private OsuSpriteText placeholder = null!;
public EditorTextBox()
{
@ -163,88 +177,26 @@ namespace osu.Game.Overlays.Comments
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
AutoSizeAxes = Axes.Both,
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }
};
}
private partial class CommitButton : LoadingButton
protected partial class EditorButton : RoundedButton
{
private const int duration = 200;
public readonly BindableBool IsBlocked = new BindableBool();
public override bool PropagatePositionalInputSubTree => !IsBlocked.Value && base.PropagatePositionalInputSubTree;
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly string text;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private OsuSpriteText drawableText;
private Box background;
private Box blockedBackground;
public CommitButton(string text)
public EditorButton()
{
this.text = text;
AutoSizeAxes = Axes.Both;
LoadingAnimationSize = new Vector2(10);
Width = 80;
Height = 25;
Anchor = Anchor.CentreRight;
Origin = Anchor.CentreRight;
}
[BackgroundDependencyLoader]
private void load()
protected override SpriteText CreateText()
{
IdleColour = colourProvider.Light4;
HoverColour = colourProvider.Light3;
blockedBackground.Colour = colourProvider.Background5;
var t = base.CreateText();
t.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12);
return t;
}
protected override void LoadComplete()
{
base.LoadComplete();
IsBlocked.BindValueChanged(onBlockedStateChanged, true);
}
private void onBlockedStateChanged(ValueChangedEvent<bool> isBlocked)
{
drawableText.FadeColour(isBlocked.NewValue ? colourProvider.Foreground1 : Color4.White, duration, Easing.OutQuint);
background.FadeTo(isBlocked.NewValue ? 0 : 1, duration, Easing.OutQuint);
}
protected override Drawable CreateContent() => new CircularContainer
{
Masking = true,
Height = 25,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
blockedBackground = new Box
{
RelativeSizeAxes = Axes.Both
},
background = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0
},
drawableText = new OsuSpriteText
{
AlwaysPresent = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = text,
}
}
};
protected override void OnLoadStarted() => drawableText.FadeOut(duration, Easing.OutQuint);
protected override void OnLoadFinished() => drawableText.FadeIn(duration, Easing.OutQuint);
}
}
}

View File

@ -7,10 +7,10 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Login
{
public const float LABEL_LEFT_MARGIN = 20;
private readonly SpriteIcon statusIcon;
private readonly StatusIcon statusIcon;
public Color4 StatusColour
{
@ -101,11 +101,10 @@ namespace osu.Game.Overlays.Login
Icon.Size = new Vector2(14);
Icon.Margin = new MarginPadding(0);
Foreground.Add(statusIcon = new SpriteIcon
Foreground.Add(statusIcon = new StatusIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.Regular.Circle,
Size = new Vector2(14),
});

View File

@ -92,8 +92,8 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
Children = new[]
{
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(SimpleNotification) }, "Clear All"),
new NotificationSection(@"Running Tasks", new[] { typeof(ProgressNotification) }, @"Cancel All"),
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(SimpleNotification) }, NotificationsStrings.ClearAll),
new NotificationSection(NotificationsStrings.RunningTasks, new[] { typeof(ProgressNotification) }, NotificationsStrings.CancelAll),
}
}
}

View File

@ -33,15 +33,15 @@ namespace osu.Game.Overlays.Notifications
public IEnumerable<Type> AcceptedNotificationTypes { get; }
private readonly string clearButtonText;
private readonly LocalisableString clearButtonText;
private readonly LocalisableString titleText;
public NotificationSection(LocalisableString title, IEnumerable<Type> acceptedNotificationTypes, string clearButtonText)
public NotificationSection(LocalisableString title, IEnumerable<Type> acceptedNotificationTypes, LocalisableString clearButtonText)
{
AcceptedNotificationTypes = acceptedNotificationTypes.ToArray();
this.clearButtonText = clearButtonText.ToUpperInvariant();
this.clearButtonText = clearButtonText.ToUpper();
titleText = title;
}

View File

@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new OsuSpriteText
{
Text = group.ShortName,
Colour = Color4Extensions.FromHex(group.Colour),
Colour = Color4Extensions.FromHex(group.Colour ?? Colour4.White.ToHex()),
Shadow = false,
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected new EditorSelectionHandler SelectionHandler => (EditorSelectionHandler)base.SelectionHandler;
private PlacementBlueprint currentPlacement;
public PlacementBlueprint CurrentPlacement { get; private set; }
/// <remarks>
/// Positional input must be received outside the container's bounds,
@ -137,13 +137,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updatePlacementNewCombo()
{
if (currentPlacement?.HitObject is IHasComboInformation c)
if (CurrentPlacement?.HitObject is IHasComboInformation c)
c.NewCombo = NewCombo.Value == TernaryState.True;
}
private void updatePlacementSamples()
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
foreach (var kvp in SelectionHandler.SelectionSampleStates)
sampleChanged(kvp.Key, kvp.Value.Value);
@ -151,9 +151,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void sampleChanged(string sampleName, TernaryState state)
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
var samples = currentPlacement.HitObject.Samples;
var samples = CurrentPlacement.HitObject.Samples;
var existingSample = samples.FirstOrDefault(s => s.Name == sampleName);
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
// if no time was found from positional snapping, we should still quantize to the beat.
snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null);
currentPlacement.UpdateTimeAndPosition(snapResult);
CurrentPlacement.UpdateTimeAndPosition(snapResult);
}
#endregion
@ -234,9 +234,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
base.Update();
if (currentPlacement != null)
if (CurrentPlacement != null)
{
switch (currentPlacement.PlacementActive)
switch (CurrentPlacement.PlacementActive)
{
case PlacementBlueprint.PlacementState.Waiting:
if (!Composer.CursorInPlacementArea)
@ -252,7 +252,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (Composer.CursorInPlacementArea)
ensurePlacementCreated();
if (currentPlacement != null)
if (CurrentPlacement != null)
updatePlacementPosition();
}
@ -281,13 +281,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void ensurePlacementCreated()
{
if (currentPlacement != null) return;
if (CurrentPlacement != null) return;
var blueprint = CurrentTool?.CreatePlacementBlueprint();
if (blueprint != null)
{
placementBlueprintContainer.Child = currentPlacement = blueprint;
placementBlueprintContainer.Child = CurrentPlacement = blueprint;
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
updatePlacementPosition();
@ -300,11 +300,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void removePlacement()
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
currentPlacement.EndPlacement(false);
currentPlacement.Expire();
currentPlacement = null;
CurrentPlacement.EndPlacement(false);
CurrentPlacement.Expire();
CurrentPlacement = null;
}
private HitObjectCompositionTool currentTool;

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
namespace osu.Game.Screens.Edit.Design
{
public partial class DesignScreen : EditorScreen

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.Localisation;
@ -15,7 +13,7 @@ namespace osu.Game.Screens.Edit.Setup
{
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
private LabelledColourPalette comboColours;
private LabelledColourPalette comboColours = null!;
[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 System.Linq;
@ -19,16 +17,16 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class DesignSection : SetupSection
{
protected LabelledSwitchButton EnableCountdown;
protected LabelledSwitchButton EnableCountdown = null!;
protected FillFlowContainer CountdownSettings;
protected LabelledEnumDropdown<CountdownType> CountdownSpeed;
protected LabelledNumberBox CountdownOffset;
protected FillFlowContainer CountdownSettings = null!;
protected LabelledEnumDropdown<CountdownType> CountdownSpeed = null!;
protected LabelledNumberBox CountdownOffset = null!;
private LabelledSwitchButton widescreenSupport;
private LabelledSwitchButton epilepsyWarning;
private LabelledSwitchButton letterboxDuringBreaks;
private LabelledSwitchButton samplesMatchPlaybackRate;
private LabelledSwitchButton widescreenSupport = null!;
private LabelledSwitchButton epilepsyWarning = null!;
private LabelledSwitchButton letterboxDuringBreaks = null!;
private LabelledSwitchButton samplesMatchPlaybackRate = null!;
public override LocalisableString Title => EditorSetupStrings.DesignHeader;

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,10 +15,10 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class DifficultySection : SetupSection
{
private LabelledSliderBar<float> circleSizeSlider;
private LabelledSliderBar<float> healthDrainSlider;
private LabelledSliderBar<float> approachRateSlider;
private LabelledSliderBar<float> overallDifficultySlider;
private LabelledSliderBar<float> circleSizeSlider = null!;
private LabelledSliderBar<float> healthDrainSlider = null!;
private LabelledSliderBar<float> approachRateSlider = null!;
private LabelledSliderBar<float> overallDifficultySlider = null!;
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;

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.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;

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.Extensions;
using osu.Framework.Graphics;
@ -30,7 +28,7 @@ namespace osu.Game.Screens.Edit.Setup
internal partial class PopoverTextBox : OsuTextBox
{
public Action OnFocused;
public Action? OnFocused;
protected override bool OnDragStart(DragStartEvent e)
{

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.Graphics.UserInterface;
@ -16,16 +14,16 @@ namespace osu.Game.Screens.Edit.Setup
{
public partial class MetadataSection : SetupSection
{
protected LabelledTextBox ArtistTextBox;
protected LabelledTextBox RomanisedArtistTextBox;
protected LabelledTextBox ArtistTextBox = null!;
protected LabelledTextBox RomanisedArtistTextBox = null!;
protected LabelledTextBox TitleTextBox;
protected LabelledTextBox RomanisedTitleTextBox;
protected LabelledTextBox TitleTextBox = null!;
protected LabelledTextBox RomanisedTitleTextBox = null!;
private LabelledTextBox creatorTextBox;
private LabelledTextBox difficultyTextBox;
private LabelledTextBox sourceTextBox;
private LabelledTextBox tagsTextBox;
private LabelledTextBox creatorTextBox = null!;
private LabelledTextBox difficultyTextBox = null!;
private LabelledTextBox sourceTextBox = null!;
private LabelledTextBox tagsTextBox = null!;
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;

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.Localisation;
using osu.Game.Rulesets;
using osu.Game.Localisation;

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.Allocation;
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.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
@ -18,12 +16,12 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class SetupScreenHeader : OverlayHeader
{
public SetupScreenHeaderBackground Background { get; private set; }
public SetupScreenHeaderBackground Background { get; private set; } = null!;
[Resolved]
private SectionsContainer<SetupSection> sections { get; set; }
private SectionsContainer<SetupSection> sections { get; set; } = null!;
private SetupScreenTabControl tabControl;
private SetupScreenTabControl tabControl = null!;
protected override OverlayTitle CreateTitle() => new SetupScreenTitle();

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;
@ -18,10 +16,10 @@ namespace osu.Game.Screens.Edit.Setup
public partial class SetupScreenHeaderBackground : CompositeDrawable
{
[Resolved]
private OsuColour colours { get; set; }
private OsuColour colours { get; set; } = null!;
[Resolved]
private IBindable<WorkingBeatmap> working { get; set; }
private IBindable<WorkingBeatmap> working { get; set; } = null!;
private readonly Container content;

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;
@ -16,7 +14,7 @@ namespace osu.Game.Screens.Edit.Setup
{
public abstract partial class SetupSection : Container
{
private FillFlowContainer flow;
private FillFlowContainer flow = null!;
/// <summary>
/// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look.
@ -24,10 +22,10 @@ namespace osu.Game.Screens.Edit.Setup
protected const float LABEL_WIDTH = 160;
[Resolved]
protected OsuColour Colours { get; private set; }
protected OsuColour Colours { get; private set; } = null!;
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; } = null!;
protected override Container<Drawable> Content => flow;

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)
{

View File

@ -20,6 +20,7 @@ using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
@ -201,7 +202,7 @@ namespace osu.Game.Screens.Menu
{
notifications.Post(new SimpleErrorNotification
{
Text = "osu! doesn't seem to be able to play audio correctly.\n\nPlease try changing your audio device to a working setting."
Text = NotificationsStrings.AudioPlaybackIssue
});
}
}, 5000);

View File

@ -24,6 +24,7 @@ using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.HUD.ClicksPerSecond;
using osu.Game.Skinning;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Screens.Play
{
@ -172,7 +173,7 @@ namespace osu.Game.Screens.Play
notificationOverlay?.Post(new SimpleNotification
{
Text = $"The score overlay is currently disabled. You can toggle this by pressing {config.LookupKeyBindings(GlobalAction.ToggleInGameInterface)}."
Text = NotificationsStrings.ScoreOverlayDisabled(config.LookupKeyBindings(GlobalAction.ToggleInGameInterface))
});
}

View File

@ -20,6 +20,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Input;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Screens.Menu;
@ -130,16 +131,16 @@ namespace osu.Game.Screens.Play
private bool quickRestart;
[Resolved(CanBeNull = true)]
[Resolved]
private INotificationOverlay? notificationOverlay { get; set; }
[Resolved(CanBeNull = true)]
[Resolved]
private VolumeOverlay? volumeOverlay { get; set; }
[Resolved]
private AudioManager audioManager { get; set; } = null!;
[Resolved(CanBeNull = true)]
[Resolved]
private BatteryInfo? batteryInfo { get; set; }
public PlayerLoader(Func<Player> createPlayer)
@ -550,7 +551,7 @@ namespace osu.Game.Screens.Play
public MutedNotification()
{
Text = "Your game volume is too low to hear anything! Click here to restore it.";
Text = NotificationsStrings.GameVolumeTooLow;
}
[BackgroundDependencyLoader]
@ -605,7 +606,7 @@ namespace osu.Game.Screens.Play
public BatteryWarningNotification()
{
Text = "Your battery level is low! Charge your device to prevent interruptions during gameplay.";
Text = NotificationsStrings.BatteryLow;
}
[BackgroundDependencyLoader]

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Mods;
@ -24,7 +25,7 @@ namespace osu.Game.Screens.Select
{
private OsuScreen? playerLoader;
[Resolved(CanBeNull = true)]
[Resolved]
private INotificationOverlay? notifications { get; set; }
public override bool AllowExternalScreenChange => true;
@ -89,7 +90,7 @@ namespace osu.Game.Screens.Select
{
notifications?.Post(new SimpleNotification
{
Text = "The current ruleset doesn't have an autoplay mod avalaible!"
Text = NotificationsStrings.NoAutoplayMod
});
return false;
}

View File

@ -0,0 +1,26 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Game.Users.Drawables
{
public partial class StatusIcon : CircularContainer
{
public StatusIcon()
{
Size = new Vector2(25);
BorderThickness = 4;
BorderColour = Colour4.White; // the colour is being applied through Colour - since it's multiplicative it applies to the border as well
Masking = true;
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.White.Opacity(0)
};
}
}
}

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Sprites;
using osu.Game.Users.Drawables;
using osu.Framework.Input.Events;
using osu.Game.Online.API.Requests.Responses;
@ -25,7 +24,7 @@ namespace osu.Game.Users
protected TextFlowContainer LastVisitMessage { get; private set; }
private SpriteIcon statusIcon;
private StatusIcon statusIcon;
private OsuSpriteText statusMessage;
protected ExtendedUserPanel(APIUser user)
@ -59,11 +58,7 @@ namespace osu.Game.Users
Action = Action,
};
protected SpriteIcon CreateStatusIcon() => statusIcon = new SpriteIcon
{
Icon = FontAwesome.Regular.Circle,
Size = new Vector2(25)
};
protected Container CreateStatusIcon() => statusIcon = new StatusIcon();
protected FillFlowContainer CreateStatusMessage(bool rightAlignedChildren)
{