Collecting some more usage statistics: selected game mode, mission, submarine, content package, traitors on/off, kills
This commit is contained in:
@@ -198,7 +198,8 @@ namespace Barotrauma
|
||||
|
||||
private static bool QuitClicked(GUIButton button, object obj)
|
||||
{
|
||||
if (button.UserData as string == "save")
|
||||
bool save = button.UserData as string == "save";
|
||||
if (save)
|
||||
{
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
||||
}
|
||||
@@ -211,10 +212,15 @@ namespace Barotrauma
|
||||
|
||||
CoroutineManager.StopCoroutines("EndCinematic");
|
||||
|
||||
GameMain.GameSession = null;
|
||||
if (GameMain.GameSession != null)
|
||||
{
|
||||
Mission mission = GameMain.GameSession.Mission;
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("QuitRound:" + (save ? "Save" : "NoSave"));
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("EndRound:" + (mission == null ? "NoMission" : (mission.Completed ? "MissionCompleted" : "MissionFailed")));
|
||||
GameMain.GameSession = null;
|
||||
}
|
||||
|
||||
GameMain.MainMenuScreen.Select();
|
||||
//Game1.MainMenuScreen.SelectTab(null, (int)MainMenuScreen.Tabs.Main);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,21 +245,16 @@ namespace Barotrauma
|
||||
userStatsPrompt.Buttons[0].OnClicked += (btn, userdata) =>
|
||||
{
|
||||
GameSettings.SendUserStatistics = true;
|
||||
GameAnalytics.ConfigureBuild(Version.ToString());
|
||||
GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "dbcdabf31c6481129a024df3ee6bad02aeddbab7");
|
||||
GameAnalyticsManager.Init();
|
||||
return true;
|
||||
};
|
||||
userStatsPrompt.Buttons[0].OnClicked += userStatsPrompt.Close;
|
||||
userStatsPrompt.Buttons[1].OnClicked += (btn, userdata) => { GameSettings.SendUserStatistics = false; return true; };
|
||||
userStatsPrompt.Buttons[1].OnClicked += userStatsPrompt.Close;
|
||||
}
|
||||
else
|
||||
else if (GameSettings.SendUserStatistics)
|
||||
{
|
||||
if (GameSettings.SendUserStatistics)
|
||||
{
|
||||
GameAnalytics.ConfigureBuild(Version.ToString());
|
||||
GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "dbcdabf31c6481129a024df3ee6bad02aeddbab7");
|
||||
}
|
||||
GameAnalyticsManager.Init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,9 @@ namespace Barotrauma
|
||||
campaignUI.StartRound = StartRound;
|
||||
campaignUI.OnLocationSelected = SelectLocation;
|
||||
campaignUI.UpdateCharacterLists();
|
||||
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.SetCustomDimension01("singleplayer");
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
|
||||
@@ -142,6 +142,8 @@ namespace Barotrauma
|
||||
campaignSetupUI.UpdateSubList();
|
||||
|
||||
SelectTab(null, 0);
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.SetCustomDimension01("");
|
||||
}
|
||||
|
||||
public bool SelectTab(GUIButton button, object obj)
|
||||
|
||||
@@ -501,6 +501,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.SetCustomDimension01("multiplayer");
|
||||
|
||||
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(0);
|
||||
|
||||
GameMain.Server.Voting.ResetVotes(GameMain.Server.ConnectedClients);
|
||||
|
||||
@@ -348,6 +348,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
cam.UpdateTransform();
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.SetCustomDimension01("editor");
|
||||
}
|
||||
|
||||
public override void Deselect()
|
||||
|
||||
@@ -75,8 +75,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameSettings.SendUserStatistics)
|
||||
{
|
||||
GameAnalytics.ConfigureBuild(Version.ToString());
|
||||
GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "dbcdabf31c6481129a024df3ee6bad02aeddbab7");
|
||||
GameAnalyticsManager.Init();
|
||||
}
|
||||
|
||||
GameScreen = new GameScreen();
|
||||
|
||||
@@ -1475,6 +1475,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\CharacterNetworking.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\DamageModifier.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Events\Missions\MissionPrefab.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameAnalyticsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\Signal\AdderComponent.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\StatusEffects\DelayedEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\HuskInfection.cs" />
|
||||
|
||||
@@ -1948,8 +1948,19 @@ namespace Barotrauma
|
||||
|
||||
AnimController.Frozen = false;
|
||||
|
||||
GameServer.Log(LogName+" has died (Cause of death: "+causeOfDeath+")", ServerLog.MessageType.Attack);
|
||||
GameServer.Log(LogName + " has died (Cause of death: " + causeOfDeath + ")", ServerLog.MessageType.Attack);
|
||||
|
||||
string characterType = "Unknown";
|
||||
if (this == controlled)
|
||||
characterType = "Player";
|
||||
else if (IsRemotePlayer)
|
||||
characterType = "RemotePlayer";
|
||||
else if (AIController is EnemyAIController)
|
||||
characterType = "Enemy";
|
||||
else if (AIController is HumanAIController)
|
||||
characterType = "AICrew";
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("Kill:" + characterType + ":" + SpeciesName + ":" + causeOfDeath);
|
||||
|
||||
if (OnDeath != null) OnDeath(this, causeOfDeath);
|
||||
|
||||
KillProjSpecific();
|
||||
|
||||
23
Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs
Normal file
23
Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using GameAnalyticsSDK.Net;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
public static class GameAnalyticsManager
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
GameAnalytics.SetEnabledInfoLog(true);
|
||||
GameAnalytics.ConfigureBuild(GameMain.Version.ToString());
|
||||
GameAnalytics.ConfigureAvailableCustomDimensions01("singleplayer", "multiplayer", "editor");
|
||||
GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "9010ad9a671233b8d9610d76cec8c897d9ff3ba7");
|
||||
|
||||
string contentPackageName = GameMain.Config?.SelectedContentPackage?.Name;
|
||||
if (!string.IsNullOrEmpty(contentPackageName))
|
||||
{
|
||||
GameAnalytics.AddDesignEvent("ContentPackage:" +
|
||||
contentPackageName.Replace(":", "").Substring(0, Math.Min(32, contentPackageName.Length)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,6 +228,10 @@ namespace Barotrauma
|
||||
|
||||
if (GameMode != null) GameMode.MsgBox();
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("Submarine:" + submarine.Name);
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddProgressionEvent(GameAnalyticsSDK.Net.EGAProgressionStatus.Start,
|
||||
GameMode.Name, (Mission == null ? "None" : Mission.GetType().ToString()));
|
||||
|
||||
#if CLIENT
|
||||
roundSummary = new RoundSummary(this);
|
||||
|
||||
@@ -239,6 +243,9 @@ namespace Barotrauma
|
||||
public void EndRound(string endMessage)
|
||||
{
|
||||
if (Mission != null) Mission.End();
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddProgressionEvent((Mission == null || Mission.Completed) ? GameAnalyticsSDK.Net.EGAProgressionStatus.Complete : GameAnalyticsSDK.Net.EGAProgressionStatus.Fail,
|
||||
GameMode.Name, (Mission == null ? "None" : Mission.GetType().ToString()));
|
||||
|
||||
#if CLIENT
|
||||
if (roundSummary != null)
|
||||
|
||||
@@ -279,10 +279,8 @@ namespace Barotrauma
|
||||
{
|
||||
case "contentpackage":
|
||||
string path = subElement.GetAttributeString("path", "");
|
||||
|
||||
|
||||
|
||||
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
|
||||
|
||||
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -208,6 +208,8 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
GameMain.NetLobbyScreen.RandomizeSettings();
|
||||
started = true;
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("GameServer:Start");
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
@@ -1357,6 +1359,8 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("Traitors:" + (TraitorManager == null ? "Disabled" : "Enabled"));
|
||||
|
||||
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.GameMode.Preset, connectedClients);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -2249,7 +2253,8 @@ namespace Barotrauma.Networking
|
||||
Log("Shutting down the server...", ServerLog.MessageType.ServerMessage);
|
||||
log.Save();
|
||||
}
|
||||
|
||||
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddDesignEvent("GameServer:ShutDown");
|
||||
server.Shutdown("The server has been shut down");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user