Merge pull request #4349 from peppy/more-inspections

Enable more stringent inspectcode style inspections
This commit is contained in:
Dean Herbert 2019-02-28 14:52:52 +09:00 committed by GitHub
commit e39604619d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
256 changed files with 719 additions and 227 deletions

View File

@ -34,13 +34,16 @@ namespace osu.Game.Rulesets.Catch.Tests
case JuiceStream stream:
foreach (var nested in stream.NestedHitObjects)
yield return new ConvertValue((CatchHitObject)nested);
break;
case BananaShower shower:
foreach (var nested in shower.NestedHitObjects)
yield return new ConvertValue((CatchHitObject)nested);
break;
default:
yield return new ConvertValue((CatchHitObject)hitObject);
break;
}
}

View File

@ -8,7 +8,8 @@ namespace osu.Game.Rulesets.Catch.Tests
[TestFixture]
public class TestCaseCatchPlayer : Game.Tests.Visual.TestCasePlayer
{
public TestCaseCatchPlayer() : base(new CatchRuleset())
public TestCaseCatchPlayer()
: base(new CatchRuleset())
{
}
}

View File

@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
rng.Next(); // osu!stable retrieved a random banana rotation
rng.Next(); // osu!stable retrieved a random banana colour
}
break;
case JuiceStream juiceStream:
foreach (var nested in juiceStream.NestedHitObjects)
@ -67,6 +68,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
rng.Next(); // osu!stable retrieved a random droplet rotation
hitObject.X = MathHelper.Clamp(hitObject.X, 0, 1);
}
break;
}
}

View File

@ -19,8 +19,10 @@ namespace osu.Game.Rulesets.Catch
{
[Description("Move left")]
MoveLeft,
[Description("Move right")]
MoveRight,
[Description("Engage dash")]
Dash,
}

View File

@ -68,14 +68,17 @@ namespace osu.Game.Rulesets.Catch.Difficulty
// We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations.
case Fruit fruit:
yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth);
lastObject = hitObject;
break;
case JuiceStream _:
foreach (var nested in hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet)))
{
yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth);
lastObject = nested;
}
break;
}
}

View File

@ -33,11 +33,11 @@ namespace osu.Game.Rulesets.Catch.MathUtils
/// <returns>The random value.</returns>
public uint NextUInt()
{
uint t = _x ^ _x << 11;
uint t = _x ^ (_x << 11);
_x = _y;
_y = _z;
_z = _w;
return _w = _w ^ _w >> 19 ^ t ^ t >> 8;
return _w = _w ^ (_w >> 19) ^ t ^ (t >> 8);
}
/// <summary>

View File

@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
}
private Color4 accentColour;
public Color4 AccentColour
{
get => accentColour;

View File

@ -40,29 +40,29 @@ namespace osu.Game.Rulesets.Mania.Tests
protected override Ruleset CreateRuleset() => new ManiaRuleset();
}
public class ManiaConvertMapping : ConvertMapping<ConvertValue>, IEquatable<ManiaConvertMapping>
{
public uint RandomW;
public uint RandomX;
public uint RandomY;
public uint RandomZ;
public class ManiaConvertMapping : ConvertMapping<ConvertValue>, IEquatable<ManiaConvertMapping>
{
public uint RandomW;
public uint RandomX;
public uint RandomY;
public uint RandomZ;
public ManiaConvertMapping()
{
}
public ManiaConvertMapping()
{
}
public ManiaConvertMapping(IBeatmapConverter converter)
{
var maniaConverter = (ManiaBeatmapConverter)converter;
RandomW = maniaConverter.Random.W;
RandomX = maniaConverter.Random.X;
RandomY = maniaConverter.Random.Y;
RandomZ = maniaConverter.Random.Z;
}
public ManiaConvertMapping(IBeatmapConverter converter)
{
var maniaConverter = (ManiaBeatmapConverter)converter;
RandomW = maniaConverter.Random.W;
RandomX = maniaConverter.Random.X;
RandomY = maniaConverter.Random.Y;
RandomZ = maniaConverter.Random.Z;
}
public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ;
public override bool Equals(ConvertMapping<ConvertValue> other) => base.Equals(other) && Equals(other as ManiaConvertMapping);
}
public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ;
public override bool Equals(ConvertMapping<ConvertValue> other) => base.Equals(other) && Equals(other as ManiaConvertMapping);
}
public struct ConvertValue : IEquatable<ConvertValue>
{

View File

@ -78,6 +78,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
if (maniaOriginal != null)
{
yield return maniaOriginal;
yield break;
}
@ -92,6 +93,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
private readonly List<double> prevNoteTimes = new List<double>(max_notes_for_density);
private double density = int.MaxValue;
private void computeDensity(double newNoteTime)
{
if (prevNoteTimes.Count == max_notes_for_density)
@ -104,6 +106,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
private double lastTime;
private Vector2 lastPosition;
private PatternType lastStair = PatternType.Stair;
private void recordNote(double time, Vector2 position)
{
lastTime = time;

View File

@ -65,6 +65,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (originalPattern.HitObjects.Count() == 1)
{
yield return originalPattern;
yield break;
}
@ -135,6 +136,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0);
return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03);
}
@ -142,6 +144,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0);
return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0);
}
@ -149,11 +152,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0);
return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0);
}
if (convertType.HasFlag(PatternType.LowProbability))
return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0);
return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0);
}

