File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Linq ;
2+ using AquaMai . Config . Attributes ;
3+ using AquaMai . Core . Attributes ;
4+ using AquaMai . Core . Helpers ;
5+ using HarmonyLib ;
6+ using MAI2 . Util ;
7+ using Manager ;
8+ using MelonLoader ;
9+
10+ namespace AquaMai . Mods . GameSystem ;
11+
12+ [ ConfigSection (
13+ defaultOn : true ,
14+ en : "Add play count when quick retry (regardless of trigger type)." ,
15+ zh : "在一键重开(无论何种触发方式)时,增加当前谱面的游玩次数" ) ]
16+ [ EnableGameVersion ( 23000 ) ]
17+ public class AddPlayCountWhenQuickRetry
18+ {
19+ [ HarmonyPrefix ]
20+ [ HarmonyPatch ( typeof ( GamePlayManager ) , nameof ( GamePlayManager . SetQuickRetryFrag ) ) ]
21+ public static void SetQuickRetryFrag ( bool flag , bool ____isQuickRetry , GamePlayManager __instance )
22+ {
23+ if ( ! flag ) return ;
24+ if ( ____isQuickRetry ) return ;
25+ var userData = Singleton < UserDataManager > . Instance . GetUserData ( 0 ) ;
26+ for ( int i = 0 ; i < 2 ; i ++ )
27+ {
28+ if ( ! userData . IsEntry ) continue ;
29+ MelonLogger . Msg ( $ "[AddPlayCountWhenQuickRetry] Player { i } MusicID { GameManager . SelectMusicID [ i ] } Difficulty { GameManager . SelectDifficultyID [ i ] } ") ;
30+ var score = Shim . GetUserScoreList ( userData ) [ GameManager . SelectDifficultyID [ i ] ] . FirstOrDefault ( it => it . id == GameManager . SelectMusicID [ i ] ) ;
31+ if ( score != null )
32+ {
33+ score . playcount ++ ;
34+ }
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments