forked from akanyan/mu3-mods
feat(SortByInternal): add sort2
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
using MU3.DB;
|
||||
using MU3.SceneObject.MusicSelect;
|
||||
using MU3.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -12,10 +11,11 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
||||
private delegate string GetCategoryNameProc(MusicSelectViewData d);
|
||||
private MusicSort1ID __sort1;
|
||||
private CompareProc _compareProc1;
|
||||
private CompareProc _compareProc2;
|
||||
private GetCategoryNameProc _getCategoryNameProc;
|
||||
private ListList<MusicMinorCategoryData> _minorCategoryDataList;
|
||||
|
||||
private extern void orig_set__sort1(MusicSort1ID value);
|
||||
private extern void orig_set__sort2(MusicSort2ID value);
|
||||
|
||||
private void set__sort1(MusicSort1ID value) {
|
||||
if(value == (MusicSort1ID)patch_MusicSort1ID.InternalLevel) {
|
||||
@ -26,6 +26,14 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
|
||||
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) {
|
||||
StringBuilder stringBuilder = Singleton<MU3.Sys.System>.instance.getStringBuilder();
|
||||
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();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user