From c42b9c38352281a69aad849f6bf232ddec05af5a Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 29 Apr 2023 11:55:44 +0800 Subject: [PATCH] Remove the group class. --- .../Skinning/Groups/BaseGroup.cs | 41 ------------------- .../Skinning/Groups/GroupByLyricIds.cs | 25 ----------- .../Skinning/Groups/GroupBySingerIds.cs | 20 --------- .../Skinning/Groups/GroupBySingerNumber.cs | 20 --------- .../Skinning/Groups/IGroup.cs | 17 -------- 5 files changed, 123 deletions(-) delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Groups/BaseGroup.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupByLyricIds.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerIds.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerNumber.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Groups/IGroup.cs diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Groups/BaseGroup.cs b/osu.Game.Rulesets.Karaoke/Skinning/Groups/BaseGroup.cs deleted file mode 100644 index 3dbb44cc2..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Groups/BaseGroup.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.ComponentModel; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Skinning.Elements; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Groups -{ - public abstract class BaseGroup : IGroup where THitObject : KaraokeHitObject - { - public int ID { get; set; } - - public string Name { get; set; } = string.Empty; - - public bool InTheGroup(KaraokeHitObject hitObject, ElementType elementType) - { - bool accepted = isTypeAccepted(hitObject, elementType); - return accepted && InTheGroup((THitObject)hitObject); - } - - protected abstract bool InTheGroup(THitObject hitObject); - - private static bool isTypeAccepted(KaraokeHitObject hitObject, ElementType elementType) - { - switch (elementType) - { - case ElementType.LyricFontInfo: - case ElementType.LyricLayout: - case ElementType.LyricStyle: - return hitObject is Lyric; - - case ElementType.NoteStyle: - return hitObject is Note; - - default: - throw new InvalidEnumArgumentException(nameof(elementType)); - } - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupByLyricIds.cs b/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupByLyricIds.cs deleted file mode 100644 index 0d2924726..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupByLyricIds.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Rulesets.Karaoke.Objects; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Groups -{ - public class GroupByLyricIds : BaseGroup - { - public IReadOnlyList LyricIds { get; set; } = Array.Empty(); - - protected override bool InTheGroup(KaraokeHitObject hitObject) - { - return hitObject switch - { - Lyric lyric => LyricIds.Contains(lyric.ID), - Note note => note.ReferenceLyricId != null && LyricIds.Contains(note.ReferenceLyricId.Value), - _ => false - }; - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerIds.cs b/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerIds.cs deleted file mode 100644 index 0314c03c5..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerIds.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Rulesets.Karaoke.Objects; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Groups -{ - public class GroupBySingerIds : BaseGroup - { - public IReadOnlyList SingerIds { get; set; } = Array.Empty(); - - protected override bool InTheGroup(Lyric hitObject) - { - return SingerIds.Any(x => hitObject.SingerIds.Contains(x)); - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerNumber.cs b/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerNumber.cs deleted file mode 100644 index 073b192f5..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Groups/GroupBySingerNumber.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Rulesets.Karaoke.Objects; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Groups -{ - public class GroupBySingerNumber : BaseGroup - { - public int SingerNumber { get; set; } - - protected override bool InTheGroup(Lyric hitObject) - { - if (SingerNumber == 0) - return false; - - return hitObject.SingerIds.Count == SingerNumber; - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Groups/IGroup.cs b/osu.Game.Rulesets.Karaoke/Skinning/Groups/IGroup.cs deleted file mode 100644 index 87cd4f3bc..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Groups/IGroup.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Skinning.Elements; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Groups -{ - public interface IGroup - { - public int ID { get; set; } - - public string Name { get; set; } - - bool InTheGroup(KaraokeHitObject hitObject, ElementType elementType); - } -}