- Some of the non-game-crashing error messages are sent to GameAnalytics.

- Changed crash severity from Error to Critical.
- Exception handling when loading submarine preview images.
- Checking if position is valid in Ragdoll.SetPosition.
This commit is contained in:
Joonas Rikkonen
2018-07-19 21:13:18 +03:00
parent 7756cc0908
commit f1c4bd3c67
13 changed files with 109 additions and 17 deletions
@@ -1,5 +1,6 @@
using GameAnalyticsSDK.Net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -9,6 +10,8 @@ namespace Barotrauma
{
public static class GameAnalyticsManager
{
private static HashSet<string> sentEventIdentifiers = new HashSet<string>();
public static void Init()
{
#if DEBUG
@@ -47,5 +50,17 @@ namespace Barotrauma
contentPackageName.Replace(":", "").Substring(0, Math.Min(32, contentPackageName.Length)));
}
}
/// <summary>
/// Adds an error event to GameAnalytics if an event with the same identifier has not been added yet.
/// </summary>
public static void AddErrorEventOnce(string identifier, EGAErrorSeverity errorSeverity, string message)
{
if (!GameSettings.SendUserStatistics) return;
if (sentEventIdentifiers.Contains(identifier)) return;
GameAnalytics.AddErrorEvent(errorSeverity, message);
sentEventIdentifiers.Add(identifier);
}
}
}