View File

@ -116,10 +116,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
}
if (convertType.HasFlag(PatternType.Cycle) && PreviousPattern.HitObjects.Count() == 1
// If we convert to 7K + 1, let's not overload the special key
&& (TotalColumns != 8 || lastColumn != 0)
// Make sure the last column was not the centre column
&& (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2))
// If we convert to 7K + 1, let's not overload the special key
&& (TotalColumns != 8 || lastColumn != 0)
// Make sure the last column was not the centre column
&& (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2))
{
// Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object)
int column = RandomStart + TotalColumns - lastColumn - 1;
@ -172,6 +172,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12);
if (ConversionDifficulty > 4)
return pattern = generateRandomPatternWithMirrored(0.12, 0.17, 0);
return pattern = generateRandomPatternWithMirrored(0.12, 0, 0);
}
@ -179,6 +180,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return pattern = generateRandomPattern(0.78, 0.42, 0, 0);
return pattern = generateRandomPattern(1, 0.62, 0, 0);
}
@ -186,6 +188,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return pattern = generateRandomPattern(0.35, 0.08, 0, 0);
return pattern = generateRandomPattern(0.52, 0.15, 0, 0);
}
@ -193,6 +196,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
if (convertType.HasFlag(PatternType.LowProbability))
return pattern = generateRandomPattern(0.18, 0, 0, 0);
return pattern = generateRandomPattern(0.45, 0, 0, 0);
}
@ -250,6 +254,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
}
else
last = GetRandomColumn();
return last;
}
}

View File

@ -87,6 +87,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
return 4;
if (val >= 1 - p3)
return 3;
return val >= 1 - p2 ? 2 : 1;
}

View File

