@@ -24,46 +24,31 @@ public static void CheckPlayMenu(Bitmap frame)
2424 srText = srText . Substring ( srText . Length - 4 ) ;
2525 }
2626
27- if ( ! srText . Equals ( String . Empty ) && srText . Length <= 4 ) // CHECK SR
27+ if ( ! srText . Equals ( String . Empty ) && srText . Length == 4 )
2828 {
2929 if ( Convert . ToInt32 ( srText ) > 1000 && Convert . ToInt32 ( srText ) < 5000 )
3030 {
31- if ( ! Vars . srCheck [ 0 ] . Equals ( srText ) || ! Vars . srCheck [ 1 ] . Equals ( srText ) )
31+ if ( ! Vars . gameData . currentRating . Equals ( srText ) || Vars . gameData . state >= State . Finished )
3232 {
33- if ( Vars . srCheckIndex > Vars . srCheck . Length - 1 )
34- {
35- Vars . srCheckIndex = 0 ;
36- }
37- Vars . srCheck [ Vars . srCheckIndex ] = srText ;
38- Vars . srCheckIndex ++ ;
33+ Functions . PlaySound ( ) ;
34+ Program . trayMenu . currentGame . MenuItems [ 1 ] . Text = "Skill rating: " + srText ;
35+ Functions . DebugMessage ( "Recognized sr: '" + srText + "'" ) ;
3936 }
40- if ( Vars . srCheck [ 0 ] . Equals ( srText ) && Vars . srCheck [ 1 ] . Equals ( srText ) )
41- {
42- if ( ! Vars . gameData . currentRating . Equals ( srText ) || Vars . gameData . state >= State . Finished )
43- {
44- Functions . PlaySound ( ) ;
45- Program . trayMenu . currentGame . MenuItems [ 1 ] . Text = "Skill rating: " + srText ;
46- Functions . DebugMessage ( "Recognized sr: '" + srText + "'" ) ;
47- }
48- Vars . gameTimer . Stop ( ) ;
49- Vars . srCheck [ 0 ] = "" ;
50- Vars . srCheck [ 1 ] = "" ;
51- Vars . srCheckIndex = 0 ;
52- Vars . gameData . currentRating = srText ;
37+ Vars . gameTimer . Stop ( ) ;
38+ Vars . gameData . currentRating = srText ;
5339
54- if ( Vars . gameData . state == State . Recording ||
55- Vars . gameData . state == State . Finished ||
56- Vars . gameData . state == State . WaitForUpload
57- )
58- {
59- if ( ! IsValidGame ( ) ) return ;
60- string game = Vars . gameData . GetData ( ) ;
61- Vars . lastGameJSON = JsonConvert . SerializeObject ( JsonConvert . DeserializeObject < CleanedGame > ( game ) , Formatting . Indented ) ;
62- Server . UploadGame ( game ) ;
63- ResetGame ( ) ;
64- }
65- Program . trayMenu . ChangeTray ( "Ready to record, enter a competitive game to begin" , Properties . Resources . IconActive ) ;
40+ if ( Vars . gameData . state == State . Recording ||
41+ Vars . gameData . state == State . Finished ||
42+ Vars . gameData . state == State . WaitForUpload
43+ )
44+ {
45+ if ( ! IsValidGame ( ) ) return ;
46+ string game = Vars . gameData . GetData ( ) ;
47+ Vars . lastGameJSON = JsonConvert . SerializeObject ( JsonConvert . DeserializeObject < CleanedGame > ( game ) , Formatting . Indented ) ;
48+ Server . UploadGame ( game ) ;
49+ ResetGame ( ) ;
6650 }
51+ Program . trayMenu . ChangeTray ( "Ready to record, enter a competitive game to begin" , Properties . Resources . IconActive ) ;
6752 }
6853 }
6954 }
@@ -103,11 +88,11 @@ public static void CheckStats(Bitmap frame)
10388 {
10489 Vars . gameData . stats . Add (
10590 new Stats (
106- elimsText ,
107- damageText ,
108- objKillsText ,
109- healingText ,
110- deathsText ,
91+ elimsText ,
92+ damageText ,
93+ objKillsText ,
94+ healingText ,
95+ deathsText ,
11196 Vars . gameTimer . ElapsedMilliseconds - Functions . GetTimeDeduction ( )
11297 ) ) ;
11398 Vars . statsTimer . Restart ( ) ;
@@ -194,7 +179,7 @@ public static void CheckTeamsSkillRating(Bitmap frame)
194179 {
195180 string team1SR = Functions . BitmapToText ( frame , 545 , 220 , 245 , 70 , contrastFirst : false , radius : 90 , network : Network . TeamSkillRating ) ;
196181 team1SR = Regex . Match ( team1SR , "[0-9]+" ) . ToString ( ) ;
197-
182+
198183 if ( ! team1SR . Equals ( String . Empty ) && team1SR . Length >= 4 ) // TEAM 1 SR
199184 {
200185 team1SR = team1SR . Substring ( team1SR . Length - 4 ) ;
@@ -224,7 +209,7 @@ public static void CheckTeamsSkillRating(Bitmap frame)
224209 {
225210 string team2SR = Functions . BitmapToText ( frame , 1135 , 220 , 245 , 70 , contrastFirst : false , radius : 90 , network : Network . TeamSkillRating ) ;
226211 team2SR = Regex . Match ( team2SR , "[0-9]+" ) . ToString ( ) ;
227-
212+
228213 if ( ! team2SR . Equals ( String . Empty ) && team2SR . Length >= 4 ) // TEAM 1 SR
229214 {
230215 team2SR = team2SR . Substring ( team2SR . Length - 4 ) ;
@@ -370,20 +355,19 @@ public static void CheckFinalScore(Bitmap frame)
370355 Vars . gameData . state = State . Finished ;
371356 Vars . gameTimer . Stop ( ) ;
372357 Vars . heroTimer . Stop ( ) ;
358+ Vars . getInfoTimeout . Restart ( ) ;
373359
374360 for ( int i = 0 ; i < Vars . gameData . heroPlayed . Count ; i ++ )
375361 {
376362 Vars . gameData . heroTimePlayed [ i ] . Stop ( ) ;
377363 }
378- Thread . Sleep ( 500 ) ;
379364 }
380365 }
381366 }
382367 public static void CheckGameScore ( Bitmap frame )
383368 {
384369 if ( Vars . gameData . team1Score . Equals ( String . Empty ) && Vars . gameData . team1Score . Equals ( String . Empty ) )
385370 {
386- Thread . Sleep ( 2000 ) ; //prevent big animation from being captured
387371 string scoreTextLeft = Functions . BitmapToText ( frame , 800 , 560 , 95 , 135 , contrastFirst : false , radius : 45 , network : Network . TeamSkillRating ) ;
388372 string scoreTextRight = Functions . BitmapToText ( frame , 1000 , 560 , 95 , 135 , contrastFirst : false , radius : 45 , network : Network . TeamSkillRating ) ;
389373 scoreTextLeft = Regex . Match ( scoreTextLeft , "[0-9]+" ) . ToString ( ) ;
@@ -402,6 +386,7 @@ public static void CheckGameScore(Bitmap frame)
402386 Functions . DebugMessage ( "Recognized team score Team 1:" + scoreTextLeft + " Team 2:" + scoreTextRight ) ;
403387 Program . trayMenu . currentGame . MenuItems [ 5 ] . Text = "Final score: " + scoreTextLeft + " | " + scoreTextRight ;
404388 Vars . gameData . state = State . WaitForUpload ;
389+ Vars . getInfoTimeout . Stop ( ) ;
405390 }
406391 }
407392 }
0 commit comments