From 2d8e94704d516b8ce7460af376e38a751d170585 Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Fri, 8 Aug 2025 16:32:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E9=BB=9E=E6=AD=8C=E6=9B=B2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=88=AA=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DBObj/SongList.cs | 59 ++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/DBObj/SongList.cs b/DBObj/SongList.cs index 3fb7adc..b26f30a 100644 --- a/DBObj/SongList.cs +++ b/DBObj/SongList.cs @@ -9,10 +9,10 @@ namespace DBObj { private static bool isWelcome = true; public static SongData welcome; - public static SongData close ; - private static SongData publicPlaying=null; + public static SongData close; + private static SongData publicPlaying = null; private static List publicSong = new(); - private static SongData playing=null; + private static SongData playing = null; private static List not_played = new List(); private static List played = new List(); public static List PublicSong() => publicSong; @@ -20,7 +20,7 @@ namespace DBObj public static SongData Current() { Console.WriteLine(not_played.Count + " Current " + playing); - return (playing ==null) ? publicPlaying : playing; + return (playing == null) ? publicPlaying : playing; } public static SongData Next() { @@ -58,17 +58,22 @@ namespace DBObj } private static SongData NextPublicSong() { - if (Program.room.IsClose()) { + if (Program.room.IsClose()) + { publicPlaying = close; - } else if(Program.room.IsOpen() && isWelcome){ + } + else if (Program.room.IsOpen() && isWelcome) + { isWelcome = false; publicPlaying = welcome; - } else { + } + else + { publicPlaying = publicSong[0]; publicSong.RemoveAt(0); publicSong.Add(publicPlaying); } - + return publicPlaying; } @@ -92,31 +97,28 @@ namespace DBObj { played.Add(new SongData(song, PlayState.NoFile)); } - + } - public static void Cancel(SongData song) + public static void Cancel(SongData song) { - //if (song.FileExistsInServers()) - //{ - not_played.Remove(song); - played.Remove(song); - // PrimaryForm.Instance.AddSongCount(songData.Number); - chkCut(); - //} + not_played.Remove(song); + played.Remove(song); + chkCut(); } public static void Insert(SongData song) { - if (song.FileExistsInServers()) { - not_played.Insert(0, new SongData(song,PlayState.InsertPlayback)); + if (song.FileExistsInServers()) + { + not_played.Insert(0, new SongData(song, PlayState.InsertPlayback)); chkCut(); } else { played.Add(new SongData(song, PlayState.NoFile)); } - + } private static void chkCut() { @@ -126,21 +128,26 @@ namespace DBObj PrimaryForm.Instance.Invoke(new System.Action(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong())); else PrimaryForm.Instance.videoPlayerForm.PlayNextSong(); - } else { + } + else + { UpdateNextSongLabel(); } } - + public static void UpdateNextSongLabel() { - if (Program.room.IsClose()) { + if (Program.room.IsClose()) + { VideoPlayerForm.overlayForm.UpdateTopLeftLabel(" "); - } else { + } + else + { VideoPlayerForm.overlayForm.UpdateTopLeftLabel( (not_played.Count > 0) ? not_played[0].next_song_text() : "目前沒有下一首,請踴躍點歌!!!" ); } - + } public static void roomClose() { @@ -160,6 +167,6 @@ namespace DBObj not_played.Clear(); played.Clear(); } - + } }