@ -12,51 +12,63 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
internal enum PatternType
{
None = 0,
/// <summary>
/// Keep the same as last row.
/// </summary>
ForceStack = 1 << 0,
/// <summary>
/// Keep different from last row.
/// </summary>
ForceNotStack = 1 << 1,
/// <summary>
/// Keep as single note at its original position.
/// </summary>
KeepSingle = 1 << 2,
/// <summary>
/// Use a lower random value.
/// </summary>
LowProbability = 1 << 3,
/// <summary>
/// Reserved.
/// </summary>
Alternate = 1 << 4,
/// <summary>
/// Ignore the repeat count.
/// </summary>
ForceSigSlider = 1 << 5,
/// <summary>
/// Convert slider to circle.
/// </summary>
ForceNotSlider = 1 << 6,
/// <summary>
/// Notes gathered together.
/// </summary>
Gathered = 1 << 7,
Mirror = 1 << 8,
/// <summary>
/// Change 0 -> 6.
/// </summary>
Reverse = 1 << 9,
/// <summary>
/// 1 -> 5 -> 1 -> 5 like reverse.
/// </summary>
Cycle = 1 << 10,
/// <summary>
/// Next note will be at column + 1.
/// </summary>
Stair = 1 << 11,
/// <summary>
/// Next note will be at column - 1.
/// </summary>

View File

@ -114,8 +114,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty
// Lots of arbitrary values from testing.
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
double accuracyValue = Math.Max(0.0, 0.2 - (Attributes.GreatHitWindow - 34) * 0.006667)
* strainValue
* Math.Pow(Math.Max(0.0, scaledScore - 960000) / 40000, 1.1);
* strainValue
* Math.Pow(Math.Max(0.0, scaledScore - 960000) / 40000, 1.1);
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
// accuracyValue *= Math.Min(1.15, Math.Pow(totalHits / 1500.0, 0.3));

View File

@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Mania
{
[Description("Special 1")]
Special1 = 1,
[Description("Special 2")]
Special2,
@ -26,38 +27,55 @@ namespace osu.Game.Rulesets.Mania
// above at a later time, without breaking replays/configs.
[Description("Key 1")]
Key1 = 10,
[Description("Key 2")]
Key2,
[Description("Key 3")]
Key3,
[Description("Key 4")]
Key4,
[Description("Key 5")]
Key5,
[Description("Key 6")]
Key6,
[Description("Key 7")]
Key7,
[Description("Key 8")]
Key8,
[Description("Key 9")]
Key9,
[Description("Key 10")]
Key10,
[Description("Key 11")]
Key11,
[Description("Key 12")]
Key12,
[Description("Key 13")]
Key13,
[Description("Key 14")]
Key14,
[Description("Key 15")]
Key15,
[Description("Key 16")]
Key16,
[Description("Key 17")]
Key17,
[Description("Key 18")]
Key18,
}

View File

@ -349,6 +349,7 @@ namespace osu.Game.Rulesets.Mania
/// Number of columns in this stage lies at (item - Single).
/// </summary>
Single = 0,
/// <summary>
/// Columns are grouped into two stages.
/// Overall number of columns lies at (item - Dual), further computation is required for

View File

@ -37,11 +37,11 @@ namespace osu.Game.Rulesets.Mania.MathUtils
/// <returns>The random value.</returns>
public uint NextUInt()
{
uint t = X ^ X << 11;
uint t = X ^ (X << 11);
X = Y;
Y = Z;
Z = W;
return W = W ^ W >> 19 ^ t ^ t >> 8;
return W = W ^ (W >> 19) ^ t ^ (t >> 8);
}
/// <summary>

View File

@ -82,6 +82,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
{
if (accentColour == value)
return;
accentColour = value;
updateAccentColour();

View File

@ -35,6 +35,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
}
private Color4 accentColour;
public Color4 AccentColour
{
get => accentColour;
@ -42,6 +43,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
{
if (accentColour == value)
return;
accentColour = value;
updateGlow();

View File

@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
}
private Color4 accentColour;
public Color4 AccentColour
{
get => accentColour;
@ -63,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
{
if (accentColour == value)
return;
accentColour = value;
colouredBox.Colour = AccentColour.Lighten(0.9f);

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Mania.Objects
public double EndTime => StartTime + Duration;
private double duration;
public double Duration
{
get => duration;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Objects
private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)>
{
{ HitResult.Perfect, (44.8, 38.8, 27.8) },
{ HitResult.Great, (128, 98, 68 ) },
{ HitResult.Great, (128, 98, 68) },
{ HitResult.Good, (194, 164, 134) },
{ HitResult.Ok, (254, 224, 194) },
{ HitResult.Meh, (302, 272, 242) },

View File

@ -97,6 +97,7 @@ namespace osu.Game.Rulesets.Mania.UI
public override Axes RelativeSizeAxes => Axes.Y;
private bool isSpecial;
public bool IsSpecial
{
get => isSpecial;
@ -104,6 +105,7 @@ namespace osu.Game.Rulesets.Mania.UI
{
if (isSpecial == value)
return;
isSpecial = value;
Width = isSpecial ? special_column_width : column_width;
@ -111,6 +113,7 @@ namespace osu.Game.Rulesets.Mania.UI
}
private Color4 accentColour;
public Color4 AccentColour
{
get => accentColour;
@ -118,6 +121,7 @@ namespace osu.Game.Rulesets.Mania.UI
{
if (accentColour == value)
return;
accentColour = value;
background.AccentColour = value;

View File

@ -70,6 +70,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
{
if (accentColour == value)
return;
accentColour = value;
updateColours();

View File

@ -73,6 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
{
if (accentColour == value)
return;
accentColour = value;
updateColours();

View File

@ -87,6 +87,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
{
if (accentColour == value)
return;
accentColour = value;
updateColours();

View File

@ -33,9 +33,11 @@ namespace osu.Game.Rulesets.Osu.Tests
case Slider slider:
foreach (var nested in slider.NestedHitObjects)
yield return createConvertValue(nested);
break;
default:
yield return createConvertValue(hitObject);
break;
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
private GameplayCursor cursor;
public override IReadOnlyList<Type> RequiredTypes => new [] { typeof(CursorTrail) };
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
public CursorContainer Cursor => cursor;

View File

@ -89,7 +89,8 @@ namespace osu.Game.Rulesets.Osu.Tests
{
private readonly bool auto;
public TestDrawableHitCircle(HitCircle h, bool auto) : base(h)
public TestDrawableHitCircle(HitCircle h, bool auto)
: base(h)
{
this.auto = auto;
}

View File

@ -301,6 +301,7 @@ namespace osu.Game.Rulesets.Osu.Tests
}
private float judgementOffsetDirection = 1;
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
{
var osuObject = judgedObject as DrawableOsuHitObject;

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public class TestCaseSpinner : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
{
typeof(SpinnerDisc),
typeof(DrawableSpinner),
typeof(DrawableOsuHitObject)
@ -67,7 +67,8 @@ namespace osu.Game.Rulesets.Osu.Tests
{
private bool auto;
public TestDrawableSpinner(Spinner s, bool auto) : base(s)
public TestDrawableSpinner(Spinner s, bool auto)
: base(s)
{
this.auto = auto;
}

View File

@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
// Longer maps are worth more
double lengthBonus = 0.95f + 0.4f * Math.Min(1.0f, totalHits / 2000.0f) +
(totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f);
(totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f);
aimValue *= lengthBonus;
@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f);
else if (Attributes.ApproachRate < 8.0f)
{
approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate);
approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate);
}
aimValue *= approachRateFactor;
@ -126,8 +126,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
{
// Apply object-based bonus for flashlight.
aimValue *= 1.0f + 0.35f * Math.Min(1.0f, totalHits / 200.0f) +
(totalHits > 200 ? 0.3f * Math.Min(1.0f, (totalHits - 200) / 300.0f) +
(totalHits > 500 ? (totalHits - 500) / 1200.0f : 0.0f) : 0.0f);
(totalHits > 200
? 0.3f * Math.Min(1.0f, (totalHits - 200) / 300.0f) +
(totalHits > 500 ? (totalHits - 500) / 1200.0f : 0.0f)
: 0.0f);
}
// Scale the aim value with accuracy _slightly_
@ -144,7 +146,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
// Longer maps are worth more
speedValue *= 0.95f + 0.4f * Math.Min(1.0f, totalHits / 2000.0f) +
(totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f);
(totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f);
// Penalize misses exponentially. This mainly fixes tag4 maps and the likes until a per-hitobject solution is available
speedValue *= Math.Pow(0.97f, countMiss);

View File

@ -92,6 +92,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
{
if (slider.LazyEndPosition != null)
return;
slider.LazyEndPosition = slider.StackedPosition;
float approxFollowCircleRadius = (float)(slider.Radius * 3);

View File

@ -9,8 +9,10 @@ namespace osu.Game.Rulesets.Osu.Judgements
{
[Description(@"")]
None,
[Description(@"Good")]
Good,
[Description(@"Amazing")]
Perfect
}

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{
foreach (var drawable in drawables)
{
var hitObject = (OsuHitObject) drawable.HitObject;
var hitObject = (OsuHitObject)drawable.HitObject;
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Mods
.MoveTo(originalPosition, moveDuration, Easing.InOutSine);
}
theta += (float) hitObject.TimeFadeIn / 1000;
theta += (float)hitObject.TimeFadeIn / 1000;
}
}
}

View File

@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
public class FollowPointRenderer : ConnectionRenderer<OsuHitObject>
{
private int pointDistance = 32;
/// <summary>
/// Determines how much space there is between points.
/// </summary>
@ -21,12 +22,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
set
{
if (pointDistance == value) return;
pointDistance = value;
update();
}
}
private int preEmpt = 800;
/// <summary>
/// Follow points to the next hitobject start appearing for this many milliseconds before an hitobject's end time.
/// </summary>
@ -36,12 +39,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
set
{
if (preEmpt == value) return;
preEmpt = value;
update();
}
}
private IEnumerable<OsuHitObject> hitObjects;
public override IEnumerable<OsuHitObject> HitObjects
{
get => hitObjects;
@ -107,6 +112,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
fp.Expire(true);
}
}
prevHitObject = currHitObject;
}
}

View File

@ -20,7 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public override bool DisplayResult => false;
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
public DrawableSliderTick(SliderTick sliderTick)
: base(sliderTick)
{
Size = new Vector2(16) * sliderTick.Scale;
Origin = Anchor.Centre;

View File

@ -42,7 +42,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private Color4 normalColour;
private Color4 completeColour;
public DrawableSpinner(Spinner s) : base(s)
public DrawableSpinner(Spinner s)
: base(s)
{
Origin = Anchor.Centre;
Position = s.Position;

View File

@ -141,6 +141,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
if (value == tracking)
return;
tracking = value;
FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint);

View File

@ -40,6 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
if (path.AccentColour == value)
return;
path.AccentColour = value;
container.ForceRedraw();
@ -56,6 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
if (path.BorderColour == value)
return;
path.BorderColour = value;
container.ForceRedraw();
@ -105,6 +107,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
if (borderColour == value)
return;
borderColour = value;
InvalidateTexture();
@ -120,6 +123,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
if (accentColour == value)
return;
accentColour = value;
InvalidateTexture();

View File

@ -43,12 +43,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private bool tracking;
public bool Tracking
{
get => tracking;
set
{
if (value == tracking) return;
tracking = value;
background.FadeTo(tracking ? tracking_alpha : idle_alpha, 100);
@ -56,12 +58,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
private bool complete;
public bool Complete
{
get => complete;
set
{
if (value == complete) return;
complete = value;
updateCompleteTick();

View File

@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private set
{
if (value == spm) return;
spm = value;
spmText.Text = Math.Truncate(value).ToString(@"#0");
}

View File

@ -262,6 +262,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{
if (nodeIndex < NodeSamples.Count)
return NodeSamples[nodeIndex];
return Samples;
}

View File

@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Osu
protected override bool Handle(UIEvent e)
{
if (!AllowUserPresses) return false;
return base.Handle(e);
}
}

View File

@ -121,7 +121,8 @@ namespace osu.Game.Rulesets.Osu
new OsuModAutopilot(),
};
case ModType.Fun:
return new Mod[] {
return new Mod[]
{
new OsuModTransform(),
new OsuModWiggle(),
new OsuModGrow()

View File

@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Osu.Replays
// Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up.
if (timeDifference > 0 && // Sanity checks
((lastPosition - targetPos).Length > h.Radius * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
{
// Perform eased movement
for (double time = lastFrame.Time + FrameDelay; time < h.StartTime; time += FrameDelay)

View File

@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Replays
/// Constants (for spinners).
/// </summary>
protected static readonly Vector2 SPINNER_CENTRE = OsuPlayfield.BASE_SIZE / 2;
protected const float SPIN_RADIUS = 50;
/// <summary>
@ -46,6 +47,7 @@ namespace osu.Game.Rulesets.Osu.Replays
#endregion
#region Utilities
protected double ApplyModsToTime(double v) => v;
protected double ApplyModsToRate(double v) => v;

View File

@ -255,10 +255,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{
[VertexMember(2, VertexAttribPointerType.Float)]
public Vector2 Position;
[VertexMember(4, VertexAttribPointerType.Float)]
public Color4 Colour;
[VertexMember(2, VertexAttribPointerType.Float)]
public Vector2 TexturePosition;
[VertexMember(1, VertexAttribPointerType.Float)]
public float Time;

View File

@ -213,6 +213,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
public void Expand()
{
if (!cursorExpand) return;
expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad);
}

View File

@ -229,6 +229,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
// Ensure alternating centre and rim hits
if (lastWasCentre == isCentre)
return false;
lastWasCentre = isCentre;
UpdateResult(true);

View File

@ -49,6 +49,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected void ProxyContent()
{
if (isProxied) return;
isProxied = true;
nonProxiedContent.Remove(Content);
@ -62,6 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected void UnproxyContent()
{
if (!isProxied) return;
isProxied = false;
proxiedContent.Remove(Content);

View File

@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
public class TaikoPiece : BeatSyncedContainer, IHasAccentColour
{
private Color4 accentColour;
/// <summary>
/// The colour of the inner circle and outer glows.
/// </summary>
@ -21,6 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
}
private bool kiaiMode;
/// <summary>
/// Whether Kiai mode effects are enabled for this circle piece.
/// </summary>

View File

@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
private const float tick_size = 0.35f;
private bool filled;
public bool Filled
{
get => filled;

View File

@ -19,7 +19,10 @@ namespace osu.Game.Rulesets.Taiko.Objects
/// </summary>
public int RequiredHits = 10;
public override bool IsStrong { set => throw new NotSupportedException($"{nameof(Swell)} cannot be a strong hitobject."); }
public override bool IsStrong
{
set => throw new NotSupportedException($"{nameof(Swell)} cannot be a strong hitobject.");
}
protected override void CreateNestedHitObjects()
{

View File

@ -19,10 +19,13 @@ namespace osu.Game.Rulesets.Taiko
{
[Description("Left (rim)")]
LeftRim,
[Description("Left (centre)")]
LeftCentre,
[Description("Right (centre)")]
RightCentre,
[Description("Right (rim)")]
RightRim
}

View File

@ -141,6 +141,7 @@ namespace osu.Game.Tests.Visual
}
private SortedList<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
{
if (timingPoints[timingPoints.Count - 1] == current)

View File

@ -150,6 +150,7 @@ namespace osu.Game.Tests.Visual
var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected);
if (currentlySelected == null)
return true;
return currentlySelected.Item.Visible;
}
@ -166,8 +167,7 @@ namespace osu.Game.Tests.Visual
carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false);
carousel.Filter(new FilterCriteria(), false);
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
}
);
});
}
/// <summary>
@ -522,6 +522,7 @@ namespace osu.Game.Tests.Visual
}
});
}
return toReturn;
}

View File

@ -160,7 +160,8 @@ namespace osu.Game.Tests.Visual
Accuracy = 0.6543,
},
};
foreach(var s in scores)
foreach (var s in scores)
{
s.Statistics.Add(HitResult.Great, RNG.Next(2000));
s.Statistics.Add(HitResult.Good, RNG.Next(2000));

View File

@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual
var chatManager = new ChannelManager();
BindableList<Channel> availableChannels = (BindableList<Channel>)chatManager.AvailableChannels;
availableChannels.Add(new Channel { Name = "#english"});
availableChannels.Add(new Channel { Name = "#english" });
availableChannels.Add(new Channel { Name = "#japanese" });
Dependencies.Cache(chatManager);

View File

@ -61,10 +61,10 @@ namespace osu.Game.Tests.Visual
// Move box along a square trajectory
container.Loop(c => c
.MoveTo(new Vector2(0, 100), duration).Then()
.MoveTo(new Vector2(100, 100), duration).Then()
.MoveTo(new Vector2(100, 0), duration).Then()
.MoveTo(Vector2.Zero, duration)
.MoveTo(new Vector2(0, 100), duration).Then()
.MoveTo(new Vector2(100, 100), duration).Then()
.MoveTo(new Vector2(100, 0), duration).Then()
.MoveTo(Vector2.Zero, duration)
);
}

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
{
TimingPoints =
{
new TimingControlPoint { Time = 0, BeatLength = 200},
new TimingControlPoint { Time = 0, BeatLength = 200 },
new TimingControlPoint { Time = 100, BeatLength = 400 },
new TimingControlPoint { Time = 175, BeatLength = 800 },
new TimingControlPoint { Time = 350, BeatLength = 200 },

View File

@ -265,6 +265,7 @@ namespace osu.Game.Tests.Visual
pauseOverlay.OnRetry = lastAction;
lastAction = null;
}
return triggered;
});
AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden);

View File

@ -20,7 +20,8 @@ namespace osu.Game.Tests.Visual
[Description("PlaySongSelect leaderboard")]
public class TestCaseLeaderboard : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[] {
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Placeholder),
typeof(MessagePlaceholder),
typeof(RetrievalFailurePlaceholder),

View File

@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200,100)
Size = new Vector2(200, 100)
};
Beatmap.Value = new TestWorkingBeatmap(new Beatmap(), Clock);

