public void EndSession() { if (ActiveTrainnigSession == null) { return; } ActiveTrainnigSession.EndTime = DateTime.Now; TodayTrainingDay.TrainingSessions.Add(ActiveTrainnigSession); ActiveTrainnigSession = null; HasOpenSession = false; }
public void OnNewGameState(GameState gameState) { if (IsStartOfCSGO) { CSGOStartTime = DateTime.Now; IsStartOfCSGO = false; } if (CheckIsPlaying(gameState)) { if (ActiveTrainnigSession == null) { ActiveTrainnigSession = new TrainingSession(DateTime.Now, gameState.Map.Name); HasOpenSession = true; } UpdateKills(gameState); } if (CheckIfShouldEndSession(gameState)) { EndSession(); } }