1
0
mirror of synced 2025-02-25 22:28:13 +01:00

Add back buttons and random for Favorite songs folder, since the methods for those were changed I will need to add the global random button back through

This commit is contained in:
0aubsq 2022-03-04 08:23:11 +01:00
parent 74ea1b8baa
commit 1434679221
2 changed files with 107 additions and 9 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Drawing;
namespace TJAPlayer3 namespace TJAPlayer3
{ {
@ -25,12 +26,91 @@ namespace TJAPlayer3
#region [Extra methods] #region [Extra methods]
// Generate a back button
public static C曲リストード tGenerateBackButton(C曲リストード parent, string path = "/", List<string> listStrBoxDef = null)
{
C曲リストード itemBack = new C曲リストード();
itemBack.eード種別 = C曲リストード.Eード種別.BACKBOX;
// とじる
itemBack.strタイトル = CLangManager.LangInstance.GetString(200) + " (" + path + ")";
itemBack.BackColor = ColorTranslator.FromHtml("#513009");
itemBack.BoxColor = Color.White;
itemBack.BgColor = parent.BgColor;
itemBack.isChangedBgColor = parent.isChangedBgColor;
itemBack.BgType = parent.BgType;
itemBack.isChangedBgType = parent.isChangedBgType;
itemBack.strジャンル = parent.strジャンル;
itemBack.nスコア数 = 1;
itemBack.r親ード = parent;
itemBack.strSkinPath = (parent.r親ード == null) ?
"" : parent.r親ード.strSkinPath;
// I guess this is used to count the number of box.def instances and only at startup, which makes using it here pretty weird
if (listStrBoxDef != null && itemBack.strSkinPath != "" && !listStrBoxDef.Contains(itemBack.strSkinPath))
{
listStrBoxDef.Add(itemBack.strSkinPath);
}
itemBack.strBreadcrumbs = (itemBack.r親ード == null) ?
itemBack.strタイトル : itemBack.r親ード.strBreadcrumbs + " > " + itemBack.strタイトル;
itemBack.arスコア[0] = new Cスコア();
itemBack.arスコア[0].. = "";
itemBack.arスコア[0].. = itemBack.strタイトル;
itemBack.arスコア[0].. = "";
return (itemBack);
}
public static C曲リストード tGenerateRandomButton(C曲リストード parent, string path = "/")
{
C曲リストード itemRandom = new C曲リストード();
itemRandom.eード種別 = C曲リストード.Eード種別.RANDOM;
itemRandom.strタイトル = CLangManager.LangInstance.GetString(203) + " (" + path + ")"; ;
itemRandom.nスコア数 = (int)Difficulty.Total;
itemRandom.r親ード = parent;
itemRandom.strBreadcrumbs = (itemRandom.r親ード == null) ?
itemRandom.strタイトル : itemRandom.r親ード.strBreadcrumbs + " > " + itemRandom.strタイトル;
itemRandom.arスコア[0] = new Cスコア();
return itemRandom;
}
// Reset the position of all back buttons, also adds a random button at the end
public static List<C曲リストード> tReinsertBackButtons(C曲リストード parent, List<C曲リストード> songList, string path = "/", List<string> listStrBoxDef = null)
{
// Remove all the existing back boxes currently existing
songList.RemoveAll(e => e.eード種別 == C曲リストード.Eード種別.BACKBOX);
int songCount = songList.Count;
for (int index = 0; index < (songCount / 7) + 1; index++)
{
var backBox = tGenerateBackButton(parent, path, listStrBoxDef);
songList.Insert(Math.Min(index * (7 + 1), songList.Count), backBox);
}
if (songCount > 0)
songList.Add(tGenerateRandomButton(parent, path));
// Return the reference in case of
return songList;
}
// Generate the favorite folder content
public static List<C曲リストード> tFetchFavoriteFolder(C曲リストード parent) public static List<C曲リストード> tFetchFavoriteFolder(C曲リストード parent)
{ {
List<C曲リストード> childList = new List<C曲リストード>(); List<C曲リストード> childList = new List<C曲リストード>();
int increment = 0;
foreach (string id in TJAPlayer3.Favorites.data.favorites[TJAPlayer3.SaveFile]) foreach (string id in TJAPlayer3.Favorites.data.favorites[TJAPlayer3.SaveFile])
{ {
var node = tGetNodeFromID(id); var node = tGetNodeFromID(id);
@ -51,6 +131,13 @@ namespace TJAPlayer3
} }
} }
// Generate back buttons
string favPath = "./" + parent.strタイトル + "/";
tReinsertBackButtons(parent, childList, favPath);
return childList; return childList;
} }