View File

@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual
public TestScreen PushNext()
{
TestScreen screen = CreateNextScreen();
this.Push(screen);
this.Push(screen);
return screen;
}

View File

@ -50,7 +50,10 @@ namespace osu.Game.Tests.Visual
});
AddStep("Restart", restart);
AddToggleStep("Passing", passing => { if (storyboard != null) storyboard.Passing = passing; });
AddToggleStep("Passing", passing =>
{
if (storyboard != null) storyboard.Passing = passing;
});
}
[BackgroundDependencyLoader]

View File

@ -63,6 +63,7 @@ namespace osu.Game.Audio
if (hasStarted)
return;
hasStarted = true;
track.Restart();
@ -81,6 +82,7 @@ namespace osu.Game.Audio
if (!hasStarted)
return;
hasStarted = false;
track.Stop();

View File

@ -50,12 +50,14 @@ namespace osu.Game.Audio
{
if (!string.IsNullOrEmpty(Suffix))
yield return $"{Namespace}/{Bank}-{Name}{Suffix}";
yield return $"{Namespace}/{Bank}-{Name}";
}
// check non-namespace as a fallback even when we have a namespace
if (!string.IsNullOrEmpty(Suffix))
yield return $"{Bank}-{Name}{Suffix}";
yield return $"{Bank}-{Name}";
}
}

