-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1814 from andy840119/use-enum-value-instead
Use generic Enum and CreateDelegate methods.
- Loading branch information
Showing
18 changed files
with
33 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// 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 NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Karaoke.Graphics.Shapes; | ||
using osu.Game.Rulesets.Karaoke.Utils; | ||
using osu.Game.Tests.Visual; | ||
using osuTK; | ||
|
||
|
@@ -45,7 +45,7 @@ private void load(OsuColour colours) | |
[Test] | ||
public void TestRightAngleDirections() | ||
{ | ||
foreach (var direction in EnumUtils.GetValues<TriangleRightAngleDirection>()) | ||
foreach (var direction in Enum.GetValues<TriangleRightAngleDirection>()) | ||
{ | ||
AddStep($"Test direction {direction}", () => | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// 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.Linq; | ||
using osu.Framework.Extensions; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Karaoke.UI; | ||
using osu.Game.Rulesets.Karaoke.Utils; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.Scoring; | ||
|
||
|
@@ -16,7 +16,7 @@ public partial class TestSceneDrawableJudgement : KaraokeSkinnableTestScene | |
{ | ||
public TestSceneDrawableJudgement() | ||
{ | ||
foreach (var result in EnumUtils.GetValues<HitResult>().Skip(1)) | ||
foreach (var result in Enum.GetValues<HitResult>().Skip(1)) | ||
{ | ||
AddStep("Show " + result.GetDescription(), () => SetContents(_ => | ||
new DrawableNoteJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Rulesets.Karaoke.Objects.Types; | ||
using osu.Game.Rulesets.Karaoke.Utils; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Components.ContextMenu | ||
{ | ||
|
@@ -23,7 +21,7 @@ public LyricLockContextMenu(ILockChangeHandler lockChangeHandler, Lyric lyric, s | |
public LyricLockContextMenu(ILockChangeHandler lockChangeHandler, List<Lyric> lyrics, string name) | ||
: base(name) | ||
{ | ||
Items = EnumUtils.GetValues<LockState>().Select(l => new OsuMenuItem(l.ToString(), anyLyricInLockState(l) ? MenuItemType.Highlighted : MenuItemType.Standard, () => | ||
Items = Enum.GetValues<LockState>().Select(l => new OsuMenuItem(l.ToString(), anyLyricInLockState(l) ? MenuItemType.Highlighted : MenuItemType.Standard, () => | ||
{ | ||
// todo: how to make lyric as selected? | ||
lockChangeHandler.Lock(l); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
@@ -11,7 +9,6 @@ | |
using osu.Framework.Extensions.IEnumerableExtensions; | ||
using osu.Framework.Graphics.UserInterface; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Rulesets.Karaoke.Utils; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Components.Menus | ||
{ | ||
|
@@ -46,7 +43,7 @@ private ToggleMenuItem[] createMenuItems() | |
}).ToArray(); | ||
} | ||
|
||
protected virtual IEnumerable<T> ValidEnums => EnumUtils.GetValues<T>(); | ||
protected virtual IEnumerable<T> ValidEnums => Enum.GetValues<T>(); | ||
|
||
protected string GetName(T selection) | ||
=> selection.GetDescription(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters