@@ -258,7 +258,7 @@ public static Dictionary<ShiftMethod, float> CalcChartPadding(List<MaiChart> cha
258258 private record AllChartsEntry ( string chartText , MaiChart simaiSharpChart ) ;
259259
260260 /** 根据maidata中定义的所有难度,将其映射到游戏中的难度。 **/
261- public Dictionary < int , int > mapMaidataLevelToGame ( List < int > maidataLevels )
261+ public static Dictionary < int , int > MapMaidataLevelToGame ( List < int > maidataLevels )
262262 {
263263 var result = new Dictionary < int , int > ( ) ;
264264 var gameLevels = new bool [ 5 ] ;
@@ -272,32 +272,25 @@ public Dictionary<int, int> mapMaidataLevelToGame(List<int> maidataLevels)
272272 gameLevels [ targetLevel ] = true ;
273273 }
274274
275- // 再映射78
276- foreach ( var lv in ( int [ ] ) [ 7 , 8 ] )
275+ // 再映射非标准难度
276+ var nonStandardMappings = new [ ]
277277 {
278- if ( ! maidataLevels . Contains ( lv ) ) continue ;
279- foreach ( var targetLevel in ( int [ ] ) [ 3 , 4 , 0 ] ) // 匹配顺序:紫,白,绿
280- {
281- if ( ! gameLevels [ targetLevel ] )
282- {
283- result . Add ( lv , targetLevel ) ;
284- gameLevels [ targetLevel ] = true ;
285- break ;
286- }
287- }
288- }
289-
290- // 再映射0
291- foreach ( var lv in ( int [ ] ) [ 0 ] )
278+ new { Levels = new [ ] { 7 , 8 } , Targets = new [ ] { 3 , 4 , 0 } } , // lv7和8的匹配顺序:紫,白,绿
279+ new { Levels = new [ ] { 0 } , Targets = new [ ] { 0 , 3 , 4 } } // lv0的匹配顺序:绿,紫,白
280+ } ;
281+ foreach ( var mapping in nonStandardMappings )
292282 {
293- if ( ! maidataLevels . Contains ( lv ) ) continue ;
294- foreach ( var targetLevel in ( int [ ] ) [ 0 , 3 , 4 ] ) // 匹配顺序:绿,紫,白
283+ foreach ( var lv in mapping . Levels )
295284 {
296- if ( ! gameLevels [ targetLevel ] )
285+ if ( ! maidataLevels . Contains ( lv ) ) continue ;
286+ foreach ( var targetLevel in mapping . Targets )
297287 {
298- result . Add ( lv , targetLevel ) ;
299- gameLevels [ targetLevel ] = true ;
300- break ;
288+ if ( ! gameLevels [ targetLevel ] )
289+ {
290+ result . Add ( lv , targetLevel ) ;
291+ gameLevels [ targetLevel ] = true ;
292+ break ;
293+ }
301294 }
302295 }
303296 }
@@ -361,7 +354,7 @@ public ImportChartResult ImportMaidata(
361354 }
362355
363356 float bpm = 0f ;
364- var targetLevelMap = mapMaidataLevelToGame ( allCharts . Keys . ToList ( ) ) ;
357+ var targetLevelMap = MapMaidataLevelToGame ( allCharts . Keys . ToList ( ) ) ;
365358 foreach ( var ( level , chart ) in allCharts )
366359 {
367360 // 宴会场只导入第一个谱面
@@ -382,7 +375,7 @@ public ImportChartResult ImportMaidata(
382375 {
383376 if ( isUtage && ! char . IsDigit ( levelNumStr [ 0 ] ) )
384377 {
385- music . UtageKanji = levelNumStr ;
378+ music . UtageKanji = levelNumStr . Substring ( 0 , 1 ) ;
386379 levelNumStr = levelNumStr . Substring ( 1 ) . Replace ( "?" , "" ) ; // 为了处理类似“奏13+?”这种情况,留下13+给后面的逻辑处理
387380 }
388381 levelNumStr = levelNumStr . Replace ( "+" , ".7" ) ;
0 commit comments