diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs index 01a6e749f3..0a15b38fc2 100644 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests { public class Benchmark : OsuGameBase { - private readonly double timePerTest = 200; + private const double time_per_test = 200; [BackgroundDependencyLoader] private void load() @@ -27,7 +27,7 @@ protected override void LoadComplete() TestBrowser f = new TestBrowser(); Add(f); - Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {timePerTest}ms each..."); + Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {time_per_test}ms each..."); for (int i = 1; i < f.TestCount; i++) { @@ -36,10 +36,10 @@ protected override void LoadComplete() { f.LoadTest(loadableCase); Console.WriteLine($@"{Time}: Switching to test #{loadableCase}"); - }, loadableCase * timePerTest); + }, loadableCase * time_per_test); } - Scheduler.AddDelayed(Host.Exit, f.TestCount * timePerTest); + Scheduler.AddDelayed(Host.Exit, f.TestCount * time_per_test); } } } diff --git a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs index 4ea310f083..885048b938 100644 --- a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs @@ -29,7 +29,7 @@ private void load(TextureStore textures) { Texture = textures.Get(@"Menu/logo"); - double duration = 0; + const double duration = 0; Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) }); Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); diff --git a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs b/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs index 9fd39e2f45..76999cef21 100644 --- a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs +++ b/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs @@ -26,7 +26,7 @@ private void load(TextureStore textures) { Texture = textures.Get(@"Menu/logo"); - double duration = 0; + const double duration = 0; Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f }); Transforms.Add(new TransformAlpha { StartTime = note.StartTime + duration + 200, EndTime = note.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index ea5143b08a..0a4490eac3 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -81,7 +81,7 @@ private void updateStacking(List hitObjects, float stackLeniency, if (endIndex == -1) endIndex = hitObjects.Count - 1; - int stackDistance = 3; + const int stack_distance = 3; float stackThreshold = DrawableOsuHitObject.TIME_PREEMPT * stackLeniency; // Reset stacking inside the update range @@ -108,8 +108,8 @@ private void updateStacking(List hitObjects, float stackLeniency, //We are no longer within stacking range of the next object. break; - if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stackDistance || - stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stackDistance) + if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stack_distance || + stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance) { stackBaseIndex = n; @@ -174,14 +174,14 @@ private void updateStacking(List hitObjects, float stackLeniency, * o <- hitCircle has stack of -1 * o <- hitCircle has stack of -2 */ - if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stackDistance) + if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) { int offset = objectI.StackHeight - objectN.StackHeight + 1; for (int j = n + 1; j <= i; j++) { //For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above). OsuHitObject objectJ = hitObjects[j]; - if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stackDistance) + if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stack_distance) objectJ.StackHeight -= offset; } @@ -190,7 +190,7 @@ private void updateStacking(List hitObjects, float stackLeniency, break; } - if (Vector2.Distance(objectN.Position, objectI.Position) < stackDistance) + if (Vector2.Distance(objectN.Position, objectI.Position) < stack_distance) { //Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out. //NOTE: Sliders with start positions stacking are a special case that is also handled here. @@ -214,7 +214,7 @@ private void updateStacking(List hitObjects, float stackLeniency, //We are no longer within stacking range of the previous object. break; - if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stackDistance) + if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) { objectN.StackHeight = objectI.StackHeight + 1; objectI = objectN; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 2d701b3eeb..8f36321efd 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -108,9 +108,9 @@ protected override void CheckJudgement(bool userTriggered) private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f; - private readonly float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5 + private const float spins_per_minute_needed = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5 - private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); + private float rotationsNeeded => (float)(spins_per_minute_needed * (spinner.EndTime - spinner.StartTime) / 60000f); public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / rotationsNeeded, 0, 1); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs index cdf1e600d5..13b543b908 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs @@ -29,7 +29,7 @@ private void load(TextureStore textures) { Texture = textures.Get(@"Menu/logo"); - double duration = 0; + const double duration = 0; Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f }); Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 9c057d5f77..a9da5c589c 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -15,8 +15,8 @@ public abstract class DifficultyCalculator private void loadTiming() { // TODO: Handle mods - int audioRate = 100; - TimeRate = audioRate / 100.0; + const int audio_rate = 100; + TimeRate = audio_rate / 100.0; } public double Calculate(Dictionary categoryDifficulty = null) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 478fe8a877..8dff614f6c 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -89,13 +89,13 @@ protected override void Update() protected virtual Triangle CreateTriangle() { - float stdDev = 0.16f; - float mean = 0.5f; + const float std_dev = 0.16f; + const float mean = 0.5f; float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats float u2 = 1 - RNG.NextSingle(); float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1) - var scale = Math.Max(triangleScale * (mean + stdDev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) + var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) const float size = 100; diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index e804b506cc..4b5610e840 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -88,10 +88,10 @@ protected override void Update() Invalidate(Invalidation.DrawNode, shallPropagate: false); - int fadeClockResetThreshold = 1000000; + const int fade_clock_reset_threshold = 1000000; time = (float)(Time.Current - timeOffset) / 500f; - if (time > fadeClockResetThreshold) + if (time > fade_clock_reset_threshold) resetTime(); } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index daf4df657b..601970e36d 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -171,7 +171,7 @@ protected override bool OnHover(InputState state) IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); - double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; + const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; double startTime = Time.Current + offset; // basic pulse @@ -200,7 +200,7 @@ protected override void OnHoverLost(InputState state) int duration = 0; //(int)(Game.Audio.BeatLength); if (duration == 0) duration = pulse_length * 2; - double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; + const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; double startTime = Time.Current + offset; // slow pulse diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 5f62f382c0..fe9f7b4bf6 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -132,7 +132,7 @@ protected override bool OnHover(InputState state) icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf); - double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; + const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; double startTime = Time.Current + offset; icon.RotateTo(10, offset, EasingTypes.InOutSine); diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 8a9f320fdf..8ad169a2b0 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -113,12 +113,12 @@ protected override void OnResuming(Screen last) //we also handle the exit transition. seeya.Play(); - double fadeOutTime = 2000; + const double fade_out_time = 2000; - Scheduler.AddDelayed(Exit, fadeOutTime); + Scheduler.AddDelayed(Exit, fade_out_time); //don't want to fade out completely else we will stop running updates and shit will hit the fan. - Game.FadeTo(0.01f, fadeOutTime); + Game.FadeTo(0.01f, fade_out_time); base.OnResuming(last); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b89b96962e..ddd963da00 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -42,10 +42,10 @@ public class Player : OsuScreen public int RestartCount; - private readonly double pauseCooldown = 1000; + private const double pause_cooldown = 1000; private double lastPauseActionTime; - private bool canPause => Time.Current >= lastPauseActionTime + pauseCooldown; + private bool canPause => Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; private IFrameBasedClock interpolatedSourceClock; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index f1c493ce1d..6d4b37ebc6 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Select.Options { public class BeatmapOptionsButton : ClickableContainer { - private static readonly float width = 130; + private const float width = 130; private readonly Box background; private readonly Box flash; diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index ea0e322b01..f266b81ec9 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -23,6 +23,7 @@ WARNING WARNING HINT + WARNING WARNING WARNING WARNING @@ -583,6 +584,42 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-frame <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="private properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />