diff --git a/osu-framework b/osu-framework index 66af3bcb3c..c11986f18b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 66af3bcb3cb6dc3e38f94553bd2c1bb81746eabc +Subproject commit c11986f18b2a6e8bf93ef9bcb0bece2936ad0381 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 900321d0c1..67bea2454f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -13,7 +13,7 @@ namespace osu.Desktop.VisualTests.Tests public override string Name => @"Music Controller"; public override string Description => @"Tests music controller ui."; - protected MusicController mc; + private MusicController mc; public TestCaseMusicController() { diff --git a/osu.Game.Modes.Osu/Objects/BezierApproximator.cs b/osu.Game.Modes.Osu/Objects/BezierApproximator.cs index 73fb342492..3cfdb14a5d 100644 --- a/osu.Game.Modes.Osu/Objects/BezierApproximator.cs +++ b/osu.Game.Modes.Osu/Objects/BezierApproximator.cs @@ -13,8 +13,8 @@ namespace osu.Game.Modes.Osu.Objects private Vector2[] subdivisionBuffer1; private Vector2[] subdivisionBuffer2; - private const float TOLERANCE = 0.25f; - private const float TOLERANCE_SQ = TOLERANCE * TOLERANCE; + private const float tolerance = 0.25f; + private const float tolerance_sq = tolerance * tolerance; public BezierApproximator(List controlPoints) { @@ -33,10 +33,10 @@ namespace osu.Game.Modes.Osu.Objects /// /// The control points to check for flatness. /// Whether the control points are flat enough. - private static bool IsFlatEnough(Vector2[] controlPoints) + private static bool isFlatEnough(Vector2[] controlPoints) { for (int i = 1; i < controlPoints.Length - 1; i++) - if ((controlPoints[i - 1] - 2 * controlPoints[i] + controlPoints[i + 1]).LengthSquared > TOLERANCE_SQ * 4) + if ((controlPoints[i - 1] - 2 * controlPoints[i] + controlPoints[i + 1]).LengthSquared > tolerance_sq * 4) return false; return true; @@ -50,7 +50,7 @@ namespace osu.Game.Modes.Osu.Objects /// The control points to split. /// Output: The control points corresponding to the left half of the curve. /// Output: The control points corresponding to the right half of the curve. - private void Subdivide(Vector2[] controlPoints, Vector2[] l, Vector2[] r) + private void subdivide(Vector2[] controlPoints, Vector2[] l, Vector2[] r) { Vector2[] midpoints = subdivisionBuffer1; @@ -73,12 +73,12 @@ namespace osu.Game.Modes.Osu.Objects /// /// The control points describing the bezier curve to be approximated. /// The points representing the resulting piecewise-linear approximation. - private void Approximate(Vector2[] controlPoints, List output) + private void approximate(Vector2[] controlPoints, List output) { Vector2[] l = subdivisionBuffer2; Vector2[] r = subdivisionBuffer1; - Subdivide(controlPoints, l, r); + subdivide(controlPoints, l, r); for (int i = 0; i < count - 1; ++i) l[count + i] = r[i + 1]; @@ -119,13 +119,13 @@ namespace osu.Game.Modes.Osu.Objects while (toFlatten.Count > 0) { Vector2[] parent = toFlatten.Pop(); - if (IsFlatEnough(parent)) + if (isFlatEnough(parent)) { // If the control points we currently operate on are sufficiently "flat", we use // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation // of the bezier curve represented by our control points, consisting of the same amount // of points as there are control points. - Approximate(parent, output); + approximate(parent, output); freeBuffers.Push(parent); continue; } @@ -133,7 +133,7 @@ namespace osu.Game.Modes.Osu.Objects // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep // subdividing the curve we are currently operating on. Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; - Subdivide(parent, leftChild, rightChild); + subdivide(parent, leftChild, rightChild); // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. for (int i = 0; i < count; ++i) diff --git a/osu.Game.Modes.Osu/Objects/CircularArcApproximator.cs b/osu.Game.Modes.Osu/Objects/CircularArcApproximator.cs index d9b77db891..3c112576b6 100644 --- a/osu.Game.Modes.Osu/Objects/CircularArcApproximator.cs +++ b/osu.Game.Modes.Osu/Objects/CircularArcApproximator.cs @@ -10,19 +10,19 @@ namespace osu.Game.Modes.Osu.Objects { public class CircularArcApproximator { - private Vector2 A; - private Vector2 B; - private Vector2 C; + private Vector2 a; + private Vector2 b; + private Vector2 c; private int amountPoints; - private const float TOLERANCE = 0.1f; + private const float tolerance = 0.1f; - public CircularArcApproximator(Vector2 A, Vector2 B, Vector2 C) + public CircularArcApproximator(Vector2 a, Vector2 b, Vector2 c) { - this.A = A; - this.B = B; - this.C = C; + this.a = a; + this.b = b; + this.c = c; } /// @@ -31,9 +31,9 @@ namespace osu.Game.Modes.Osu.Objects /// A list of vectors representing the piecewise-linear approximation. public List CreateArc() { - float aSq = (B - C).LengthSquared; - float bSq = (A - C).LengthSquared; - float cSq = (A - B).LengthSquared; + float aSq = (b - c).LengthSquared; + float bSq = (a - c).LengthSquared; + float cSq = (a - b).LengthSquared; // If we have a degenerate triangle where a side-length is almost zero, then give up and fall // back to a more numerically stable method. @@ -51,9 +51,9 @@ namespace osu.Game.Modes.Osu.Objects if (Precision.AlmostEquals(sum, 0)) return new List(); - Vector2 centre = (s * A + t * B + u * C) / sum; - Vector2 dA = A - centre; - Vector2 dC = C - centre; + Vector2 centre = (s * a + t * b + u * c) / sum; + Vector2 dA = a - centre; + Vector2 dC = c - centre; float r = dA.Length; @@ -68,9 +68,9 @@ namespace osu.Game.Modes.Osu.Objects // Decide in which direction to draw the circle, depending on which side of // AC B lies. - Vector2 orthoAC = C - A; - orthoAC = new Vector2(orthoAC.Y, -orthoAC.X); - if (Vector2.Dot(orthoAC, B - A) < 0) + Vector2 orthoAtoC = c - a; + orthoAtoC = new Vector2(orthoAtoC.Y, -orthoAtoC.X); + if (Vector2.Dot(orthoAtoC, b - a) < 0) { dir = -dir; thetaRange = 2 * Math.PI - thetaRange; @@ -79,12 +79,12 @@ namespace osu.Game.Modes.Osu.Objects // We select the amount of points for the approximation by requiring the discrete curvature // to be smaller than the provided tolerance. The exact angle required to meet the tolerance // is: 2 * Math.Acos(1 - TOLERANCE / r) - if (2 * r <= TOLERANCE) + if (2 * r <= tolerance) // This special case is required for extremely short sliders where the radius is smaller than // the tolerance. This is a pathological rather than a realistic case. amountPoints = 2; else - amountPoints = Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - TOLERANCE / r)))); + amountPoints = Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - tolerance / r)))); List output = new List(amountPoints); diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 5ba8f7f1fe..29bb7ca32b 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -179,14 +179,14 @@ namespace osu.Game.Beatmaps.Formats return; // TODO string[] split = val.Split(','); EventType type; - int _type; - if (!int.TryParse(split[0], out _type)) + int intType; + if (!int.TryParse(split[0], out intType)) { if (!Enum.TryParse(split[0], out type)) throw new InvalidDataException($@"Unknown event type {split[0]}"); } else - type = (EventType)_type; + type = (EventType)intType; // TODO: Parse and store the rest of the event if (type == EventType.Background) beatmap.BeatmapInfo.Metadata.BackgroundFile = split[2].Trim('"'); @@ -200,7 +200,7 @@ namespace osu.Game.Beatmaps.Formats if (split.Length > 2) { - int kiai_flags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; + int kiaiFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo); cp = new ControlPoint { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 97d1be9da7..b78bf1a273 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps public readonly BeatmapSetInfo BeatmapSetInfo; private readonly BeatmapDatabase database; - private ArchiveReader GetReader() => database?.GetReader(BeatmapSetInfo); + private ArchiveReader getReader() => database?.GetReader(BeatmapSetInfo); private Texture background; private object backgroundLock = new object(); @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps try { - using (var reader = GetReader()) + using (var reader = getReader()) background = new TextureStore(new RawTextureLoaderStore(reader), false).Get(BeatmapInfo.Metadata.BackgroundFile); } catch { } @@ -57,7 +57,7 @@ namespace osu.Game.Beatmaps try { - using (var reader = GetReader()) + using (var reader = getReader()) using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path))) beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream); } @@ -83,7 +83,7 @@ namespace osu.Game.Beatmaps try { //store a reference to the reader as we may continue accessing the stream in the background. - trackReader = GetReader(); + trackReader = getReader(); var trackData = trackReader?.GetStream(BeatmapInfo.Metadata.AudioFile); if (trackData != null) track = new AudioTrackBass(trackData); diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 6c91420e68..7e0937155c 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -34,9 +34,9 @@ namespace osu.Game.Graphics.Cursor private float time; private TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData(); - private const int MAX_SPRITES = 2048; + private const int max_sprites = 2048; - private TrailPart[] parts = new TrailPart[MAX_SPRITES]; + private TrailPart[] parts = new TrailPart[max_sprites]; private Vector2? lastPosition; @@ -62,7 +62,7 @@ namespace osu.Game.Graphics.Cursor { RelativeSizeAxes = Axes.Both; - for (int i = 0; i < MAX_SPRITES; i++) + for (int i = 0; i < max_sprites; i++) { parts[i].InvalidationID = 0; parts[i].WasUpdated = true; @@ -87,10 +87,10 @@ namespace osu.Game.Graphics.Cursor time = (float)(Time.Current - timeOffset) / 500f; if (time > fadeClockResetThreshold) - ResetTime(); + resetTime(); } - private void ResetTime() + private void resetTime() { for (int i = 0; i < parts.Length; ++i) { @@ -134,7 +134,7 @@ namespace osu.Game.Graphics.Cursor parts[currentIndex].Time = time; ++parts[currentIndex].InvalidationID; - currentIndex = (currentIndex + 1) % MAX_SPRITES; + currentIndex = (currentIndex + 1) % max_sprites; } struct TrailPart @@ -158,12 +158,12 @@ namespace osu.Game.Graphics.Cursor public float Time; public TrailDrawNodeSharedData Shared; - public TrailPart[] Parts = new TrailPart[MAX_SPRITES]; + public TrailPart[] Parts = new TrailPart[max_sprites]; public Vector2 Size; public TrailDrawNode() { - for (int i = 0; i < MAX_SPRITES; i++) + for (int i = 0; i < max_sprites; i++) { Parts[i].InvalidationID = 0; Parts[i].WasUpdated = false; @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.Cursor public override void Draw(Action vertexAction) { if (Shared.VertexBuffer == null) - Shared.VertexBuffer = new QuadVertexBuffer(MAX_SPRITES, BufferUsageHint.DynamicDraw); + Shared.VertexBuffer = new QuadVertexBuffer(max_sprites, BufferUsageHint.DynamicDraw); Shader.GetUniform("g_FadeClock").Value = Time; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 9b04ccd997..fd1022e546 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -60,7 +60,7 @@ namespace osu.Game.Graphics.UserInterface } } - protected T count; + private T count; /// /// Actual value of counter. @@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface public abstract void Increment(T amount); - protected float textSize; + private float textSize; public float TextSize { diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index 8b7c1184fe..a004fe4a6e 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -56,7 +56,7 @@ namespace osu.Game.Modes.UI } } - protected ulong count; + private ulong count; /// /// Actual value of counter. diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index ce85add9f4..b3118240e8 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -20,8 +20,8 @@ namespace osu.Game.Online.API private OAuth authentication; public string Endpoint = @"https://new.ppy.sh"; - const string ClientId = @"5"; - const string ClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; + const string client_id = @"5"; + const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; ConcurrentQueue queue = new ConcurrentQueue(); @@ -57,7 +57,7 @@ namespace osu.Game.Online.API public APIAccess() { - authentication = new OAuth(ClientId, ClientSecret, Endpoint); + authentication = new OAuth(client_id, client_secret, Endpoint); log = Logger.GetLogger(LoggingTarget.Network); thread = new Thread(run) { IsBackground = true }; @@ -125,7 +125,7 @@ namespace osu.Game.Online.API //todo: this fails even on network-related issues. we should probably handle those differently. //NotificationManager.ShowMessage("Login failed!"); log.Add(@"Login failed!"); - ClearCredentials(); + clearCredentials(); continue; } @@ -168,7 +168,7 @@ namespace osu.Game.Online.API } } - private void ClearCredentials() + private void clearCredentials() { Username = null; Password = null; @@ -295,7 +295,7 @@ namespace osu.Game.Online.API public void Logout() { - ClearCredentials(); + clearCredentials(); authentication.Clear(); State = APIState.Offline; } diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 7b54703109..a1cff0188c 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -15,8 +15,8 @@ namespace osu.Game.Overlays.Options { public abstract class OptionsSection : Container { - protected FlowContainer content; - protected override Container Content => content; + protected FlowContainer FlowContent; + protected override Container Content => FlowContent; public abstract FontAwesome Icon { get; } public abstract string Header { get; } @@ -28,22 +28,23 @@ namespace osu.Game.Overlays.Options Margin = new MarginPadding { Top = 20 }; AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; - - const int headerSize = 26, headerMargin = 25; - const int borderSize = 2; + + const int header_size = 26; + const int header_margin = 25; + const int border_size = 2; AddInternal(new Drawable[] { new Box { Colour = new Color4(0, 0, 0, 255), RelativeSizeAxes = Axes.X, - Height = borderSize, + Height = border_size, }, new Container { Padding = new MarginPadding { - Top = 20 + borderSize, + Top = 20 + border_size, Left = OptionsOverlay.CONTENT_MARGINS, Right = OptionsOverlay.CONTENT_MARGINS, Bottom = 10, @@ -54,12 +55,12 @@ namespace osu.Game.Overlays.Options { headerLabel = new OsuSpriteText { - TextSize = headerSize, + TextSize = header_size, Text = Header, }, - content = new FlowContainer + FlowContent = new FlowContainer { - Margin = new MarginPadding { Top = headerSize + headerMargin }, + Margin = new MarginPadding { Top = header_size + header_margin }, Direction = FlowDirection.VerticalOnly, Spacing = new Vector2(0, 30), AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Options/Sections/EditorSection.cs b/osu.Game/Overlays/Options/Sections/EditorSection.cs index 44215f208a..513d89c601 100644 --- a/osu.Game/Overlays/Options/Sections/EditorSection.cs +++ b/osu.Game/Overlays/Options/Sections/EditorSection.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Options.Sections [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - content.Spacing = new Vector2(0, 5); + FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { new OsuCheckbox diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index a27415931b..b69e085e6b 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options.Sections public MaintenanceSection() { - content.Spacing = new Vector2(0, 5); + FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { new OsuButton diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 027a9896f5..56dd9ca318 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Options.Sections [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - content.Spacing = new Vector2(0, 5); + FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { new OptionLabel { Text = "TODO: Skin preview textures" }, diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index e119640f55..b0762f3fd5 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -17,7 +17,8 @@ namespace osu.Game.Overlays.Options public class Sidebar : Container { private FlowContainer content; - internal const int default_width = 60, expanded_width = 200; + internal const int DEFAULT_WIDTH = 60; + internal const int EXPANDED_WIDTH = 200; protected override Container Content => content; public Sidebar() @@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Options expandEvent = Scheduler.AddDelayed(() => { expandEvent = null; - ResizeTo(new Vector2(expanded_width, Height), 150, EasingTypes.OutQuad); + ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 150, EasingTypes.OutQuad); }, 750); return true; } @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.Options protected override void OnHoverLost(InputState state) { expandEvent?.Cancel(); - ResizeTo(new Vector2(default_width, Height), 150, EasingTypes.OutQuad); + ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 150, EasingTypes.OutQuad); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Options/SidebarButton.cs b/osu.Game/Overlays/Options/SidebarButton.cs index fae8f08333..83c2227763 100644 --- a/osu.Game/Overlays/Options/SidebarButton.cs +++ b/osu.Game/Overlays/Options/SidebarButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options private SpriteText headerText; private Box backgroundBox; private Box selectionIndicator; - public Container text; + private Container text; public Action Action; private OptionsSection section; @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Options public SidebarButton() { - Height = Sidebar.default_width; + Height = Sidebar.DEFAULT_WIDTH; RelativeSizeAxes = Axes.X; Children = new Drawable[] { @@ -73,13 +73,13 @@ namespace osu.Game.Overlays.Options }, text = new Container { - Width = Sidebar.default_width, + Width = Sidebar.DEFAULT_WIDTH, RelativeSizeAxes = Axes.Y, Children = new[] { headerText = new OsuSpriteText { - Position = new Vector2(Sidebar.default_width + 10, 0), + Position = new Vector2(Sidebar.DEFAULT_WIDTH + 10, 0), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 970e5b46ae..0894cb06ca 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; - public const float SIDEBAR_WIDTH = Sidebar.default_width; + public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH; private const float width = 400; diff --git a/osu.Game/Overlays/Pause/PauseButton.cs b/osu.Game/Overlays/Pause/PauseButton.cs index 68d8611ff7..03b4a2a09f 100644 --- a/osu.Game/Overlays/Pause/PauseButton.cs +++ b/osu.Game/Overlays/Pause/PauseButton.cs @@ -16,10 +16,10 @@ namespace osu.Game.Overlays.Pause { public class PauseButton : ClickableContainer { - private const float hoverWidth = 0.9f; - private const float hoverDuration = 500; - private const float glowFadeDuration = 250; - private const float clickDuration = 200; + private const float hover_width = 0.9f; + private const float hover_duration = 500; + private const float glow_fade_duration = 250; + private const float click_duration = 200; private Color4 backgroundColour = OsuColour.Gray(34); @@ -67,12 +67,12 @@ namespace osu.Game.Overlays.Pause protected override bool OnClick(Framework.Input.InputState state) { didClick = true; - colourContainer.ResizeTo(new Vector2(1.5f, 1f), clickDuration, EasingTypes.In); + colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); SampleClick?.Play(); Action?.Invoke(); - Delay(clickDuration); + Delay(click_duration); Schedule(delegate { colourContainer.ResizeTo(new Vector2(0.8f, 1f), 0, EasingTypes.None); spriteText.Spacing = Vector2.Zero; @@ -84,9 +84,9 @@ namespace osu.Game.Overlays.Pause protected override bool OnHover(Framework.Input.InputState state) { - colourContainer.ResizeTo(new Vector2(hoverWidth, 1f), hoverDuration, EasingTypes.OutElastic); - spriteText.TransformSpacingTo(new Vector2(3f, 0f), hoverDuration, EasingTypes.OutElastic); - glowContainer.FadeIn(glowFadeDuration, EasingTypes.Out); + colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); + spriteText.TransformSpacingTo(new Vector2(3f, 0f), hover_duration, EasingTypes.OutElastic); + glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); SampleHover?.Play(); return true; } @@ -95,9 +95,9 @@ namespace osu.Game.Overlays.Pause { if (!didClick) { - colourContainer.ResizeTo(new Vector2(0.8f, 1f), hoverDuration, EasingTypes.OutElastic); - spriteText.TransformSpacingTo(Vector2.Zero, hoverDuration, EasingTypes.OutElastic); - glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out); + colourContainer.ResizeTo(new Vector2(0.8f, 1f), hover_duration, EasingTypes.OutElastic); + spriteText.TransformSpacingTo(Vector2.Zero, hover_duration, EasingTypes.OutElastic); + glowContainer.FadeOut(glow_fade_duration, EasingTypes.Out); } didClick = false; @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Pause flash.Colour = ButtonColour; flash.BlendingMode = BlendingMode.Additive; flash.Alpha = 0.3f; - flash.FadeOutFromOne(clickDuration); + flash.FadeOutFromOne(click_duration); flash.Expire(); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index dc3dd47ca9..428cc206b7 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar { class ToolbarOverlayToggleButton : ToolbarButton { - private Box StateBackground; + private Box stateBackground; private OverlayContainer stateContainer; @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Toolbar public ToolbarOverlayToggleButton() { - Add(StateBackground = new Box + Add(stateBackground = new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(150).Opacity(180), @@ -61,10 +61,10 @@ namespace osu.Game.Overlays.Toolbar switch (state) { case Visibility.Hidden: - StateBackground.FadeOut(200); + stateBackground.FadeOut(200); break; case Visibility.Visible: - StateBackground.FadeIn(200); + stateBackground.FadeIn(200); break; } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index c5733337bb..15fce73a3b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both; Alpha = 0; - Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height); + Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonSystem.BUTTON_AREA_HEIGHT); Children = new Drawable[] { @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Menu Colour = colour, Scale = new Vector2(0, 1), Size = boxSize, - Shear = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0), + Shear = new Vector2(ButtonSystem.WEDGE_WIDTH / boxSize.Y, 0), Children = new Drawable[] { new Box diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 5f17feba23..a2c6f60bb4 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -36,9 +36,9 @@ namespace osu.Game.Screens.Menu private FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. - internal const float button_area_height = 100; - internal const float button_width = 140f; - internal const float wedge_width = 20; + internal const float BUTTON_AREA_HEIGHT = 100; + internal const float BUTTON_WIDTH = 140f; + internal const float WEDGE_WIDTH = 20; public const int EXIT_DELAY = 3000; @@ -64,7 +64,7 @@ namespace osu.Game.Screens.Menu Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Size = new Vector2(1, button_area_height), + Size = new Vector2(1, BUTTON_AREA_HEIGHT), Alpha = 0, Children = new Drawable[] { @@ -81,14 +81,14 @@ namespace osu.Game.Screens.Menu Direction = FlowDirection.HorizontalOnly, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, - Spacing = new Vector2(-wedge_width, 0), + Spacing = new Vector2(-WEDGE_WIDTH, 0), Children = new[] { - settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -wedge_width, Key.O), - backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -wedge_width, Key.Escape), + settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), + backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH, Key.Escape), iconFacade = new Container //need a container to make the osu! icon flow properly. { - Size = new Vector2(0, button_area_height) + Size = new Vector2(0, BUTTON_AREA_HEIGHT) } }, CentreTarget = iconFacade @@ -103,11 +103,11 @@ namespace osu.Game.Screens.Menu } }; - buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), wedge_width, Key.P)); + buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); buttonsPlay.Add(new Button(@"multi", @"multiplayer", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M)); buttonsPlay.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); - buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, wedge_width, Key.P)); + buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P)); buttonsTopLevel.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); buttonsTopLevel.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); buttonsTopLevel.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q)); @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Menu base.LoadComplete(); // osuLogo.SizeForFlow relies on loading to be complete. - buttonFlow.Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0); + buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + osuLogo.SizeForFlow / 4), 0); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/FailDialog.cs b/osu.Game/Screens/Play/FailDialog.cs index 0afed85452..a275a87626 100644 --- a/osu.Game/Screens/Play/FailDialog.cs +++ b/osu.Game/Screens/Play/FailDialog.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Play { protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); - private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); + private static readonly Vector2 background_blur = new Vector2(20); public FailDialog() { @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play protected override void OnEntering(GameMode last) { base.OnEntering(last); - Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000)); + Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000)); } protected override bool OnExiting(GameMode next) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 0ebd999006..363b386b42 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -18,14 +18,14 @@ namespace osu.Game.Screens.Ranking { protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); - private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); + private static readonly Vector2 background_blur = new Vector2(20); ScoreDisplay scoreDisplay; protected override void OnEntering(GameMode last) { base.OnEntering(last); - Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000)); + Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000)); } protected override bool OnExiting(GameMode next) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 802f904ae7..86cfc89763 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -30,13 +30,13 @@ namespace osu.Game.Screens.Select public BeatmapPanel SelectedPanel { get; private set; } private List yPositions = new List(); - private CarouselLifetimeList Lifetime; + private CarouselLifetimeList lifetime; public CarouselContainer() { DistanceDecayJump = 0.01; - Add(scrollableContent = new Container(Lifetime = new CarouselLifetimeList(DepthComparer)) + Add(scrollableContent = new Container(lifetime = new CarouselLifetimeList(DepthComparer)) { RelativeSizeAxes = Axes.X, }); @@ -187,9 +187,9 @@ namespace osu.Game.Screens.Select private static float offsetX(float dist, float halfHeight) { // The radius of the circle the carousel moves on. - const float CIRCLE_RADIUS = 3; - double discriminant = Math.Max(0, CIRCLE_RADIUS * CIRCLE_RADIUS - dist * dist); - float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight; + const float circle_radius = 3; + double discriminant = Math.Max(0, circle_radius * circle_radius - dist * dist); + float x = (circle_radius - (float)Math.Sqrt(discriminant)) * halfHeight; return 125 + x; } @@ -226,7 +226,7 @@ namespace osu.Game.Screens.Select float drawHeight = DrawHeight; float halfHeight = drawHeight / 2; - foreach (Panel p in Lifetime.AliveItems) + foreach (Panel p in lifetime.AliveItems) { float panelPosY = p.Position.Y; p.IsOnScreen = panelPosY >= Current - p.DrawHeight && panelPosY <= Current + drawHeight; @@ -240,12 +240,12 @@ namespace osu.Game.Screens.Select int lastIndex = yPositions.BinarySearch(Current + drawHeight); if (lastIndex < 0) lastIndex = ~lastIndex; - Lifetime.StartIndex = firstIndex; - Lifetime.EndIndex = lastIndex; + lifetime.StartIndex = firstIndex; + lifetime.EndIndex = lastIndex; for (int i = firstIndex; i < lastIndex; ++i) { - Panel p = Lifetime[i]; + Panel p = lifetime[i]; if (p.State != PanelSelectedState.Hidden) p.IsOnScreen = true; //we don't want to update the on-screen state of hidden pannels as they have incorrect (stacked) y values. updatePanel(p, halfHeight); diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 4e21dfaba0..7152523b45 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -81,13 +81,13 @@ namespace osu.Game.Screens.Select set { text.Text = value; } } - private void FadeActive() + private void fadeActive() { box.FadeIn(300); text.FadeColour(Color4.White, 300); } - private void FadeInactive() + private void fadeInactive() { box.FadeOut(300); text.FadeColour(fadeColour, 300); @@ -101,9 +101,9 @@ namespace osu.Game.Screens.Select { active = value; if (active) - FadeActive(); + fadeActive(); else - FadeInactive(); + fadeInactive(); } } @@ -114,14 +114,14 @@ namespace osu.Game.Screens.Select protected override bool OnHover(InputState state) { if (!active) - FadeActive(); + fadeActive(); return true; } protected override void OnHoverLost(InputState state) { if (!active) - FadeInactive(); + fadeInactive(); } public TabItem() diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 1c06703025..1ef970b7f0 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -54,10 +54,10 @@ namespace osu.Game.Screens.Select public Footer() { - const float bottomToolHeight = 50; + const float bottom_tool_height = 50; RelativeSizeAxes = Axes.X; - Height = bottomToolHeight; + Height = bottom_tool_height; Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; Children = new Drawable[] diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index a8dc639652..ccc0732984 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Select private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50); private BeatmapInfoWedge beatmapInfoWedge; - private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); + private static readonly Vector2 background_blur = new Vector2(20); private CancellationTokenSource initialAddSetsTask; private AudioSample sampleChangeDifficulty; @@ -116,8 +116,8 @@ namespace osu.Game.Screens.Select private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame, OsuColour colours) { - const float carouselWidth = 640; - const float bottomToolHeight = 50; + const float carousel_width = 640; + const float bottom_tool_height = 50; beatmapGroups = new List(); Children = new Drawable[] { @@ -130,14 +130,14 @@ namespace osu.Game.Screens.Select new WedgeBackground { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = carouselWidth * 0.76f }, + Padding = new MarginPadding { Right = carousel_width * 0.76f }, }, } }, carousel = new CarouselContainer { RelativeSizeAxes = Axes.Y, - Size = new Vector2(carouselWidth, 1), + Size = new Vector2(carousel_width, 1), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, }, @@ -299,7 +299,7 @@ namespace osu.Game.Screens.Select if (backgroundModeBeatmap != null) { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 1000); + backgroundModeBeatmap.BlurTo(background_blur, 1000); } if (beatmap != null) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index c3f287f6ae..e9b225da4e 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -1,12 +1,30 @@  + SOLUTION + SUGGESTION + HINT DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW + ERROR + HINT DO_NOT_SHOW + HINT + HINT + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + + True DO_NOT_SHOW + HINT DO_NOT_SHOW + DO_NOT_SHOW DO_NOT_SHOW - <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers></Profile> + HINT + SUGGESTION + HINT + <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSUpdateFileHeader>True</CSUpdateFileHeader><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers></Profile> + Code Cleanup (peppy) True True True @@ -17,6 +35,7 @@ True NEXT_LINE NEXT_LINE + True False False True @@ -29,6 +48,23 @@ True 200 CHOP_ALWAYS + False + False + AABB + API + BPM + GC + GL + GLSL + HID + ID + IP + IPC + LTRB + RNG + SRGB + TK + HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> <TypePattern DisplayName="COM interfaces or structs"> @@ -413,17 +449,25 @@ </Group> </TypePattern> </Patterns> + Copyright (c) 2007-$CURRENT_YEAR$ ppy Pty Ltd <contact@ppy.sh>. +Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="private 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="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" /> True True True