View File

@ -16,6 +16,7 @@ namespace osu.Game.Beatmaps
where T : HitObject
{
private event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
event Action<HitObject, IEnumerable<HitObject>> IBeatmapConverter.ObjectConverted
{
add => ObjectConverted += value;

View File

@ -48,6 +48,7 @@ namespace osu.Game.Beatmaps
return mid + (max - mid) * (difficulty - 5) / 5;
if (difficulty < 5)
return mid - (mid - min) * (5 - difficulty) / 5;
return mid;
}

View File

@ -48,6 +48,7 @@ namespace osu.Game.Beatmaps
[JsonProperty(@"tags")]
public string Tags { get; set; }
public int PreviewTime { get; set; }
public string AudioFile { get; set; }
public string BackgroundFile { get; set; }
@ -72,15 +73,15 @@ namespace osu.Game.Beatmaps
return false;
return Title == other.Title
&& TitleUnicode == other.TitleUnicode
&& Artist == other.Artist
&& ArtistUnicode == other.ArtistUnicode
&& AuthorString == other.AuthorString
&& Source == other.Source
&& Tags == other.Tags
&& PreviewTime == other.PreviewTime
&& AudioFile == other.AudioFile
&& BackgroundFile == other.BackgroundFile;
&& TitleUnicode == other.TitleUnicode
&& Artist == other.Artist
&& ArtistUnicode == other.ArtistUnicode
&& AuthorString == other.AuthorString
&& Source == other.Source
&& Tags == other.Tags
&& PreviewTime == other.PreviewTime
&& AudioFile == other.AudioFile
&& BackgroundFile == other.BackgroundFile;
}
}
}

