2024-07-05 16:21:33 +00:00
|
|
|
|
using MU3.DataStudio;
|
|
|
|
|
using MU3.DB;
|
2024-07-05 00:15:56 +00:00
|
|
|
|
using MU3.Util;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
using System.Reflection;
|
2024-07-05 00:15:56 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace MU3.ViewData;
|
|
|
|
|
|
|
|
|
|
class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
|
|
|
|
private delegate int CompareProc(MusicSelectViewData d1, MusicSelectViewData d2, bool forSort1);
|
|
|
|
|
private delegate string GetCategoryNameProc(MusicSelectViewData d);
|
|
|
|
|
private MusicSort1ID __sort1;
|
|
|
|
|
private CompareProc _compareProc1;
|
2024-07-05 10:49:45 +00:00
|
|
|
|
private CompareProc _compareProc2;
|
2024-07-05 00:15:56 +00:00
|
|
|
|
private GetCategoryNameProc _getCategoryNameProc;
|
2024-08-30 17:20:26 +00:00
|
|
|
|
private PropertyInfo _reMasterPi = null;
|
2024-07-05 00:15:56 +00:00
|
|
|
|
|
|
|
|
|
private extern void orig_set__sort1(MusicSort1ID value);
|
2024-07-05 10:49:45 +00:00
|
|
|
|
private extern void orig_set__sort2(MusicSort2ID value);
|
2024-07-05 00:15:56 +00:00
|
|
|
|
|
|
|
|
|
private void set__sort1(MusicSort1ID value) {
|
|
|
|
|
if(value == (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
|
|
|
|
__sort1 = value;
|
|
|
|
|
_compareProc1 = compareByInternalLevel;
|
|
|
|
|
_getCategoryNameProc = getCategoryNameByInternalLevel;
|
|
|
|
|
} else {
|
|
|
|
|
orig_set__sort1(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-05 10:49:45 +00:00
|
|
|
|
|
|
|
|
|
private void set__sort2(MusicSort2ID value) {
|
|
|
|
|
orig_set__sort2(value);
|
|
|
|
|
if(value == MusicSort2ID.Level) {
|
|
|
|
|
_compareProc2 = compareByInternalLevel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-05 16:21:33 +00:00
|
|
|
|
private bool isReMaster(Data.MusicData d) {
|
|
|
|
|
// Fall back for pre-Act3
|
2024-08-30 17:20:26 +00:00
|
|
|
|
if(_reMasterPi == null) {
|
2024-07-05 16:21:33 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-08-30 17:20:26 +00:00
|
|
|
|
return (bool)_reMasterPi.GetValue(d, null);
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public extern void orig_create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2);
|
|
|
|
|
|
|
|
|
|
public new void create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2) {
|
2024-08-30 17:20:26 +00:00
|
|
|
|
_reMasterPi = typeof(Data.MusicData).GetProperty("isReMaster");
|
2024-07-05 16:21:33 +00:00
|
|
|
|
orig_create(gameViewData, chapterSelection, difficulty, sort1, sort2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string getMetaGategoryName(MusicSelectViewData d) {
|
|
|
|
|
var remas = isReMaster(d.musicViewData.data);
|
|
|
|
|
if(d.musicViewData.data.isBonusTrack) {
|
|
|
|
|
return "ボーナストラック";
|
|
|
|
|
}
|
|
|
|
|
if(d.musicViewData.data.isLunatic && remas && __sort1 != MusicSort1ID.Level && __sort1 != (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
|
|
|
|
return "Re:MASTER";
|
|
|
|
|
}
|
|
|
|
|
return d.musicViewData.data.isLunatic && !remas ? "LUNATIC" : null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-05 00:15:56 +00:00
|
|
|
|
private string getCategoryNameByInternalLevel(MusicSelectViewData d) {
|
|
|
|
|
StringBuilder stringBuilder = Singleton<MU3.Sys.System>.instance.getStringBuilder();
|
|
|
|
|
Data.FumenData fumenData = ((d.musicViewData.data == null) ? null : d.musicViewData.data.fumenData[(int)d.difficulty]);
|
|
|
|
|
stringBuilder.Append("LEVEL ");
|
|
|
|
|
stringBuilder.AppendFormat("{0}", (fumenData == null) ? (-1) : (fumenData.fumenConst.ToString("0.0")));
|
|
|
|
|
return stringBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-05 10:49:45 +00:00
|
|
|
|
private int getSortKeyByInternalLevel(MusicSelectViewData d) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return (int)Math.Round(d.musicViewData.data.fumenData[(int)d.difficulty].fumenConst * 10.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int compareByInternalLevel(MusicSelectViewData d1, MusicSelectViewData d2, bool forSort1) {
|
2024-07-05 10:49:45 +00:00
|
|
|
|
return getSortKeyByInternalLevel(d1) - getSortKeyByInternalLevel(d2);
|
2024-07-05 00:15:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private extern bool orig_isDifferentMyListSet(patch_MusicSort1ID oldSort1, patch_MusicSort1ID nowSort1);
|
|
|
|
|
private bool isDifferentMyListSet(patch_MusicSort1ID oldSort1, patch_MusicSort1ID nowSort1) {
|
|
|
|
|
if(oldSort1 == patch_MusicSort1ID.InternalLevel && nowSort1 != patch_MusicSort1ID.InternalLevel) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if(oldSort1 != patch_MusicSort1ID.InternalLevel && nowSort1 == patch_MusicSort1ID.InternalLevel) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return orig_isDifferentMyListSet(oldSort1, nowSort1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private extern int orig_createMyListMusicDataAllDifficulty(List<MusicSelectViewData> list, HashSet<int> idList, MU3.Data.MusicData musicData, MusicSort1ID sort1, int initOrder);
|
|
|
|
|
private int createMyListMusicDataAllDifficulty(List<MusicSelectViewData> list, HashSet<int> idList, MU3.Data.MusicData musicData, MusicSort1ID sort1, int initOrder) {
|
|
|
|
|
if(sort1 == (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
|
|
|
|
sort1 = MusicSort1ID.Level;
|
|
|
|
|
}
|
|
|
|
|
return orig_createMyListMusicDataAllDifficulty(list, idList, musicData, sort1, initOrder);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-05 16:21:33 +00:00
|
|
|
|
private extern int orig_getMetaSortKey(MusicSelectViewData d, bool forCategorySort);
|
|
|
|
|
private int getMetaSortKey(MusicSelectViewData d, bool forCategorySort) {
|
2024-08-30 17:20:26 +00:00
|
|
|
|
if(_reMasterPi == null) {
|
2024-07-05 16:21:33 +00:00
|
|
|
|
return orig_getMetaSortKey(d, forCategorySort);
|
|
|
|
|
}
|
|
|
|
|
var remas = isReMaster(d.musicViewData.data);
|
|
|
|
|
|
2024-07-05 00:15:56 +00:00
|
|
|
|
if(forCategorySort) {
|
2024-07-05 16:21:33 +00:00
|
|
|
|
if(d.musicViewData.data.isBonusTrack) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return 3;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
|
|
|
|
if(d.musicViewData.data.isLunatic && remas && __sort1 != MusicSort1ID.Level && __sort1 != (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return 1;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
|
|
|
|
if(d.musicViewData.data.isLunatic && !remas) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return 2;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
2024-07-05 00:15:56 +00:00
|
|
|
|
} else {
|
2024-07-05 16:21:33 +00:00
|
|
|
|
if(d.musicViewData.data.isLunatic && remas && __sort1 != MusicSort1ID.Level && __sort1 != (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return 1;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
|
|
|
|
if(d.musicViewData.data.isLunatic && !remas) {
|
2024-07-05 00:15:56 +00:00
|
|
|
|
return 2;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
2024-07-05 00:15:56 +00:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
2024-07-05 16:21:33 +00:00
|
|
|
|
}
|
2024-07-05 00:15:56 +00:00
|
|
|
|
}
|