From 577ce6153f911a3031ed2ed07592c7e91294247f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 2 Aug 2020 12:28:43 +0900 Subject: [PATCH] Clean-up code by rider <3 Also update nuget package. --- .../Skinning/TestSceneNotePlayfield.cs | 1 - osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs | 7 ++++--- osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs | 1 - .../Changelog/ChangeLogMarkdownContainer.cs | 7 +++++-- .../Skinning/KaraokeInternalSkin.cs | 2 +- .../Skinning/KaraokeLegacySkinTransformer.cs | 3 --- .../UI/Components/SaitenStatus.cs | 14 +++++++++++++- .../osu.Game.Rulesets.Karaoke.csproj | 2 +- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneNotePlayfield.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneNotePlayfield.cs index dda8221ab..e2546c4ab 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneNotePlayfield.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneNotePlayfield.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Game.Rulesets.Karaoke.Configuration; using osu.Game.Rulesets.Karaoke.UI; namespace osu.Game.Rulesets.Karaoke.Tests.Skinning diff --git a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs index a0d67dde8..b04a68c7e 100644 --- a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs +++ b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs @@ -42,19 +42,20 @@ private void load(KaraokeRulesetConfigManager config, IBindable().Any(x => !x.MicrophoneEnabled); + if (disableMicrophoneDeviceByMod) { session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.AutoPlay); return; } - var beatmapSaitenable = beatmap.Value.Beatmap.IsScorable(); + if (!beatmapSaitenable) { session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.NotSaitening); @@ -72,7 +73,7 @@ private void load(KaraokeRulesetConfigManager config, IBindable githubUrls = new Dictionary + private readonly IDictionary githubUrls = new Dictionary { { "karaoke", "https://github.com/karaoke-dev/karaoke/" }, { "edge", "https://github.com/karaoke-dev/karaoke" }, @@ -193,13 +193,14 @@ protected override void AddLinkText(string text, LinkInline linkInline) var baseUri = new Uri(githubUrls[text]); // Get hash tag with number - var pattern = @"(\#[0-9]+\b)(?!;)"; + const string pattern = @"(\#[0-9]+\b)(?!;)"; var issueOrRequests = Regex.Matches(linkInline.Url, pattern, RegexOptions.IgnoreCase); if (!issueOrRequests.Any()) return; AddText("("); + foreach (var issue in issueOrRequests.Select(x=>x.Value)) { AddDrawable(new MarkdownLinkText($"{text}{issue}", new LinkInline @@ -210,10 +211,12 @@ protected override void AddLinkText(string text, LinkInline linkInline) if(issue != issueOrRequests.LastOrDefault()?.Value) AddText(", "); } + AddText(")"); // add use name if has user var user = linkInline.Url.Split('@').LastOrDefault(); + if (!string.IsNullOrEmpty(user)) { var textScale = new Vector2(0.7f); diff --git a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeInternalSkin.cs b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeInternalSkin.cs index 72d78200a..fbbc2962e 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeInternalSkin.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeInternalSkin.cs @@ -27,7 +27,7 @@ public abstract class KaraokeInternalSkin : ISkin protected abstract string ResourceName { get; } - public KaraokeInternalSkin() + protected KaraokeInternalSkin() { // TODO : need a better way to load resource var assembly = Assembly.GetExecutingAssembly(); diff --git a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeLegacySkinTransformer.cs b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeLegacySkinTransformer.cs index e6c93c1ad..3bfee7bda 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeLegacySkinTransformer.cs @@ -5,11 +5,8 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Textures; -using osu.Game.Audio; using osu.Game.IO; using osu.Game.Rulesets.Karaoke.Beatmaps.Formats; using osu.Game.Rulesets.Karaoke.Skinning.Components; diff --git a/osu.Game.Rulesets.Karaoke/UI/Components/SaitenStatus.cs b/osu.Game.Rulesets.Karaoke/UI/Components/SaitenStatus.cs index fa97897fc..544b5a271 100644 --- a/osu.Game.Rulesets.Karaoke/UI/Components/SaitenStatus.cs +++ b/osu.Game.Rulesets.Karaoke/UI/Components/SaitenStatus.cs @@ -50,7 +50,7 @@ public SaitenStatusMode SaitenStatusMode set { statusMode = value; - Children = new Drawable[] + Children = new[] { CreateIcon(statusMode == SaitenStatusMode.Saitening), CreateStatusSpriteText(GetSaitenStatusText(statusMode)) @@ -64,28 +64,40 @@ protected virtual string GetSaitenStatusText(SaitenStatusMode statusMode) { case SaitenStatusMode.AndroidMicrophonePermissionDeclined: return "Go to setting to open permission for lazer."; + case SaitenStatusMode.AndroidDoesNotSupported: return "Android device haven't support saiten system yet :("; + case SaitenStatusMode.IOSMicrophonePermissionDeclined: return "Go to setting to open permission for lazer."; + case SaitenStatusMode.IOSDoesNotSupported: return "iOS device haven't support saiten system yet :("; + case SaitenStatusMode.OSXMicrophonePermissionDeclined: return "Go to setting to open permission for lazer."; + case SaitenStatusMode.OSXDoesNotSupported: return "Osx device haven't support saiten system yet :("; + case SaitenStatusMode.WindowsMicrophonePermissionDeclined: return "Open lazer with admin permission to enable saiten system."; + case SaitenStatusMode.NotSaitening: return "This beatmap is not saitenable."; + case SaitenStatusMode.AutoPlay: return "Auto play mode."; + case SaitenStatusMode.Edit: return "Edit mode."; + case SaitenStatusMode.Saitening: return "Saiteining..."; + case SaitenStatusMode.NotInitialized: return "Seems microphone device is not ready."; + default: return "Weird... Should not goes to here either :oops:"; } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index 1a68a9246..d2f64ea3c 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -13,7 +13,7 @@ - +