View File

@ -34,6 +34,7 @@ namespace osu.Game.Beatmaps
Refresh(ref beatmap, Beatmaps);
if (beatmap.Hidden) return false;
beatmap.Hidden = true;
}
@ -53,6 +54,7 @@ namespace osu.Game.Beatmaps
Refresh(ref beatmap, Beatmaps);
if (!beatmap.Hidden) return false;
beatmap.Hidden = false;
}

View File

@ -13,8 +13,8 @@ namespace osu.Game.Beatmaps.Drawables
public BeatmapBackgroundSprite(WorkingBeatmap working)
{
if (working == null)
throw new ArgumentNullException(nameof(working));
if (working == null)
throw new ArgumentNullException(nameof(working));
this.working = working;
}

View File

@ -23,6 +23,7 @@ namespace osu.Game.Beatmaps.Drawables
{
if (status == value)
return;
status = value;
Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1;

View File

@ -53,6 +53,7 @@ namespace osu.Game.Beatmaps.Drawables
if (rating < 3.75) return DifficultyRating.Hard;
if (rating < 5.25) return DifficultyRating.Insane;
if (rating < 6.75) return DifficultyRating.Expert;
return DifficultyRating.ExpertPlus;
}

View File

@ -25,7 +25,8 @@ namespace osu.Game.Beatmaps.Drawables
protected override Drawable CreateDrawable(BeatmapInfo model)
{
return new DelayedLoadUnloadWrapper(() => {
return new DelayedLoadUnloadWrapper(() =>
{
Drawable drawable;
var localBeatmap = beatmaps.GetWorkingBeatmap(model);

View File

@ -13,12 +13,14 @@ namespace osu.Game.Beatmaps.Drawables
private Drawable displayedCover;
private BeatmapSetInfo beatmapSet;
public BeatmapSetInfo BeatmapSet
{
get => beatmapSet;
set
{
if (value == beatmapSet) return;
beatmapSet = value;
if (IsLoaded)
@ -27,12 +29,14 @@ namespace osu.Game.Beatmaps.Drawables
}
private BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover;
public BeatmapSetCoverType CoverType
{
get => coverType;
set
{
if (value == coverType) return;
coverType = value;
if (IsLoaded)

View File

@ -72,6 +72,7 @@ namespace osu.Game.Beatmaps.Formats
var index = line.AsSpan().IndexOf("//".AsSpan());
if (index > 0)
return line.Substring(0, index);
return line;
}
@ -115,6 +116,7 @@ namespace osu.Game.Beatmaps.Formats
else
{
if (!(output is IHasCustomColours tHasCustomColours)) return;
tHasCustomColours.CustomColours[pair.Key] = colour;
}
}

View File

@ -5,10 +5,11 @@ using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum RandomSelectAlgorithm
public enum RandomSelectAlgorithm
{
[Description("Never repeat")]
RandomPermutation,
[Description("Random")]
Random
}

View File

@ -8,8 +8,10 @@ namespace osu.Game.Configuration
public enum RankingType
{
Local,
[Description("Global")]
Top,
[Description("Selected Mods")]
SelectedMod,
Friends,

View File

@ -9,6 +9,7 @@ namespace osu.Game.Configuration
{
Off,
Everything,
[Description("Excluding overlays")]
ExcludeOverlays,
Gameplay,

View File

@ -9,6 +9,7 @@ namespace osu.Game.Configuration
{
[Description("JPG (web-friendly)")]
Jpg = 1,
[Description("PNG (lossless)")]
Png = 2
}

View File

@ -9,8 +9,10 @@ namespace osu.Game.Configuration
{
[Description("Sequential")]
Sequential,
[Description("Overlapping")]
Overlapping,
[Description("Constant")]
Constant
}

View File

@ -539,6 +539,7 @@ namespace osu.Game.Database
return new LegacyDirectoryArchiveReader(path);
if (File.Exists(path))
return new LegacyFileArchiveReader(path);
throw new InvalidFormatException($"{path} is not a valid archive");
}
}

View File

@ -31,6 +31,7 @@ namespace osu.Game.Database
protected void Dispose(bool disposing)
{
if (isDisposed) return;
isDisposed = true;
try

View File

@ -71,6 +71,7 @@ namespace osu.Game.Database
Refresh(ref item);
if (item.DeletePending) return false;
item.DeletePending = true;
}
@ -89,6 +90,7 @@ namespace osu.Game.Database
Refresh(ref item, ConsumableItems);
if (!item.DeletePending) return false;
item.DeletePending = false;
}

View File

@ -110,10 +110,10 @@ namespace osu.Game.Graphics.Backgrounds
if (CreateNewTriangles)
addTriangles(false);
float adjustedAlpha = HideAlphaDiscrepancies ?
float adjustedAlpha = HideAlphaDiscrepancies
// Cubically scale alpha to make it drop off more sharply.
(float)Math.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3) :
1;
? (float)Math.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3)
: 1;
float elapsedSeconds = (float)Time.Elapsed / 1000;
// Since position is relative, the velocity needs to scale inversely with DrawHeight.
@ -181,6 +181,7 @@ namespace osu.Game.Graphics.Backgrounds
protected override DrawNode CreateDrawNode() => new TrianglesDrawNode();
private readonly TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData();
protected override void ApplyDrawNode(DrawNode node)
{
base.ApplyDrawNode(node);

View File

@ -96,6 +96,7 @@ namespace osu.Game.Graphics.Containers
}
else
State = Visibility.Hidden;
break;
case Visibility.Hidden:
if (PlaySamplesOnStateChange) samplePopOut?.Play();

View File

@ -12,7 +12,8 @@ namespace osu.Game.Graphics.Containers
{
public class OsuTextFlowContainer : TextFlowContainer
{
public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null) : base(defaultCreationParameters)
public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null)
: base(defaultCreationParameters)
{
}

View File

@ -110,6 +110,7 @@ namespace osu.Game.Graphics.Containers
private float headerHeight, footerHeight;
private readonly MarginPadding originalSectionsMargin;
private void updateSectionsMargin()
{
if (!Children.Any()) return;
@ -142,6 +143,7 @@ namespace osu.Game.Graphics.Containers
public void ScrollToTop() => scrollContainer.ScrollTo(0);
private float lastKnownScroll;
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

View File

@ -85,6 +85,7 @@ namespace osu.Game.Graphics.Cursor
dragRotationState = DragRotationState.DragStarted;
positionMouseDown = e.MousePosition;
}
return base.OnMouseDown(e);
}
@ -102,6 +103,7 @@ namespace osu.Game.Graphics.Cursor
activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf);
dragRotationState = DragRotationState.NotDragging;
}
return base.OnMouseUp(e);
}

