Permanant Recently played songs folder
This commit is contained in:
parent
3d39ecfa5e
commit
3041f6604b
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@
|
||||
/Test/dll/FDK.dll
|
||||
/Test/NamePlate.json
|
||||
/Test/Favorite.json
|
||||
/Test/RecentlyPlayedSongs.json
|
||||
/Test/SongsIgnored/*
|
||||
/Test/xadec.dll
|
||||
/Test/SoundDecoder.dll
|
||||
|
@ -106,6 +106,29 @@ namespace TJAPlayer3
|
||||
return songList;
|
||||
}
|
||||
|
||||
|
||||
private static C曲リストノード tReadaptChildNote(C曲リストノード parent, C曲リストノード node)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
node.r親ノード = parent;
|
||||
node.isChangedBgType = parent.isChangedBgType;
|
||||
node.isChangedBgColor = parent.isChangedBgColor;
|
||||
node.isChangedBoxType = parent.isChangedBoxType;
|
||||
node.isChangedBoxColor = parent.isChangedBoxColor;
|
||||
|
||||
node.ForeColor = parent.ForeColor;
|
||||
node.BackColor = parent.BackColor;
|
||||
node.BoxColor = parent.BoxColor;
|
||||
node.BgColor = parent.BgColor;
|
||||
node.BgType = parent.BgType;
|
||||
node.BoxType = parent.BoxType;
|
||||
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Generate the favorite folder content
|
||||
public static List<C曲リストノード> tFetchFavoriteFolder(C曲リストノード parent)
|
||||
{
|
||||
@ -113,22 +136,9 @@ namespace TJAPlayer3
|
||||
|
||||
foreach (string id in TJAPlayer3.Favorites.data.favorites[TJAPlayer3.SaveFile])
|
||||
{
|
||||
var node = tGetNodeFromID(id);
|
||||
var node = tReadaptChildNote(parent, tGetNodeFromID(id));
|
||||
if (node != null)
|
||||
{
|
||||
node.r親ノード = parent;
|
||||
node.isChangedBgType = parent.isChangedBgType;
|
||||
node.isChangedBgColor = parent.isChangedBgColor;
|
||||
node.isChangedBoxType = parent.isChangedBoxType;
|
||||
node.isChangedBoxColor = parent.isChangedBoxColor;
|
||||
|
||||
node.ForeColor = parent.ForeColor;
|
||||
node.BackColor = parent.BackColor;
|
||||
node.BoxColor = parent.BoxColor;
|
||||
node.BgColor = parent.BgColor;
|
||||
node.BgType = parent.BgType;
|
||||
node.BoxType = parent.BoxType;
|
||||
|
||||
childList.Add(node);
|
||||
}
|
||||
|
||||
@ -143,6 +153,29 @@ namespace TJAPlayer3
|
||||
return childList;
|
||||
}
|
||||
|
||||
public static List<C曲リストノード> tFetchRecentlyPlayedSongsFolder(C曲リストノード parent)
|
||||
{
|
||||
List<C曲リストノード> childList = new List<C曲リストノード>();
|
||||
|
||||
foreach (string id in TJAPlayer3.RecentlyPlayedSongs.data.recentlyplayedsongs[TJAPlayer3.SaveFile])
|
||||
{
|
||||
var node = tReadaptChildNote(parent, tGetNodeFromID(id));
|
||||
if (node != null)
|
||||
{
|
||||
childList.Add(node);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generate back buttons
|
||||
|
||||
string favPath = "./" + parent.strタイトル + "/";
|
||||
|
||||
tReinsertBackButtons(parent, childList, favPath);
|
||||
|
||||
return childList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
57
TJAPlayer3/Common/RecentlyPlayedSongs.cs
Normal file
57
TJAPlayer3/Common/RecentlyPlayedSongs.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TJAPlayer3
|
||||
{
|
||||
internal class RecentlyPlayedSongs
|
||||
{
|
||||
public void tRecentlyPlayedSongs() {
|
||||
if (!File.Exists("RecentlyPlayedSongs.json"))
|
||||
tSaveFile();
|
||||
|
||||
tLoadFile();
|
||||
}
|
||||
|
||||
#region [Auxiliary methods]
|
||||
|
||||
public void tAddChart(string chartID)
|
||||
{
|
||||
if (!data.recentlyplayedsongs[TJAPlayer3.SaveFile].Contains(chartID))
|
||||
data.recentlyplayedsongs[TJAPlayer3.SaveFile].Enqueue(chartID);
|
||||
|
||||
while (data.recentlyplayedsongs[TJAPlayer3.SaveFile].Count > 6) // Replace the 6 by a value defined in the settings later
|
||||
data.recentlyplayedsongs[TJAPlayer3.SaveFile].Dequeue();
|
||||
|
||||
tSaveFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public class Data
|
||||
{
|
||||
public Queue<string>[] recentlyplayedsongs = new Queue<string>[2] { new Queue<string>(), new Queue<string>() };
|
||||
}
|
||||
|
||||
public Data data = new Data();
|
||||
|
||||
#region [private]
|
||||
|
||||
private void tSaveFile()
|
||||
{
|
||||
ConfigManager.SaveConfig(data, "RecentlyPlayedSongs.json");
|
||||
}
|
||||
|
||||
private void tLoadFile()
|
||||
{
|
||||
data = ConfigManager.GetConfig<Data>(@"RecentlyPlayedSongs.json");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
@ -274,6 +274,12 @@ namespace TJAPlayer3
|
||||
private set;
|
||||
}
|
||||
|
||||
public static RecentlyPlayedSongs RecentlyPlayedSongs
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static Databases Databases
|
||||
{
|
||||
get;
|
||||
@ -2060,6 +2066,9 @@ for (int i = 0; i < 3; i++) {
|
||||
Favorites = new Favorites();
|
||||
Favorites.tFavorites();
|
||||
|
||||
RecentlyPlayedSongs = new RecentlyPlayedSongs();
|
||||
RecentlyPlayedSongs.tRecentlyPlayedSongs();
|
||||
|
||||
Databases = new Databases();
|
||||
Databases.tDatabases();
|
||||
|
||||
|
@ -664,6 +664,10 @@ namespace TJAPlayer3
|
||||
{
|
||||
this.act曲リスト.r現在選択中の曲.list子リスト = CSongDict.tFetchFavoriteFolder(this.act曲リスト.r現在選択中の曲);
|
||||
}
|
||||
else if (this.act曲リスト.r現在選択中の曲.strジャンル == "最近遊んだ曲")
|
||||
{
|
||||
this.act曲リスト.r現在選択中の曲.list子リスト = CSongDict.tFetchRecentlyPlayedSongsFolder(this.act曲リスト.r現在選択中の曲);
|
||||
}
|
||||
|
||||
CSongSelectSongManager.disable();
|
||||
|
||||
|
@ -1741,12 +1741,15 @@ namespace TJAPlayer3
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
//---------------------
|
||||
}
|
||||
//---------------------
|
||||
#endregion
|
||||
|
||||
// Song added to recently added songs here
|
||||
|
||||
TJAPlayer3.RecentlyPlayedSongs.tAddChart(TJAPlayer3.stage選曲.r確定された曲.uniqueId.data.id);
|
||||
|
||||
// Song added to recently added songs here
|
||||
|
||||
/*
|
||||
foreach (var song in TJAPlayer3.Songs管理.list曲ルート)
|
||||
{
|
||||
if (song.strジャンル == "最近遊んだ曲" && song.eノード種別 == C曲リストノード.Eノード種別.BOX)
|
||||
@ -1796,6 +1799,8 @@ namespace TJAPlayer3
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
b最近遊んだ曲追加済み = true;
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,7 @@
|
||||
<Compile Include="Animations\IAnimatable.cs" />
|
||||
<Compile Include="Animations\Linear.cs" />
|
||||
<Compile Include="Common\CCrypto.cs" />
|
||||
<Compile Include="Common\RecentlyPlayedSongs.cs" />
|
||||
<Compile Include="Common\ModalQueue.cs" />
|
||||
<Compile Include="Common\Modal.cs" />
|
||||
<Compile Include="Common\CSongDict.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user