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

Code quality pass

This commit is contained in:
Dean Herbert 2023-09-28 16:19:06 +09:00
parent 2800920ed9
commit b8953e8ce1
2 changed files with 13 additions and 16 deletions

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Direction = FillDirection.Full,
ChildrenEnumerable = Ruleset.Value.CreateInstance().CreateAllMods()
.OfType<ModRateAdjust>()
.SelectMany((m) =>
.SelectMany(m =>
{
List<ModIcon> icons = new List<ModIcon> { new ModIcon(m) };
@ -70,10 +70,9 @@ namespace osu.Game.Tests.Visual.UserInterface
{
if (icon.Mod is ModRateAdjust rateAdjust)
{
if (RNG.NextDouble() > 0.9)
rateAdjust.SpeedChange.Value = rateAdjust.SpeedChange.Default;
else
rateAdjust.SpeedChange.Value = RNG.NextDouble(rateAdjust.SpeedChange.MinValue, rateAdjust.SpeedChange.MaxValue);
rateAdjust.SpeedChange.Value = RNG.NextDouble() > 0.9
? rateAdjust.SpeedChange.Default
: RNG.NextDouble(rateAdjust.SpeedChange.MinValue, rateAdjust.SpeedChange.MaxValue);
}
}
});

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 osuTK.Graphics;
using osu.Framework.Allocation;
@ -29,13 +27,13 @@ namespace osu.Game.Rulesets.UI
{
public readonly BindableBool Selected = new BindableBool();
private SpriteIcon modIcon;
private SpriteText modAcronym;
private SpriteIcon background;
private SpriteIcon modIcon = null!;
private SpriteText modAcronym = null!;
private SpriteIcon background = null!;
private const float size = 80;
public virtual LocalisableString TooltipText => showTooltip ? ((mod as Mod)?.IconTooltip ?? mod.Name) : null;
public virtual LocalisableString TooltipText => showTooltip ? ((mod as Mod)?.IconTooltip ?? mod.Name) : string.Empty;
private IMod mod;
@ -58,17 +56,17 @@ namespace osu.Game.Rulesets.UI
}
[Resolved]
private OsuColour colours { get; set; }
private OsuColour colours { get; set; } = null!;
private Color4 backgroundColour;
private Sprite extendedBackground;
private Sprite extendedBackground = null!;
private OsuSpriteText extendedText;
private OsuSpriteText extendedText = null!;
private Container extendedContent;
private Container extendedContent = null!;
private ModSettingChangeTracker modSettingsChangeTracker;
private ModSettingChangeTracker? modSettingsChangeTracker;
/// <summary>
/// Construct a new instance.