Skip to content

Commit

Permalink
Convert delegate to local function.
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyaoyuan committed Nov 12, 2019
1 parent 42a98c5 commit f3f5094
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ csharp_style_deconstructed_variable_declaration = true:warning
#Style - other C# 7.x features
dotnet_style_prefer_inferred_tuple_names = true:warning
csharp_prefer_simple_default_expression = true:warning
csharp_style_pattern_local_over_anonymous_function = true:silent
csharp_style_pattern_local_over_anonymous_function = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent

#Style - C# 8 features
Expand Down
3 changes: 1 addition & 2 deletions osu.Game/Screens/Menu/Disclaimer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
Expand Down Expand Up @@ -93,7 +92,7 @@ private void load(OsuColour colours, IAPIProvider api)
textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
textFlow.NewParagraph();

Action<SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);
static void format(SpriteText t) => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);

textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format);
textFlow.NewParagraph();
Expand Down
8 changes: 4 additions & 4 deletions osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Internal;
using osu.Framework.Allocation;
Expand Down Expand Up @@ -77,12 +76,13 @@ private void load(OsuColour colours)

private void scoresLoaded(IEnumerable<APIRoomScoreInfo> scores)
{
Action<SpriteText> gray = s => s.Colour = colours.GrayC;
Action<SpriteText> white = s =>
void gray(SpriteText s) => s.Colour = colours.GrayC;

void white(SpriteText s)
{
s.Font = s.Font.With(size: s.Font.Size * 1.4f);
s.Colour = colours.GrayF;
};
}

rankText.AddText(name + "\n", white);
rankText.AddText("You are placed ", gray);
Expand Down

0 comments on commit f3f5094

Please sign in to comment.