Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -376,6 +376,33 @@ namespace Barotrauma
#endif
}
public enum DataSampleSize
{
Small,
Medium,
Large,
Full
}
private readonly static Dictionary<DataSampleSize, float> dataSampleSizes = new Dictionary<DataSampleSize, float>()
{
{ DataSampleSize.Small, 0.01f },
{ DataSampleSize.Medium, 0.05f },
{ DataSampleSize.Large, 0.5f },
{ DataSampleSize.Full, 1.0f }
};
/// <summary>
/// Should we log something into GameAnalytics if we only want a random sample of some events?
/// Essentially just randomly decides whether to log or not based on the probability
/// </summary>
/// <param name="probability">A value between 0 and 1</param>
/// <returns></returns>
public static bool ShouldLogRandomSample(DataSampleSize sampleSize = DataSampleSize.Small)
{
return Rand.Range(0.0f, 1.0f) < dataSampleSizes[sampleSize];
}
public static void AddErrorEvent(ErrorSeverity errorSeverity, string message)
{
if (!SendUserStatistics) { return; }