From 6ec48abe7794527793ce1a792fb057126c85832d Mon Sep 17 00:00:00 2001 From: lactobionicAcid <104079561@qq.com> Date: Sun, 10 Nov 2024 15:51:07 +0800 Subject: [PATCH 1/3] Fix #5096 --- Plain Craft Launcher 2/Modules/ModMusic.vb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/ModMusic.vb b/Plain Craft Launcher 2/Modules/ModMusic.vb index 52a87a85..131e82b0 100644 --- a/Plain Craft Launcher 2/Modules/ModMusic.vb +++ b/Plain Craft Launcher 2/Modules/ModMusic.vb @@ -47,9 +47,13 @@ '初始化,确保存在音乐 If MusicAllList Is Nothing OrElse Not MusicAllList.Any() OrElse Not MusicWaitingList.Any() Then MusicListInit(False) '出列下一个音乐,如果出列结束则生成新列表 - DequeueNextMusicAddress = MusicWaitingList(0) - MusicWaitingList.RemoveAt(0) - If Not MusicWaitingList.Any() Then MusicListInit(False, DequeueNextMusicAddress) + If MusicWaitingList.Any() Then + DequeueNextMusicAddress = MusicWaitingList(0) + MusicWaitingList.RemoveAt(0) + If Not MusicWaitingList.Any() Then MusicListInit(False, DequeueNextMusicAddress) + Else + DequeueNextMusicAddress = "" + End If End Function #End Region @@ -195,9 +199,11 @@ ''' 开始播放音乐。 ''' Private Sub MusicStartPlay(Address As String, Optional IsFirstLoad As Boolean = False) - Log("[Music] 播放开始:" & Address) - MusicCurrent = Address - RunInNewThread(Sub() MusicLoop(IsFirstLoad), "Music", ThreadPriority.BelowNormal) + If Not Address = "" Then + Log("[Music] 播放开始:" & Address) + MusicCurrent = Address + RunInNewThread(Sub() MusicLoop(IsFirstLoad), "Music", ThreadPriority.BelowNormal) + End If End Sub '播放与暂停 @@ -293,9 +299,13 @@ Log(ex, "播放音乐失败(" & GetFileNameFromPath(MusicCurrent) & ")", LogLevel.Hint) End If Thread.Sleep(1000) + '将播放错误的音乐从列表中移除 + MusicAllList.Remove(MusicCurrent) + MusicWaitingList.Remove(MusicCurrent) If TypeOf ex Is FileNotFoundException Then MusicRefreshPlay(True, IsFirstLoad) ElseIf MusicAllList.Count > 1 Then + Else MusicStartPlay(DequeueNextMusicAddress(), IsFirstLoad) End If Finally From 66a2406e0a9c7ec82bcbf2fdc3706e6fbc477dea Mon Sep 17 00:00:00 2001 From: lactobionicAcid <104079561@qq.com> Date: Sun, 10 Nov 2024 16:10:03 +0800 Subject: [PATCH 2/3] Update ModMusic.vb --- Plain Craft Launcher 2/Modules/ModMusic.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/ModMusic.vb b/Plain Craft Launcher 2/Modules/ModMusic.vb index 131e82b0..34d001b3 100644 --- a/Plain Craft Launcher 2/Modules/ModMusic.vb +++ b/Plain Craft Launcher 2/Modules/ModMusic.vb @@ -304,7 +304,6 @@ MusicWaitingList.Remove(MusicCurrent) If TypeOf ex Is FileNotFoundException Then MusicRefreshPlay(True, IsFirstLoad) - ElseIf MusicAllList.Count > 1 Then Else MusicStartPlay(DequeueNextMusicAddress(), IsFirstLoad) End If From 531706e73bbb85f10c468fbdcb905ff99eaffcb1 Mon Sep 17 00:00:00 2001 From: lactobionicAcid <104079561@qq.com> Date: Sun, 10 Nov 2024 16:12:29 +0800 Subject: [PATCH 3/3] Update ModMusic.vb --- Plain Craft Launcher 2/Modules/ModMusic.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/ModMusic.vb b/Plain Craft Launcher 2/Modules/ModMusic.vb index 34d001b3..93062feb 100644 --- a/Plain Craft Launcher 2/Modules/ModMusic.vb +++ b/Plain Craft Launcher 2/Modules/ModMusic.vb @@ -298,7 +298,6 @@ Else Log(ex, "播放音乐失败(" & GetFileNameFromPath(MusicCurrent) & ")", LogLevel.Hint) End If - Thread.Sleep(1000) '将播放错误的音乐从列表中移除 MusicAllList.Remove(MusicCurrent) MusicWaitingList.Remove(MusicCurrent)