feat(SortByInternal): add sort2
This commit is contained in:
parent
44dfa20ea8
commit
de9bcda48d
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
namespace MU3.DB;
|
namespace MU3.DB;
|
||||||
|
|
||||||
[MonoModPatch("global::MU3.DB.MusicSort1ID")]
|
[MonoModEnumReplace]
|
||||||
[MonoModEnumReplace()]
|
|
||||||
public enum patch_MusicSort1ID {
|
public enum patch_MusicSort1ID {
|
||||||
Genre = 0,
|
Genre = 0,
|
||||||
All = 1,
|
All = 1,
|
||||||
|
15
SortByInternalDifficulty/MU3.DB/patch_MusicSort2IDEnum.cs
Normal file
15
SortByInternalDifficulty/MU3.DB/patch_MusicSort2IDEnum.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using MonoMod;
|
||||||
|
|
||||||
|
namespace MU3.DB;
|
||||||
|
|
||||||
|
[MonoModPatch("global::MU3.DB.MusicSort2IDEnum")]
|
||||||
|
public static class patch_MusicSort2IDEnum {
|
||||||
|
private static MusicSort2TableRecord[] records;
|
||||||
|
public static extern bool orig_loadFromFile(string filename);
|
||||||
|
|
||||||
|
public static bool loadFromFile(string filename) {
|
||||||
|
var rv = orig_loadFromFile(filename);
|
||||||
|
records[4].Name = "インターナル";
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using MU3.DB;
|
using MU3.DB;
|
||||||
using MU3.SceneObject.MusicSelect;
|
|
||||||
using MU3.Util;
|
using MU3.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -12,10 +11,11 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
|||||||
private delegate string GetCategoryNameProc(MusicSelectViewData d);
|
private delegate string GetCategoryNameProc(MusicSelectViewData d);
|
||||||
private MusicSort1ID __sort1;
|
private MusicSort1ID __sort1;
|
||||||
private CompareProc _compareProc1;
|
private CompareProc _compareProc1;
|
||||||
|
private CompareProc _compareProc2;
|
||||||
private GetCategoryNameProc _getCategoryNameProc;
|
private GetCategoryNameProc _getCategoryNameProc;
|
||||||
private ListList<MusicMinorCategoryData> _minorCategoryDataList;
|
|
||||||
|
|
||||||
private extern void orig_set__sort1(MusicSort1ID value);
|
private extern void orig_set__sort1(MusicSort1ID value);
|
||||||
|
private extern void orig_set__sort2(MusicSort2ID value);
|
||||||
|
|
||||||
private void set__sort1(MusicSort1ID value) {
|
private void set__sort1(MusicSort1ID value) {
|
||||||
if(value == (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
if(value == (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
||||||
@ -26,6 +26,14 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
|||||||
orig_set__sort1(value);
|
orig_set__sort1(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void set__sort2(MusicSort2ID value) {
|
||||||
|
orig_set__sort2(value);
|
||||||
|
if(value == MusicSort2ID.Level) {
|
||||||
|
_compareProc2 = compareByInternalLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string getCategoryNameByInternalLevel(MusicSelectViewData d) {
|
private string getCategoryNameByInternalLevel(MusicSelectViewData d) {
|
||||||
StringBuilder stringBuilder = Singleton<MU3.Sys.System>.instance.getStringBuilder();
|
StringBuilder stringBuilder = Singleton<MU3.Sys.System>.instance.getStringBuilder();
|
||||||
Data.FumenData fumenData = ((d.musicViewData.data == null) ? null : d.musicViewData.data.fumenData[(int)d.difficulty]);
|
Data.FumenData fumenData = ((d.musicViewData.data == null) ? null : d.musicViewData.data.fumenData[(int)d.difficulty]);
|
||||||
@ -34,12 +42,12 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
|||||||
return stringBuilder.ToString();
|
return stringBuilder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSortKeyByInternalLevel(MusicSelectViewData d, bool forSort1) {
|
private int getSortKeyByInternalLevel(MusicSelectViewData d) {
|
||||||
return (int)Math.Round(d.musicViewData.data.fumenData[(int)d.difficulty].fumenConst * 10.0);
|
return (int)Math.Round(d.musicViewData.data.fumenData[(int)d.difficulty].fumenConst * 10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compareByInternalLevel(MusicSelectViewData d1, MusicSelectViewData d2, bool forSort1) {
|
private int compareByInternalLevel(MusicSelectViewData d1, MusicSelectViewData d2, bool forSort1) {
|
||||||
return getSortKeyByInternalLevel(d1, forSort1) - getSortKeyByInternalLevel(d2, forSort1);
|
return getSortKeyByInternalLevel(d1) - getSortKeyByInternalLevel(d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private extern bool orig_isDifferentMyListSet(patch_MusicSort1ID oldSort1, patch_MusicSort1ID nowSort1);
|
private extern bool orig_isDifferentMyListSet(patch_MusicSort1ID oldSort1, patch_MusicSort1ID nowSort1);
|
||||||
|
@ -4,9 +4,10 @@ namespace MU3;
|
|||||||
|
|
||||||
public class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect {
|
public class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect {
|
||||||
private static patch_MusicSort1ID[] _sort1SettingList;
|
private static patch_MusicSort1ID[] _sort1SettingList;
|
||||||
|
private static MusicSort2ID[] _sort2SettingList;
|
||||||
private extern void orig_Awake();
|
private extern void orig_Awake();
|
||||||
|
|
||||||
private void Awake() {
|
private new void Awake() {
|
||||||
_sort1SettingList = new[] {
|
_sort1SettingList = new[] {
|
||||||
patch_MusicSort1ID.Genre,
|
patch_MusicSort1ID.Genre,
|
||||||
patch_MusicSort1ID.All,
|
patch_MusicSort1ID.All,
|
||||||
@ -18,6 +19,18 @@ public class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_Musi
|
|||||||
patch_MusicSort1ID.InternalLevel
|
patch_MusicSort1ID.InternalLevel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_sort2SettingList = new[] {
|
||||||
|
MusicSort2ID.Recommend,
|
||||||
|
MusicSort2ID.BattlePoint,
|
||||||
|
MusicSort2ID.TechnicalScore,
|
||||||
|
MusicSort2ID.BossLevel,
|
||||||
|
MusicSort2ID.Name,
|
||||||
|
MusicSort2ID.AddDate,
|
||||||
|
MusicSort2ID.Chapter,
|
||||||
|
MusicSort2ID.Level
|
||||||
|
//, MusicSort2ID.Lamp
|
||||||
|
};
|
||||||
|
|
||||||
orig_Awake();
|
orig_Awake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user