Skip to content

Commit

Permalink
Merge pull request #2311 from andy840119/format-the-code
Browse files Browse the repository at this point in the history
Format the code.
  • Loading branch information
andy840119 authored Dec 7, 2024
2 parents e6c0f71 + b208760 commit 30c19aa
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 60 deletions.
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke.Architectures/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private static string getRelativeNamespace(Project.ProjectAttribute project, str

public static IEnumerable<MethodMember> GetMethodMembersContainsName(this IType type, string name)
{
return type.GetMethodMembers().WhereNameContains<MethodMember>(name);
return type.GetMethodMembers().WhereNameContains(name);
}

public static IEnumerable<TType> WhereNameContains<TType>(this IEnumerable<TType> source, string name) where TType : IHasName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using osu.Game.Rulesets.Karaoke.Configuration;
using osu.Game.Rulesets.Karaoke.Edit.Utils;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Stages.Infos.Types;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ protected virtual void SetUpStageInfo<TStageInfo>(Action<TStageInfo>? action = n
public void AssertStageInfos(Action<IList<StageInfo>> assert)
=> throw new NotImplementedException();

public void AssertStageInfo<TStageInfo>(Action<TStageInfo> assert) where TStageInfo: StageInfo
public void AssertStageInfo<TStageInfo>(Action<TStageInfo> assert) where TStageInfo : StageInfo
=> throw new NotImplementedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ protected override double GeneratePreemptTime(Lyric hitObject)

protected override Tuple<double?, double?> GetStartAndEndTime(Lyric lyric)
{
if(!lyric.TimeValid)
if (!lyric.TimeValid)
return new Tuple<double?, double?>(null, null);

return new Tuple<double?, double?>(lyric.StartTime, lyric.EndTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static IBeatmap createTestingBeatmap(IEnumerable<Lyric>? lyrics)
return new EditorBeatmap(karaokeBeatmap);
}

private static StageInfo createTestingStageInfo( Action<ClassicLyricLayoutCategory>? editStageAction = null)
private static StageInfo createTestingStageInfo(Action<ClassicLyricLayoutCategory>? editStageAction = null)
{
var stageInfo = new ClassicStageInfo();
editStageAction?.Invoke(stageInfo.LyricLayoutCategory);
Expand Down
8 changes: 4 additions & 4 deletions osu.Game.Rulesets.Karaoke.Tests/Helper/TestCaseTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static RubyTag ParseRubyTag(string? str)
getStringPropertyRegex(':', "ruby"),
});

return getMatchByStatement<RubyTag>(str, regex, result =>
return getMatchByStatement(str, regex, result =>
{
if (result == null)
return new RubyTag();
Expand Down Expand Up @@ -103,7 +103,7 @@ public static TimeTag ParseTimeTag(string? str)
getStringPropertyRegex('#', "text"),
});

return getMatchByStatement<TimeTag>(str, regex, result =>
return getMatchByStatement(str, regex, result =>
{
if (result == null)
return new TimeTag(new TextIndex());
Expand Down Expand Up @@ -165,7 +165,7 @@ public static Lyric ParseLyric(string str, int? id = null)
getStringPropertyRegex(':', "lyric"),
});

return getMatchByStatement<Lyric>(str, regex, result =>
return getMatchByStatement(str, regex, result =>
{
if (result == null)
return new Lyric();
Expand Down Expand Up @@ -218,7 +218,7 @@ public static Singer ParseSinger(string? str)
{
string regex = generateRegex(id_str, Array.Empty<string>());

return getMatchByStatement<Singer>(str, regex, result =>
return getMatchByStatement(str, regex, result =>
{
if (result == null)
return new Singer().ChangeId(ElementId.Empty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.IO.Serialization;
using osu.Game.Rulesets.Karaoke.IO.Serialization.Converters;
using osu.Game.Rulesets.Karaoke.Skinning.Elements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TestSceneKaraokeModPerfect()
public void TestLyric(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Lyric
{
Text = "カラオケ!",
TimeTags = new []
TimeTags = new[]
{
new TimeTag(new TextIndex(), 1000),
new TimeTag(new TextIndex(3, TextIndex.IndexState.End), 2000),
Expand Down
2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Stages.Infos;

namespace osu.Game.Rulesets.Karaoke.Beatmaps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Beatmaps;
using osu.Game.Rulesets.Karaoke.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Karaoke.Utils;
using osu.Game.Rulesets.Mods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Setup.Components;

public partial class FormSingerList : CompositeDrawable
{
public BindableList<Singer> Singers { get; } = new();
public BindableList<Singer> Singers { get; } = new();

public LocalisableString Caption { get; init; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@ public DrawableKaraokeSpriteText(Lyric lyric)

protected DrawableKaraokeSpriteText(Lyric lyric)
{
processor = new DisplayLyricProcessor(lyric);
processor.TopTextChanged = topTexts =>
processor = new DisplayLyricProcessor(lyric)
{
TopTexts = topTexts;
OnPropertyChanged();
};
processor.CenterTextChanged = text =>
{
Text = text;
OnPropertyChanged();
};
processor.BottomTextChanged = bottomTexts =>
{
BottomTexts = bottomTexts;
OnPropertyChanged();
};
processor.TimeTagsChanged = timeTags =>
{
TimeTags = timeTags;
OnPropertyChanged();
TopTextChanged = topTexts =>
{
TopTexts = topTexts;
OnPropertyChanged();
},
CenterTextChanged = text =>
{
Text = text;
OnPropertyChanged();
},
BottomTextChanged = bottomTexts =>
{
BottomTexts = bottomTexts;
OnPropertyChanged();
},
TimeTagsChanged = timeTags =>
{
TimeTags = timeTags;
OnPropertyChanged();
},
};
processor.UpdateAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ public partial class DrawableLyricSpriteText : LyricSpriteText

public DrawableLyricSpriteText(Lyric lyric)
{
processor = new DisplayLyricProcessor(lyric);
processor.TopTextChanged = topTexts =>
processor = new DisplayLyricProcessor(lyric)
{
TopTexts = topTexts;
};
processor.CenterTextChanged = text =>
{
Text = text;
};
processor.BottomTextChanged = bottomTexts =>
{
BottomTexts = bottomTexts;
TopTextChanged = topTexts =>
{
TopTexts = topTexts;
},
CenterTextChanged = text =>
{
Text = text;
},
BottomTextChanged = bottomTexts =>
{
BottomTexts = bottomTexts;
},
};
processor.UpdateAll();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Numerics;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays.Settings;
using System.Numerics;

namespace osu.Game.Rulesets.Karaoke.Graphics.UserInterfaceV2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ private static void openLyricImporter(IScreen? screen, IImportBeatmapChangeHandl
if (screen == null)
return;

var importer = new LyricImporter();
importer.OnImportFinished = importBeatmapChangeHandler.Import;
var importer = new LyricImporter
{
OnImportFinished = importBeatmapChangeHandler.Import,
};
screen.Push(importer);
}
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace osu.Game.Rulesets.Karaoke.Screens.Edit;

/// <summary>
/// Copy the Component from the <see cref="osu.Game.Screens.Edit"/>
/// Copy the Component from the <see cref="Game.Screens.Edit"/>
/// </summary>
public partial class BottomBar : CompositeDrawable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Stages;
using osu.Game.Rulesets.Karaoke.Edit.Utils;
using osu.Game.Rulesets.Karaoke.Screens.Edit.Stages.Classic.Stage.Settings;
using osu.Game.Rulesets.Karaoke.Stages.Infos.Classic;
using osu.Game.Screens.Edit;

namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Stages.Classic.Stage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace osu.Game.Rulesets.Karaoke.Stages.Commands;

public class StageHeightCommand: StageCommand<float>
public class StageHeightCommand : StageCommand<float>
{
public StageHeightCommand(Easing easing, double startTime, double endTime, float startValue, float endValue)
: base(easing, startTime, endTime, startValue, endValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override void Add(Drawable drawable)
{
base.Add(drawable);

if(drawable is KaraokePlayfield karaokePlayfield)
if (drawable is KaraokePlayfield karaokePlayfield)
stagePlayfieldRunner.UpdatePlayfieldTransforms(karaokePlayfield);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ static float getTargetPosition(PreviewStageDefinition definition, PreviewLyricLa

static float getPreemptAlpha(PreviewStageDefinition definition, PreviewLyricLayout layout)
{
if(isFirstLyricInView(layout))
if (isFirstLyricInView(layout))
return 1;

if(isLastLyricInView(layout))
if (isLastLyricInView(layout))
return 0;

return definition.InactiveAlpha;
}

static float getTargetAlpha(PreviewStageDefinition definition, PreviewLyricLayout layout)
{
if(isFirstLyricInView(layout))
if (isFirstLyricInView(layout))
return 1;

return definition.InactiveAlpha;
Expand Down
1 change: 0 additions & 1 deletion osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Utils/StackTraceUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class StackTraceUtils
{
public static bool IsStackTraceContains(string text)
{
string? stackTrace = Environment.StackTrace;
string? stackTrace = Environment.StackTrace;
return stackTrace.Contains(text);
}
}

0 comments on commit 30c19aa

Please sign in to comment.