View File

@ -43,6 +43,7 @@ namespace osu.Game.Graphics.Cursor
}
private IProvideCursor currentTarget;
protected override void Update()
{
base.Update();

View File

@ -17,7 +17,8 @@ namespace osu.Game.Graphics.Cursor
{
protected override ITooltip CreateTooltip() => new OsuTooltip();
public OsuTooltipContainer(CursorContainer cursor) : base(cursor)
public OsuTooltipContainer(CursorContainer cursor)
: base(cursor)
{
}

View File

@ -21,6 +21,7 @@ namespace osu.Game.Graphics
{
if (date == value)
return;
date = value.ToLocalTime();
if (LoadState >= LoadState.Ready)

View File

@ -65,6 +65,7 @@ namespace osu.Game.Graphics
}
private FontAwesome loadedIcon;
private void updateTexture()
{
var loadableIcon = icon;
@ -104,6 +105,7 @@ namespace osu.Game.Graphics
}
private bool shadow;
public bool Shadow
{
get => shadow;
@ -120,7 +122,6 @@ namespace osu.Game.Graphics
public FontAwesome Icon
{
get => icon;
set
{
if (icon == value) return;

View File

@ -47,6 +47,7 @@ namespace osu.Game.Graphics.UserInterface
}
private BarDirection direction = BarDirection.LeftToRight;
public BarDirection Direction
{
get => direction;

View File

@ -17,6 +17,7 @@ namespace osu.Game.Graphics.UserInterface
public float? MaxValue { get; set; }
private BarDirection direction = BarDirection.BottomToTop;
public new BarDirection Direction
{
get => direction;
@ -66,6 +67,7 @@ namespace osu.Game.Graphics.UserInterface
});
}
}
//I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards
RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList());
}

View File

@ -61,6 +61,7 @@ namespace osu.Game.Graphics.UserInterface
set
{
if (value == state) return;
state = value;
const float transition_duration = 500;
@ -80,7 +81,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
public BreadcrumbTabItem(T value) : base(value)
public BreadcrumbTabItem(T value)
: base(value)
{
Text.Font = Text.Font.With(size: 18);
Text.Margin = new MarginPadding { Vertical = 8 };

View File

@ -154,6 +154,7 @@ namespace osu.Game.Graphics.UserInterface
}
private Color4 buttonColour;
public Color4 ButtonColour
{
get => buttonColour;
@ -166,6 +167,7 @@ namespace osu.Game.Graphics.UserInterface
}
private Color4 backgroundColour = OsuColour.Gray(34);
public Color4 BackgroundColour
{
get => backgroundColour;
@ -177,6 +179,7 @@ namespace osu.Game.Graphics.UserInterface
}
private string text;
public string Text
{
get => text;

View File

@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(ClickEvent e)
{
if(Link != null)
if (Link != null)
host.OpenUrlExternally(Link);
return true;
}

Some files were not shown because too many files have changed in this diff Show More