@@ -38,7 +38,7 @@ private static void LevelOnNextLevel(On.Celeste.Level.orig_NextLevel orig, Level
38
38
private static void LevelOnRegisterAreaComplete ( On . Celeste . Level . orig_RegisterAreaComplete orig , Level self ) {
39
39
orig ( self ) ;
40
40
41
- if ( GhostModule . Instance . GhostManager ? . Ghosts . FirstOrDefault ( ) ? . Data . Frames . LastOrDefault ( ) . Data . Time is long time ) {
41
+ if ( GhostModule . Instance . GhostManager ? . Ghosts . FirstOrDefault ( ) ? . Data . Frames . LastOrDefault ( ) . Data . Time is { } time ) {
42
42
LastGhostTime = GhostTime ;
43
43
GhostTime = time ;
44
44
LastCurrentTime = CurrentTime ;
@@ -51,7 +51,6 @@ private static void LevelOnRender(On.Celeste.Level.orig_Render orig, Level self)
51
51
52
52
if ( GhostModule . ModuleSettings . Mode == GhostModuleMode . Play && GhostModule . ModuleSettings . ShowCompareTime ) {
53
53
int viewWidth = Engine . ViewWidth ;
54
- int viewHeight = Engine . ViewHeight ;
55
54
56
55
float pixelScale = viewWidth / 320f ;
57
56
float margin = 2 * pixelScale ;
@@ -65,9 +64,7 @@ private static void LevelOnRender(On.Celeste.Level.orig_Render orig, Level self)
65
64
66
65
long diffRoomTime = CurrentTime - GhostTime - LastCurrentTime + LastGhostTime ;
67
66
long diffTotalTime = CurrentTime - GhostTime ;
68
- string diffRoomTimeStr = ( diffRoomTime > 0 ? "+" : string . Empty ) + ( diffRoomTime / 10000000D ) . ToString ( "0.000" ) ;
69
- string diffTotalTimeStr = ( diffTotalTime > 0 ? "+" : string . Empty ) + ( diffTotalTime / 10000000D ) . ToString ( "0.000" ) ;
70
- string timeStr = $ "last room: { diffRoomTimeStr } \n total : { diffTotalTimeStr } ";
67
+ string timeStr = $ "last room: { FormatTime ( diffRoomTime ) } \n total : { FormatTime ( diffTotalTime ) } ";
71
68
72
69
if ( string . IsNullOrEmpty ( timeStr ) ) {
73
70
return ;
@@ -89,7 +86,7 @@ private static void LevelOnRender(On.Celeste.Level.orig_Render orig, Level self)
89
86
90
87
Rectangle bgRect = new Rectangle ( ( int ) x , ( int ) y , ( int ) ( size . X + padding * 2 ) , ( int ) ( size . Y + padding * 2 ) ) ;
91
88
92
- if ( self . Entities . FindFirst < Player > ( ) is Player player ) {
89
+ if ( self . Entities . FindFirst < Player > ( ) is { } player ) {
93
90
Vector2 playerPosition = self . Camera . CameraToScreen ( player . TopLeft ) * pixelScale ;
94
91
Rectangle playerRect = new Rectangle ( ( int ) playerPosition . X , ( int ) playerPosition . Y , ( int ) ( 8 * pixelScale ) , ( int ) ( 11 * pixelScale ) ) ;
95
92
Rectangle mirrorBgRect = bgRect ;
@@ -123,4 +120,10 @@ private static void LevelLoaderOnCtor(On.Celeste.LevelLoader.orig_ctor orig, Lev
123
120
CurrentTime = 0 ;
124
121
LastCurrentTime = 0 ;
125
122
}
123
+
124
+ private static string FormatTime ( long time ) {
125
+ string sign = time > 0 ? "+" : time < 0 ? "-" : "" ;
126
+ TimeSpan timeSpan = TimeSpan . FromTicks ( time ) ;
127
+ return $ "{ sign } { timeSpan . ShortGameplayFormat ( ) } ({ time / TimeSpan . FromSeconds ( Engine . RawDeltaTime ) . Ticks } )";
128
+ }
126
129
}
0 commit comments