From d18a3c51ec7c3705bde8526b661a4d70084e9fa1 Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:02:29 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0=E6=AD=8C=E8=AF=8D=E4=B8=8D=E8=80=83=E8=99=91=E5=BB=B6?= =?UTF-8?q?=E8=BF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs | 2 +- .../Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs index 72d60f0..fc429ab 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs @@ -40,7 +40,7 @@ public List ToLyricList() //可能存在一行歌词多个时间,所以先创建列表 List lyrics = new List(); - //Logging.Log($"处理歌词: {lyricString}"); + //Logger.Log($"处理歌词: {lyricString}"); bool propertyDetected = false; string propertyName = string.Empty; diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs index d69e270..1679c7c 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs @@ -164,6 +164,7 @@ private void load() { bgBox.Colour = colourProvider.Highlight1.Opacity(isCurrent ? 1 : 0); }, true); + plugin.Offset.BindValueChanged(_ => Schedule(() => UpdateValue(Value)), true); } private bool isCurrent_real; @@ -196,7 +197,7 @@ protected override void UpdateValue(Lyric lyric) contentText.Text = lyric.Content; translateText.Text = lyric.TranslatedString; - var timeSpan = TimeSpan.FromMilliseconds(lyric.Time); + var timeSpan = TimeSpan.FromMilliseconds(Math.Max(lyric.Time - plugin.Offset.Value, 0)); timeText.Text = $"{timeSpan:mm\\:ss\\.fff}"; TooltipText = $"{timeText.Text}" + (string.IsNullOrEmpty(lyric.Content) @@ -215,7 +216,7 @@ protected override void UpdateValue(Lyric lyric) protected override bool OnClick(ClickEvent e) { - mvisScreen.SeekTo(Value.Time + 1); + mvisScreen.SeekTo(Value.Time + 1 - plugin.Offset.Value); return base.OnClick(e); } From 5a4c2aafc24b97f5faadad032831e76a31c54031 Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:11:24 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=AD=8C=E8=AF=8D=E8=B7=B3=E8=BF=87=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CloudMusic/Helper/LyricProcessor.cs | 52 +++++++++++-------- .../Plugins/Bundle/CloudMusic/LyricPlugin.cs | 21 +++++--- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs index c243825..00ff666 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs @@ -75,24 +75,13 @@ public void Search(SearchOption searchOption) if (!searchOption.NoLocalFile) { - try - { - string filePath = $"custom/lyrics/beatmap-{beatmap.BeatmapSetInfo.ID}.json"; - - string content = File.ReadAllText(storage.GetFullPath(filePath, true)); - - var deserializeObject = JsonConvert.DeserializeObject(content); + var localLyrics = GetLocalLyrics(beatmap); - if (deserializeObject != null) - { - onFinish?.Invoke(deserializeObject); - setState(SearchState.Success); - return; - } - } - catch + if (localLyrics != null) { - //忽略异常 + setState(SearchState.Success); + onFinish?.Invoke(localLyrics); + return; } } @@ -116,7 +105,7 @@ public void Search(SearchOption searchOption) //处理要搜索的歌名: "标题 艺术家" string title = beatmap.Metadata.GetTitle(); string artist = searchOption.NoArtist ? string.Empty : $" {beatmap.Metadata.GetArtist()}"; - string target = encoder.Encode($"{title}{artist}"); + string target = encoder.Encode($"{title} {artist}"); var req = new APISearchRequest(target); @@ -147,6 +136,24 @@ public void Search(SearchOption searchOption) currentSearchRequest = req; } + public APILyricResponseRoot? GetLocalLyrics(WorkingBeatmap beatmap) + { + APILyricResponseRoot? deserializedObject = null; + + try + { + string path = storage.GetFullPath(lyricFilePath(beatmap), true); + string content = File.ReadAllText(path); + deserializedObject = JsonConvert.DeserializeObject(content); + } + catch + { + //忽略异常 + } + + return deserializedObject; + } + /// /// 通过给定的网易云音乐ID搜索歌曲 /// @@ -181,6 +188,8 @@ public void SearchByNeteaseID(long id, WorkingBeatmap beatmap, Action $"custom/lyrics/beatmap-{beatmap.BeatmapSetInfo.ID}.json"; + /// /// 当歌曲搜索请求完成后... /// @@ -260,15 +269,12 @@ private void onSongSearchRequestFinish(RequestFinishMeta meta, APISearchRequest? [Resolved] private Storage storage { get; set; } = null!; - public void WriteLrcToFile(APILyricResponseRoot? responseRoot, WorkingBeatmap working) + public void WriteLrcToFile(APILyricResponseRoot? responseRoot, WorkingBeatmap beatmap) { try { - string target = $"custom/lyrics/beatmap-{working.BeatmapSetInfo.ID}.json"; - - string serializeObject = JsonConvert.SerializeObject(responseRoot); - - File.WriteAllText(storage.GetFullPath(target, true), serializeObject); + string serializedObject = JsonConvert.SerializeObject(responseRoot); + File.WriteAllText(storage.GetFullPath(lyricFilePath(beatmap), true), serializedObject); } catch (Exception e) { diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/LyricPlugin.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/LyricPlugin.cs index 6cbdeac..eb6e5e2 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/LyricPlugin.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/LyricPlugin.cs @@ -284,15 +284,24 @@ public void RefreshLyric(bool noLocalFile = false) Lyrics.Clear(); currentResponseRoot = null; CurrentLine = null; - Offset.Value = 0d; - if (UserDefinitionHelper.BeatmapMetaHaveDefinition(CurrentWorkingBeatmap.BeatmapInfo, out long neid)) - GetLyricFor(neid); - else if (UserDefinitionHelper.OnlineIDHaveDefinition(CurrentWorkingBeatmap.BeatmapSetInfo.OnlineID, out neid)) - GetLyricFor(neid); + var localLyrics = LyricProcessor.GetLocalLyrics(CurrentWorkingBeatmap); + + if (noLocalFile || localLyrics == null) + { + if (UserDefinitionHelper.BeatmapMetaHaveDefinition(CurrentWorkingBeatmap.BeatmapInfo, out long neid)) + GetLyricFor(neid); + else if (UserDefinitionHelper.OnlineIDHaveDefinition(CurrentWorkingBeatmap.BeatmapSetInfo.OnlineID, out neid)) + GetLyricFor(neid); + else + LyricProcessor.Search(SearchOption.From(CurrentWorkingBeatmap, noLocalFile, onLyricRequestFinished, onLyricRequestFail, TitleSimilarThreshold.Value)); + } else - LyricProcessor.Search(SearchOption.From(CurrentWorkingBeatmap, noLocalFile, onLyricRequestFinished, onLyricRequestFail, TitleSimilarThreshold.Value)); + { + LyricProcessor.State.Value = LyricProcessor.SearchState.Success; + onLyricRequestFinished(localLyrics); + } } private double targetTime => track.CurrentTime + Offset.Value; From 879696927b59bd167afb13f721a5cecbba642d6f Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:20:40 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=B7=B3=E8=BF=87=E6=9C=AC=E5=9C=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs index 00ff666..9333084 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs @@ -73,7 +73,7 @@ public void Search(SearchOption searchOption) var onFinish = searchOption.OnFinish; var onFail = searchOption.OnFail; - if (!searchOption.NoLocalFile) + if (!searchOption.NoLocalFile && searchOption.NoRetry) { var localLyrics = GetLocalLyrics(beatmap); From edf27269ab7f5b17a1b1c0ed62e39d0b43f5676d Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:02:11 +0800 Subject: [PATCH 4/7] Bindable change --- .../CloudMusic/Sidebar/Graphic/LyricPiece.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs index 1679c7c..31193fb 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs @@ -1,5 +1,6 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -36,13 +37,14 @@ public partial class LyricPiece : DrawableLyric, IHasTooltip, IHasContextMenu new OsuMenuItem( CloudMusicStrings.AdjustOffsetToLyric.ToString(), MenuItemType.Standard, - () => plugin.Offset.Value = Value.Time - mvisScreen.CurrentTrack.CurrentTime) + () => plugin.Offset.Value = Value.Time - llinScreen.CurrentTrack.CurrentTime) }; private Box hoverBox = null!; private OsuSpriteText contentText = null!; private OsuSpriteText translateText = null!; private OsuSpriteText timeText = null!; + private readonly BindableDouble offset = new BindableDouble(); public LyricPiece(Lyric lrc) { @@ -58,7 +60,7 @@ public LyricPiece() } [Resolved] - private IImplementLLin mvisScreen { get; set; } = null!; + private IImplementLLin llinScreen { get; set; } = null!; [Resolved] private CustomColourProvider colourProvider { get; set; } = null!; @@ -164,24 +166,30 @@ private void load() { bgBox.Colour = colourProvider.Highlight1.Opacity(isCurrent ? 1 : 0); }, true); - plugin.Offset.BindValueChanged(_ => Schedule(() => UpdateValue(Value)), true); + offset.BindValueChanged(_ => Schedule(() => UpdateValue(Value)), true); } - private bool isCurrent_real; + private bool isCurrentReal; private bool isCurrent { - get => isCurrent_real; + get => isCurrentReal; set { bgBox.FadeColour(colourProvider.Highlight1.Opacity(value ? 1 : 0), 300, Easing.OutQuint); textFillFlow.FadeColour(value ? Color4.Black : Color4.White, 300, Easing.OutQuint); timeText.FadeColour(value ? Color4.Black : Color4.White, 300, Easing.OutQuint); - isCurrent_real = value; + isCurrentReal = value; } } + protected override void LoadComplete() + { + base.LoadComplete(); + offset.BindTo(plugin.Offset); + } + protected override void Update() { isCurrent = plugin.CurrentLine != null && plugin.CurrentLine.Equals(Value); @@ -216,7 +224,7 @@ protected override void UpdateValue(Lyric lyric) protected override bool OnClick(ClickEvent e) { - mvisScreen.SeekTo(Value.Time + 1 - plugin.Offset.Value); + llinScreen.SeekTo(Value.Time + 1 - plugin.Offset.Value); return base.OnClick(e); } From 1c3cf1c1a74f3edc87562452c7cc2c5b76e012f4 Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:04:20 +0800 Subject: [PATCH 5/7] Compare ignore case --- .../Plugins/Bundle/CloudMusic/Helper/RequestFinishMeta.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/RequestFinishMeta.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/RequestFinishMeta.cs index 28c4138..3d928ff 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/RequestFinishMeta.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/RequestFinishMeta.cs @@ -43,8 +43,8 @@ public struct RequestFinishMeta /// 相似度百分比 public float GetSimiliarPrecentage() { - string neteaseTitle = GetNeteaseTitle(); - string ourTitle = SourceBeatmap?.Metadata.GetTitle() ?? string.Empty; + string neteaseTitle = GetNeteaseTitle().ToLowerInvariant(); + string ourTitle = SourceBeatmap?.Metadata.GetTitle().ToLowerInvariant() ?? string.Empty; string source = neteaseTitle.Length > ourTitle.Length ? neteaseTitle : ourTitle; string target = neteaseTitle.Length > ourTitle.Length ? ourTitle : neteaseTitle; From 46114a8be2a9a0db62947642cf96e400c9eed563 Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:26:33 +0800 Subject: [PATCH 6/7] Some i18n --- .../LLin/Plugins/CloudMusicStrings.zh.resx | 15 +++++++++++++++ .../Localisation/LLin/Plugins/StpStrings.zh.resx | 9 +++++++++ .../Localisation/LLin/Plugins/YaspStrings.zh.resx | 3 +++ M.Resources/M.Resources.csproj | 2 +- .../Bundle/CloudMusic/Helper/LyricProcessor.cs | 11 ++++++----- .../CloudMusic/Misc/APILyricResponseRoot.cs | 4 ++-- .../Bundle/CloudMusic/Misc/StringExtensions.cs | 4 ++-- .../Bundle/CloudMusic/Sidebar/Graphic/Toolbox.cs | 6 +++--- .../UI/Settings/SandboxSettings.cs | 1 + .../Plugins/Bundle/SandboxToPanel/SandboxPanel.cs | 6 +++--- .../Player/Plugins/Bundle/Yasp/YaspPlugin.cs | 2 +- .../Internal/DummyAudio/DummyAudioPlugin.cs | 4 ++-- .../LLin/Plugins/CloudMusicStrings.cs | 10 ++++++++++ .../Localisation/LLin/Plugins/StpStrings.cs | 6 ++++++ .../Localisation/LLin/Plugins/YaspStrings.cs | 4 +++- 15 files changed, 67 insertions(+), 20 deletions(-) diff --git a/M.Resources/Localisation/LLin/Plugins/CloudMusicStrings.zh.resx b/M.Resources/Localisation/LLin/Plugins/CloudMusicStrings.zh.resx index c2c8ed6..9278658 100644 --- a/M.Resources/Localisation/LLin/Plugins/CloudMusicStrings.zh.resx +++ b/M.Resources/Localisation/LLin/Plugins/CloudMusicStrings.zh.resx @@ -108,4 +108,19 @@ 对其偏移至该歌词 + + 未找到歌曲或信息不匹配 + + + 搜索中 + + + 模糊搜索中 + + + 已就绪 + + + 按网易云ID搜索歌词 + \ No newline at end of file diff --git a/M.Resources/Localisation/LLin/Plugins/StpStrings.zh.resx b/M.Resources/Localisation/LLin/Plugins/StpStrings.zh.resx index 31f53af..c960505 100644 --- a/M.Resources/Localisation/LLin/Plugins/StpStrings.zh.resx +++ b/M.Resources/Localisation/LLin/Plugins/StpStrings.zh.resx @@ -63,4 +63,13 @@ 频谱密度 + + Type A 设置 + + + Type B 设置 + + + 旋转唱片 + \ No newline at end of file diff --git a/M.Resources/Localisation/LLin/Plugins/YaspStrings.zh.resx b/M.Resources/Localisation/LLin/Plugins/YaspStrings.zh.resx index fdf8b94..712b67b 100644 --- a/M.Resources/Localisation/LLin/Plugins/YaspStrings.zh.resx +++ b/M.Resources/Localisation/LLin/Plugins/YaspStrings.zh.resx @@ -21,4 +21,7 @@ (封面II) 使用头像作为封面 + + 面板样式 + \ No newline at end of file diff --git a/M.Resources/M.Resources.csproj b/M.Resources/M.Resources.csproj index a432cda..a001180 100644 --- a/M.Resources/M.Resources.csproj +++ b/M.Resources/M.Resources.csproj @@ -16,6 +16,6 @@ - + diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs index 9333084..1e69111 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Helper/LyricProcessor.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using System.Net.Http; using System.Text.Encodings.Web; @@ -8,10 +7,12 @@ using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Rulesets.IGPlayer.Feature.Player.Misc; using osu.Game.Rulesets.IGPlayer.Feature.Player.Plugins.Bundle.CloudMusic.Misc; +using osu.Game.Rulesets.IGPlayer.Localisation.LLin.Plugins; using Component = osu.Framework.Graphics.Component; namespace osu.Game.Rulesets.IGPlayer.Feature.Player.Plugins.Bundle.CloudMusic.Helper @@ -22,16 +23,16 @@ public partial class LyricProcessor : Component public enum SearchState { - [Description("未找到歌曲或信息不匹配")] + [LocalisableDescription(typeof(CloudMusicStrings), nameof(CloudMusicStrings.SearchStateFail))] Fail, - [Description("搜索中")] + [LocalisableDescription(typeof(CloudMusicStrings), nameof(CloudMusicStrings.SearchStateSearching))] Searching, - [Description("模糊搜索中")] + [LocalisableDescription(typeof(CloudMusicStrings), nameof(CloudMusicStrings.SearchStateFuzzySearching))] FuzzySearching, - [Description("已就绪")] + [LocalisableDescription(typeof(CloudMusicStrings), nameof(CloudMusicStrings.SearchStateSuccess))] Success } diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs index fc429ab..44e14fd 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/APILyricResponseRoot.cs @@ -107,7 +107,7 @@ public List ToLyricList() string propertyName = string.Empty; string lyricContent = string.Empty; - IList times = new List(); + List times = []; //Logging.Log($"处理翻译歌词: {tlyricString}"); @@ -155,7 +155,7 @@ public List ToLyricList() foreach (var lrc in result.FindAll(l => l.Time == time)) { lrc.TranslatedString = lyricContent; - //Logging.Log($"设置歌词歌词: {lrc}"); + //Logger.Log($"设置歌词: {lrc}"); } } } diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs index e981d28..d648040 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs @@ -10,8 +10,8 @@ public static class StringExtensions public static int ToMilliseconds(this string src) { string[] spilt = src.Contains(':') - ? src.Split(":") - : src.Split(".", 2); + ? src.Split(':') + : src.Split('.', 2); if (spilt.Length < 2) { diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/Toolbox.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/Toolbox.cs index 342bcbb..d2880ec 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/Toolbox.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/Toolbox.cs @@ -129,7 +129,7 @@ private void load(LyricPlugin plugin) { this.Schedule(() => { - statusText.Text = $"{v.NewValue.GetDescription()}"; + statusText.Text = v.NewValue.GetLocalisableDescription(); var color = Color4.White; @@ -191,7 +191,7 @@ private void initToolbox() Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.X, - PlaceholderText = "按网易云ID搜索歌词" + PlaceholderText = CloudMusicStrings.SearchById }, new FillFlowContainer { @@ -243,7 +243,7 @@ private void initToolbox() plugin.GetLyricFor(id); else { - textBox.Text = ""; + textBox.Text = string.Empty; } }; } diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/RulesetComponents/UI/Settings/SandboxSettings.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/RulesetComponents/UI/Settings/SandboxSettings.cs index 9bdb695..e54ec30 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/RulesetComponents/UI/Settings/SandboxSettings.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/RulesetComponents/UI/Settings/SandboxSettings.cs @@ -85,6 +85,7 @@ public SandboxSettingsSection[] Sections [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + private readonly FillFlowContainer sectionsFlow; public SettingsContent() diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/SandboxPanel.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/SandboxPanel.cs index e399643..d8a6f07 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/SandboxPanel.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/SandboxToPanel/SandboxPanel.cs @@ -119,12 +119,12 @@ public override SettingsEntry[] GetSettingEntries(IPluginConfigManager pluginCon }, new BooleanSettingsEntry { - Name = "旋转唱片", + Name = StpStrings.SpinningCoverAndVisualizer, Bindable = config.GetBindable(SandboxRulesetSetting.SpinningCoverAndVisualizer) }, new SeparatorSettingsEntry { - Name = "Type A设置" + Name = StpStrings.TypeASettings }, new NumberSettingsEntry { @@ -188,7 +188,7 @@ public override SettingsEntry[] GetSettingEntries(IPluginConfigManager pluginCon }, new SeparatorSettingsEntry { - Name = "Type B设置" + Name = StpStrings.TypeBSettings }, new NumberSettingsEntry { diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/Yasp/YaspPlugin.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/Yasp/YaspPlugin.cs index c5efa2b..157d934 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/Yasp/YaspPlugin.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/Yasp/YaspPlugin.cs @@ -53,7 +53,7 @@ public override SettingsEntry[] GetSettingEntries(IPluginConfigManager pluginCon }, new EnumSettingsEntry { - Name = "面板样式", + Name = YaspStrings.PanelType, Bindable = config.GetBindable(YaspSettings.PanelType) } }; diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Internal/DummyAudio/DummyAudioPlugin.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Internal/DummyAudio/DummyAudioPlugin.cs index 67f6c13..771e022 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Internal/DummyAudio/DummyAudioPlugin.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Internal/DummyAudio/DummyAudioPlugin.cs @@ -10,11 +10,11 @@ namespace osu.Game.Rulesets.IGPlayer.Feature.Player.Plugins.Internal.DummyAudio { internal partial class DummyAudioPlugin : LLinPlugin { - internal DummyAudioPlugin(MConfigManager config, LLinPluginManager plmgr) + internal DummyAudioPlugin(MConfigManager config, LLinPluginManager pluginManager) { HideFromPluginManagement = true; this.config = config; - this.PluginManager = plmgr; + PluginManager = pluginManager; Name = "音频"; Version = LLinPluginManager.LatestPluginVersion; diff --git a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/CloudMusicStrings.cs b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/CloudMusicStrings.cs index 9afd523..ceee471 100644 --- a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/CloudMusicStrings.cs +++ b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/CloudMusicStrings.cs @@ -71,6 +71,16 @@ public class CloudMusicStrings //其他 public static LocalisableString AdjustOffsetToLyric => new TranslatableString(getKey(@"offset_adjust_to_lyric"), @"Adjust offset to lyric"); + public static LocalisableString SearchStateFail => new TranslatableString(getKey(@"search_state_fail"), @"Not found or song info doesn't match"); + + public static LocalisableString SearchStateSearching => new TranslatableString(getKey(@"search_state_searching"), @"Searching"); + + public static LocalisableString SearchStateFuzzySearching => new TranslatableString(getKey(@"search_state_fuzzy_searching"), @"Fuzzy searching"); + + public static LocalisableString SearchStateSuccess => new TranslatableString(getKey(@"search_state_success"), @"Ready"); + + public static LocalisableString SearchById => new TranslatableString(getKey(@"search_by_id"), @"Search by music ID"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/StpStrings.cs b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/StpStrings.cs index a6aa11b..bb4f949 100644 --- a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/StpStrings.cs +++ b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/StpStrings.cs @@ -17,6 +17,12 @@ public class StpStrings public static LocalisableString VisualizerLayoutType => new TranslatableString(getKey(@"layout_type"), @"Layout Type"); + public static LocalisableString SpinningCoverAndVisualizer => new TranslatableString(getKey(@"spinning_cover_and_visualizer"), @"Spinning Cover"); + + public static LocalisableString TypeASettings => new TranslatableString(getKey(@"type_a_settings"), @"Type A Settings"); + + public static LocalisableString TypeBSettings => new TranslatableString(getKey(@"type_a_settings"), @"Type B Settings"); + public static LocalisableString Radius => new TranslatableString(getKey(@"radius"), @"Radius"); public static LocalisableString BarType => new TranslatableString(getKey(@"bar_type"), @"Bar Type"); diff --git a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/YaspStrings.cs b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/YaspStrings.cs index 00476b6..444076c 100644 --- a/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/YaspStrings.cs +++ b/osu.Game.Rulesets.IGPlayer/Localisation/LLin/Plugins/YaspStrings.cs @@ -6,10 +6,12 @@ public static class YaspStrings { private const string prefix = @"M.Resources.Localisation.LLin.Plugins.YaspStrings"; - public static LocalisableString Scale => new TranslatableString(getKey(@"scale"), @"Classic scaling"); + public static LocalisableString Scale => new TranslatableString(getKey(@"scale"), @"Classic Scaling"); public static LocalisableString UseAvatarForCoverIICover => new TranslatableString(getKey(@"use_avatar_for_coverii"), @"(CoverII) Use Avatar"); + public static LocalisableString PanelType => new TranslatableString(getKey(@"panel_type"), @"Panel Type"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } From a4ed101fac5da1ffba25f8230b42701bef510aac Mon Sep 17 00:00:00 2001 From: PercyDan54 <50285552+PercyDan54@users.noreply.github.com> Date: Wed, 25 Sep 2024 19:18:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=88=91=E6=9C=89=E5=BC=BA=E8=BF=AB?= =?UTF-8?q?=E7=97=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CloudMusic/Sidebar/Graphic/LyricPiece.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs index 31193fb..4961def 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Sidebar/Graphic/LyricPiece.cs @@ -205,26 +205,26 @@ protected override void UpdateValue(Lyric lyric) contentText.Text = lyric.Content; translateText.Text = lyric.TranslatedString; - var timeSpan = TimeSpan.FromMilliseconds(Math.Max(lyric.Time - plugin.Offset.Value, 0)); + var timeSpan = TimeSpan.FromMilliseconds(Math.Max(lyric.Time - offset.Value, 0)); timeText.Text = $"{timeSpan:mm\\:ss\\.fff}"; TooltipText = $"{timeText.Text}" + (string.IsNullOrEmpty(lyric.Content) - ? "" + ? string.Empty : $"- {lyric.Content}") + (string.IsNullOrEmpty(lyric.TranslatedString) - ? "" + ? string.Empty : $"- {lyric.TranslatedString}"); - haveLyric = string.IsNullOrEmpty(lyric.Content); + haveLyric = !string.IsNullOrWhiteSpace(lyric.Content); Colour = haveLyric - ? Color4Extensions.FromHex(@"555") - : Color4.White; + ? Color4.White + : Color4Extensions.FromHex(@"555"); } protected override bool OnClick(ClickEvent e) { - llinScreen.SeekTo(Value.Time + 1 - plugin.Offset.Value); + llinScreen.SeekTo(Value.Time + 1 - offset.Value); return base.OnClick(e); }