예제 #1
0
        public static void ReportTutorialEnd()
        {
            if (MySandboxGame.IsDedicated)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!m_tutorialStarted)
                {
                    return;
                }
                m_tutorialStarted = false;

                analytics.ReportTutorialEnd();
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #2
0
        public static void ReportGameplayEnd()
        {
            if (MySandboxGame.IsDedicated || SanityCheckOnePerMinute(ref ReportChecksGameplayEnd))
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                m_tutorialStarted = false;

                // Reset the scenario flag.
                m_scenarioFlag = false;

                analytics.ReportGameplayEnd(GetGameplayEndAnalyticsData());
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #3
0
        public static void ReportGameplayStart()// plus server start
        {
            IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;

            if (analytics == null)
            {
                return;
            }
            MyInfinarioAnalytics.updateIndex = -1;
            if (SanityCheckOnePerMinute(ref ReportChecksGameplayStart) == false)
            {
                try
                {
                    analytics.ReportGameplayStart(GetGameplayStartAnalyticsData(), MySandboxGame.IsDedicated);
                }
                catch (Exception exception)
                {
                    MyLog.Default.WriteLine(exception);
                }
            }
            if (MySandboxGame.IsDedicated || (MyMultiplayer.Static != null && MyMultiplayer.Static.IsServer && MySession.Static.OnlineMode != MyOnlineModeEnum.PRIVATE && MySession.Static.OnlineMode != MyOnlineModeEnum.OFFLINE))
            {
                analytics.ReportServerStart(MyMultiplayer.Static.MemberLimit, MyMultiplayer.Static.HostName);
            }
        }
예제 #4
0
        public static void ReportProcessStart(bool firstTimeRun)
        {
            if (ReportChecksProcessStart)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                // Send events to analytics.
                analytics.ReportProcessStart(GetProcessStartAnalyticsData(), firstTimeRun, MySandboxGame.IsDedicated);
                ReportChecksProcessStart = true;

                MyLog.Default.WriteLine("Analytics helper process start reported");
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #5
0
        public static void ReportActivityStart(MyEntity sourceEntity, string activityName, string activityFocus, string activityType, string activityItemUsage, bool expectActivityEnd = true)
        {
            if (MySandboxGame.IsDedicated || SanityCheckAmountPerMinute(ReportChecksActivityStart, 60))
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!IsReportedPlayer(sourceEntity))
                {
                    return;
                }

                if (MySession.Static != null && MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.PositionComp != null)
                {
                    MyPlanetNamesData planetData = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                    analytics.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, planetData.planetName, planetData.planetType, Sandbox.Engine.Physics.MyPhysics.SimulationRatio, Sync.ServerSimulationRatio);
                }
                else
                {
                    analytics.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, simSpeedPlayer: Sandbox.Engine.Physics.MyPhysics.SimulationRatio, simSpeedServer: Sync.ServerSimulationRatio);
                }
                ReportChecksActivityStart++;
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #6
0
 public static void ReportProcessEnd()
 {
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportProcessEnd();
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #7
0
 public static void ReportGameplayStart()
 {
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportGameplayStart(GetGameplayStartAnalyticsData());
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #8
0
 public static void ReportPlayerId()
 {
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.IdentifyPlayer(MySteam.UserId, MySteam.UserName, MySteam.IsOnline);
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #9
0
 public static void FlushAndDispose()
 {
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.FlushAndDispose();
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #10
0
 public static void ReportTutorialStep(string stepName, int stepNumber)
 {
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportTutorialStep(stepName, stepNumber);
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #11
0
 public static void ReportProcessStart(bool firstTimeRun)
 {
     try
     {
         // Send events to analytics.
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportProcessStart(GetProcessStartAnalyticsData(), firstTimeRun);
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #12
0
 public static void ReportTutorialStart(string tutorialName)
 {
     try
     {
         m_tutorialStarted = true;
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportTutorialStart(tutorialName);
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #13
0
 public static void ReportGameplayEnd()
 {
     try
     {
         m_tutorialStarted = false;
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportGameplayEnd(GetGameplayEndAnalyticsData());
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #14
0
        public static void SetScenarioFlag(bool flag)
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                m_scenarioFlag = flag;
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(ex);
            }
        }
예제 #15
0
        public static void ReportServerStatus()
        {
            MyInfinarioAnalytics.updateIndex++;
            if (MyMultiplayer.Static == null || MyMultiplayer.Static.IsServer == false)
            {
                return;
            }
            if (MySandboxGame.IsDedicated == false && MyMultiplayer.Static.MemberCount <= 1)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                // Send events to analytics.
                int gridCount               = 0;
                int blockCount              = 0;
                int movingGrids             = 0;
                HashSet <MyEntity> entities = MyEntities.GetEntities();
                foreach (var entity in entities)
                {
                    if (entity is MyCubeGrid)
                    {
                        gridCount++;
                        blockCount += (entity as MyCubeGrid).BlocksCount;
                        if ((entity as MyCubeGrid).Physics != null && (entity as MyCubeGrid).Physics.LinearVelocity != Vector3.Zero)
                        {
                            movingGrids++;
                        }
                    }
                }
                analytics.ReportServerStatus(MyMultiplayer.Static.MemberCount, MyMultiplayer.Static.MemberLimit, Sync.ServerSimulationRatio, entities.Count, gridCount, blockCount, movingGrids, MyMultiplayer.Static.HostName);

                //MyLog.Default.WriteLine("Analytics helper server status reported");
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #16
0
        public static void LoadingStarted()
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null || m_loadingStarted)
                {
                    return;
                }

                // The entry point can get overwritten in some cases, we need to track scenario.
                m_loadingStartedAt = DateTime.UtcNow;
                m_loadingStarted   = true;
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(ex);
            }
        }
예제 #17
0
 public static void ReportActivityEnd(MyEntity sourceEntity, string activityName)
 {
     try
     {
         if (!IsReportedPlayer(sourceEntity))
         {
             return;
         }
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics != null)
         {
             analytics.ReportActivityEnd(activityName);
         }
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #18
0
        public static void ReportActivityStart(MyEntity sourceEntity, string activityName, string activityFocus, string activityType, string activityItemUsage, bool expectActivityEnd = true)
        {
            try
            {
                if (!IsReportedPlayer(sourceEntity))
                {
                    return;
                }

                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics != null)
                {
                    analytics.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd);
                }
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #19
0
 public static void ReportTutorialScreen(string initiatedFrom)
 {
     if (MySandboxGame.IsDedicated)
     {
         return;
     }
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics == null)
         {
             return;
         }
         analytics.ReportTutorialScreen(initiatedFrom);
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #20
0
 public static void ReportPlayerId()
 {
     if (MySandboxGame.IsDedicated)
     {
         return;
     }
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics == null)
         {
             return;
         }
         analytics.IdentifyPlayer(Sync.MyId, MySteam.UserName, MySteam.IsOnline);
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #21
0
 public static void ReportTutorialStep(string stepName, int stepNumber)
 {
     if (MySandboxGame.IsDedicated)
     {
         return;
     }
     try
     {
         IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
         if (analytics == null)
         {
             return;
         }
         analytics.ReportTutorialStep(stepName, stepNumber);
     }
     catch (Exception exception)
     {
         MyLog.Default.WriteLine(exception);
     }
 }
예제 #22
0
        public static void SetUsedMods(List <MyObjectBuilder_Checkpoint.ModItem> mods)
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                m_usedMods.Clear();
                foreach (var mod in mods)
                {
                    m_usedMods.Add(mod.FriendlyName);
                }
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(ex);
            }
        }
예제 #23
0
        public static void ReportActivityStartIf(bool condition, MyEntity sourceEntity, string activityName, string activityFocus, string activityType, string activityItemUsage, bool expectActivityEnd = true)
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!condition)
                {
                    return;
                }
                ReportActivityStart(sourceEntity, activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd);
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #24
0
        public static void ReportTutorialEnd()
        {
            try
            {
                if (!m_tutorialStarted)
                {
                    return;
                }
                m_tutorialStarted = false;

                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics != null)
                {
                    analytics.ReportTutorialEnd();
                }
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #25
0
        public static void ReportProcessEnd()
        {
            if (MySandboxGame.IsDedicated || ReportChecksProcessEnd)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                analytics.ReportProcessEnd();
                ReportChecksProcessEnd = true;
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }
예제 #26
0
        public static void SetLastDamageInformation(MyDamageInformation lastDamageInformation)
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                // Empty message is sent from the server, we don't want it to rewrite the true damage cause.
                if (lastDamageInformation.Type == default(MyStringHash))
                {
                    return;
                }

                m_lastDamageInformation = lastDamageInformation;
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(ex);
            }
        }
예제 #27
0
        public static void SetEntry(MyGameEntryEnum entry)
        {
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                // The entry point can get overwritten in some cases, we need to track scenario.
                if (entry == MyGameEntryEnum.Scenario)
                {
                    m_scenarioFlag = true;
                }

                m_entry = entry;
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(ex);
            }
        }
예제 #28
0
        public static void ReportPlayerDeath(bool isLocallyControlled, ulong playerSteamId)
        {
            if (MySandboxGame.IsDedicated)
            {
                return;
            }
            try
            {
                IMyAnalytics analytics = MyPerGameSettings.AnalyticsTracker;
                if (analytics == null)
                {
                    return;
                }

                if (!isLocallyControlled)
                {
                    return;
                }

                var deathCause = m_lastDamageInformation.Type.String;

                Debug.Assert(!string.IsNullOrEmpty(deathCause), "Analytics: Unknown death type. Please report what you were doing to the devs.");

                string deathType;
                bool   pvp           = false;
                bool   selfInflicted = false;
                if (m_lastDamageInformation.Type != MyStringHash.NullOrEmpty && m_lastDamageInformation.AttackerId != 0)
                {
                    MyEntity entity = null;
                    MyEntities.TryGetEntityById(m_lastDamageInformation.AttackerId, out entity);
                    var controllableEntity = entity as IMyControllableEntity;
                    if (controllableEntity != null)
                    {
                        // The attacker is controller by a character.
                        var controller = controllableEntity.ControllerInfo.Controller;
                        if (controller != null)
                        {
                            if (controller.Player.Id.SteamId != playerSteamId)
                            {
                                pvp = true;
                            }
                            else
                            {
                                selfInflicted = true;
                            }
                        }
                    }
                    else if (entity is IMyGunBaseUser || entity is IMyHandheldGunObject <MyToolBase> ||
                             entity is IMyHandheldGunObject <MyGunBase> )
                    {
                        pvp = true;
                    }
                }

                if (pvp)
                {
                    deathType = "pvp";
                }
                else if (selfInflicted)
                {
                    deathType = "self_inflicted";
                }
                else
                {
                    deathType = m_lastDamageInformation.Type == MyDamageType.Environment ? "environment" : "unknown";
                }

                MyPlanetNamesData planetData = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                analytics.ReportPlayerDeath(deathType, deathCause, planetData.planetName, planetData.planetType, MySession.Static.IsScenario);
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }
        }