View File

@ -1071,7 +1071,7 @@ namespace TJAPlayer3
private void t曲リストへ後処理を適用する( List<C曲リストード> , string parentName = "/", bool isGlobal = true ) private void t曲リストへ後処理を適用する( List<C曲リストード> , string parentName = "/", bool isGlobal = true )
{ {
/*
#region [ If there is at least one song within the list add a random song node ] #region [ If there is at least one song within the list add a random song node ]
@ -1090,12 +1090,11 @@ namespace TJAPlayer3
itemRandom.strタイトル : itemRandom.r親ード.strBreadcrumbs + " > " + itemRandom.strタイトル; itemRandom.strタイトル : itemRandom.r親ード.strBreadcrumbs + " > " + itemRandom.strタイトル;
itemRandom.arスコア[0] = new Cスコア(); itemRandom.arスコア[0] = new Cスコア();
/*
for (int i = 0; i < (int)Difficulty.Total; i++) for (int i = 0; i < (int)Difficulty.Total; i++)
{ {
itemRandom.arスコア[0].. = string.Format("< RANDOM SELECT Lv.{0} >", i + 1); itemRandom.arスコア[0].. = string.Format("< RANDOM SELECT Lv.{0} >", i + 1);
} }
*/
.Add(itemRandom); .Add(itemRandom);
#region [ ] #region [ ]
@ -1121,7 +1120,7 @@ namespace TJAPlayer3
//----------------------------- //-----------------------------
#endregion #endregion
*/
// すべてのノードについて… // すべてのノードについて…
foreach ( C曲リストード c曲リストード in ) foreach ( C曲リストード c曲リストード in )
@ -1132,12 +1131,19 @@ namespace TJAPlayer3
//----------------------------- //-----------------------------
if ( c曲リストード.eード種別 == C曲リストード.Eード種別.BOX ) if ( c曲リストード.eード種別 == C曲リストード.Eード種別.BOX )
{ {
int = c曲リストード.list子リスト.Count;
string newPath = parentName + c曲リストード.strタイトル + "/"; string newPath = parentName + c曲リストード.strタイトル + "/";
CSongDict.tReinsertBackButtons(c曲リストード, c曲リストード.list子リスト, newPath, listStrBoxDefSkinSubfolderFullName);
/*
int = c曲リストード.list子リスト.Count;
for (int index = 0; index < ( / 7) + 1; index++) for (int index = 0; index < ( / 7) + 1; index++)
{ {
C曲リストード itemBack = CSongDict.tGenerateBackButton(c曲リストード, newPath, listStrBoxDefSkinSubfolderFullName);
C曲リストード itemBack = new C曲リストード(); C曲リストード itemBack = new C曲リストード();
itemBack.eード種別 = C曲リストード.Eード種別.BACKBOX; itemBack.eード種別 = C曲リストード.Eード種別.BACKBOX;
@ -1175,7 +1181,9 @@ namespace TJAPlayer3
"BOX を出ます。" : "BOX を出ます。" :
"Exit from the BOX."; "Exit from the BOX.";
c曲リストード.list子リスト.Insert(Math.Min(index * (7 + 1), c曲リストード.list子リスト.Count), itemBack);
c曲リストード.list子リスト.Insert(Math.Min(index * (7 + 1), c曲リストード.list子リスト.Count), itemBack);
@ -1200,6 +1208,8 @@ namespace TJAPlayer3
#endregion #endregion
} }
*/
// Process subfolders recussively // Process subfolders recussively
t曲リストへ後処理を適用する(c曲リストード.list子リスト, newPath, false); t曲リストへ後処理を適用する(c曲リストード.list子リスト, newPath, false);
@ -1234,6 +1244,7 @@ namespace TJAPlayer3
} }
// Don't sort songs if the folder isn't global // Don't sort songs if the folder isn't global
// Call back reinsert back folders if sort called ?
if (isGlobal) if (isGlobal)
{ {
#region [ Sort nodes ] #region [ Sort nodes ]