コード例 #1
0
 public static void ConfigureAvailableResourceItemTypes(params string[] resourceItemTypes)
 {
     GAThreading.PerformTaskOnGAThread("configureAvailableResourceItemTypes", () =>
     {
         if (IsSdkReady(true, false))
         {
             GALogger.W("Available resource item types must be set before SDK is initialized");
             return;
         }
         GAState.AvailableResourceItemTypes = resourceItemTypes;
     });
 }
コード例 #2
0
 public static void ConfigureAvailableCustomDimensions01(params string[] customDimensions)
 {
     GAThreading.PerformTaskOnGAThread("configureAvailableCustomDimensions01", () =>
     {
         if (IsSdkReady(true, false))
         {
             GALogger.W("Available custom dimensions must be set before SDK is initialized");
             return;
         }
         GAState.AvailableCustomDimensions01 = customDimensions;
     });
 }
コード例 #3
0
        public static void SetGlobalCustomEventFields(IDictionary <string, object> customFields)
        {
            if (_endThread)
            {
                return;
            }

            GAThreading.PerformTaskOnGAThread("setGlobalCustomEventFields", () =>
            {
                GAState.SetGlobalCustomEventFields(customFields);
            });
        }
コード例 #4
0
 public static void SetCustomDimension03(string dimension)
 {
     GAThreading.PerformTaskOnGAThread("setCustomDimension03", () =>
     {
         if (!GAValidator.ValidateDimension03(dimension))
         {
             GALogger.W("Could not set custom03 dimension value to '" + dimension + "'. Value not found in available custom03 dimension values");
             return;
         }
         GAState.SetCustomDimension03(dimension);
     });
 }
コード例 #5
0
        public static void SetEnabledManualSessionHandling(bool flag)
        {
            if (_endThread)
            {
                return;
            }

            GAThreading.PerformTaskOnGAThread("setEnabledManualSessionHandling", () =>
            {
                GAState.SetManualSessionHandling(flag);
            });
        }
コード例 #6
0
        public static void AddDesignEvent(string eventId, double value)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addDesignEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add design event"))
                {
                    return;
                }
                GAEvents.AddDesignEvent(eventId, value, true);
            });
        }
コード例 #7
0
        public static void AddDesignEvent(string eventId, IDictionary <string, object> fields = null)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addDesignEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add design event"))
                {
                    return;
                }
                GAEvents.AddDesignEvent(eventId, 0, false, fields);
            });
        }
コード例 #8
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void OnResume()
        {
            if (_endThread)
            {
                return;
            }

            GALogger.D("OnResume() called");
            GAThreading.PerformTaskOnGAThread("onResume", () =>
            {
                GAState.ResumeSessionAndStartQueue();
            });
        }
コード例 #9
0
        public static void AddErrorEvent(EGAErrorSeverity severity, string message)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addErrorEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add error event"))
                {
                    return;
                }
                GAEvents.AddErrorEvent(severity, message);
            });
        }
コード例 #10
0
 public static void OnStop()
 {
     GALogger.D("OnStop() called");
     GAThreading.PerformTaskOnGAThread("onStop", () =>
     {
         try
         {
             GAState.EndSessionAndStopQueue();
         }
         catch (Exception)
         {
         }
     });
 }
コード例 #11
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
 private static void OnResuming(object sender, object e)
 {
     GAThreading.PerformTaskOnGAThread("onResuming", () =>
     {
         if (!GAState.UseManualSessionHandling)
         {
             OnResume();
         }
         else
         {
             GALogger.I("OnResuming: Not calling GameAnalytics.OnResume() as using manual session handling");
         }
     });
 }
コード例 #12
0
        public static void AddResourceEvent(EGAResourceFlowType flowType, string currency, float amount, string itemType, string itemId)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addResourceEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add resource event"))
                {
                    return;
                }

                GAEvents.AddResourceEvent(flowType, currency, amount, itemType, itemId);
            });
        }
コード例 #13
0
        public static void AddBusinessEvent(string currency, int amount, string itemType, string itemId, string cartType)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addBusinessEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add business event"))
                {
                    return;
                }
                // Send to events
                GAEvents.AddBusinessEvent(currency, amount, itemType, itemId, cartType);
            });
        }
コード例 #14
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void SetFacebookId(string facebookId)
        {
            if (_endThread)
            {
                return;
            }

            GAThreading.PerformTaskOnGAThread("setFacebookId", () =>
            {
                if (GAValidator.ValidateFacebookId(facebookId))
                {
                    GAState.SetFacebookId(facebookId);
                }
            });
        }
コード例 #15
0
 public static void EndSessionAndStopQueue()
 {
     GAThreading.IgnoreTimer(Instance.SuspendBlockId);
     if (Initialized)
     {
         GALogger.I("Ending session.");
         GAEvents.StopEventQueue();
         if (IsEnabled() && SessionIsStarted())
         {
             GAEvents.AddSessionEndEvent();
             SessionStart = 0;
         }
         GAThreading.StopThread();
     }
 }
コード例 #16
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void SetBirthYear(int birthYear)
        {
            if (_endThread)
            {
                return;
            }

            GAThreading.PerformTaskOnGAThread("setBirthYear", () =>
            {
                if (GAValidator.ValidateBirthyear(birthYear))
                {
                    GAState.SetBirthYear(birthYear);
                }
            });
        }
コード例 #17
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void SetGender(EGAGender gender)
        {
            if (_endThread)
            {
                return;
            }

            GAThreading.PerformTaskOnGAThread("setGender", () =>
            {
                if (GAValidator.ValidateGender(gender))
                {
                    GAState.SetGender(gender);
                }
            });
        }
コード例 #18
0
 public static void SetEnabledVerboseLog(bool flag)
 {
     GAThreading.PerformTaskOnGAThread("setEnabledVerboseLog", () =>
     {
         if (flag)
         {
             GALogger.VerboseLog = flag;
             GALogger.I("Verbose logging enabled");
         }
         else
         {
             GALogger.I("Verbose logging disabled");
             GALogger.VerboseLog = flag;
         }
     });
 }
コード例 #19
0
 public static void ConfigureGameEngineVersion(string gameEngineVersion)
 {
     GAThreading.PerformTaskOnGAThread("configureGameEngineVersion", () =>
     {
         if (IsSdkReady(true, false))
         {
             return;
         }
         if (!GAValidator.ValidateEngineVersion(gameEngineVersion))
         {
             GALogger.I("Validation fail - configure sdk version: Sdk version not supported. String: " + gameEngineVersion);
             return;
         }
         GADevice.GameEngineVersion = gameEngineVersion;
     });
 }
コード例 #20
0
        public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, string progression03, double score)
        {
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addProgressionEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add progression event"))
                {
                    return;
                }

                // Send to events
                // TODO(nikolaj): check if this cast from int to double is OK
                GAEvents.AddProgressionEvent(progressionStatus, progression01, progression02, progression03, score, true);
            });
        }
コード例 #21
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        private static async Task WaitOnSuspend()
        {
            if (!GAState.UseManualSessionHandling)
            {
                OnSuspend();

                while (!GAThreading.IsThreadFinished())
                {
                    await Task.Delay(100);
                }
            }
            else
            {
                GALogger.I("OnSuspending: Not calling GameAnalytics.OnStop() as using manual session handling");
            }
        }
コード例 #22
0
 public static void ConfigureBuild(string build)
 {
     GAThreading.PerformTaskOnGAThread("configureBuild", () =>
     {
         if (IsSdkReady(true, false))
         {
             GALogger.W("Build version must be set before SDK is initialized.");
             return;
         }
         if (!GAValidator.ValidateBuild(build))
         {
             GALogger.I("Validation fail - configure build: Cannot be null, empty or above 32 length. String: " + build);
             return;
         }
         GAState.Build = build;
     });
 }
コード例 #23
0
        public static void ConfigureUserId(string uId)
        {
            GAThreading.PerformTaskOnGAThread("configureUserId", () =>
            {
                if (IsSdkReady(true, false))
                {
                    GALogger.W("A custom user id must be set before SDK is initialized.");
                    return;
                }
                if (!GAValidator.ValidateUserId(uId))
                {
                    GALogger.I("Validation fail - configure user_id: Cannot be null, empty or above 64 length. Will use default user_id method. Used string: " + uId);
                    return;
                }

                GAState.UserId = uId;
            });
        }
コード例 #24
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void AddErrorEvent(EGAErrorSeverity severity, string message /*, IDictionary<string, object> fields = null*/)
        {
            if (_endThread)
            {
                return;
            }

            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addErrorEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add error event"))
                {
                    return;
                }
                GAEvents.AddErrorEvent(severity, message, null);
            });
        }
コード例 #25
0
        public static void AddDesignEvent(string eventId, double value, IDictionary <string, object> customFields = null, bool mergeFields = false)
        {
            if (_endThread)
            {
                return;
            }

            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addDesignEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add design event"))
                {
                    return;
                }
                GAEvents.AddDesignEvent(eventId, value, true, customFields, mergeFields);
            });
        }
コード例 #26
0
ファイル: GAState.cs プロジェクト: yweber/Barotrauma
        public static void EndSessionAndStopQueue(bool endThread)
        {
            if (Initialized)
            {
                if (IsEnabled() && SessionIsStarted())
                {
                    GALogger.I("Ending session.");
                    GAEvents.StopEventQueue();
                    GAEvents.AddSessionEndEvent();
                    SessionStart = 0;
                }
            }

            if (endThread)
            {
                GAThreading.StopThread();
            }
        }
コード例 #27
0
        public static void AddBusinessEvent(string currency, int amount, string itemType, string itemId, string cartType, IDictionary <string, object> customFields = null, bool mergeFields = false)
        {
            if (_endThread)
            {
                return;
            }

            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addBusinessEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add business event"))
                {
                    return;
                }
                // Send to events
                GAEvents.AddBusinessEvent(currency, amount, itemType, itemId, cartType, customFields, mergeFields);
            });
        }
コード例 #28
0
        public static void ResumeSessionAndStartQueue()
#endif
        {
            if (!Initialized)
            {
                return;
            }
            GAThreading.IgnoreTimer(Instance.SuspendBlockId);
            GALogger.I("Resuming session.");
            if (!SessionIsStarted())
            {
#if WINDOWS_UWP || WINDOWS_WSA
                await StartNewSession();
#else
                StartNewSession();
#endif
            }
            GAThreading.StartThread();
        }
コード例 #29
0
ファイル: GameAnalytics.cs プロジェクト: yweber/Barotrauma
        public static void OnSuspend()
        {
            if (_endThread)
            {
                return;
            }

            GALogger.D("OnSuspend() called");
            GAThreading.PerformTaskOnGAThread("onSuspend", () =>
            {
                try
                {
                    GAState.EndSessionAndStopQueue(false);
                }
                catch (Exception)
                {
                }
            });
        }
コード例 #30
0
        public static void AddResourceEvent(EGAResourceFlowType flowType, string currency, float amount, string itemType, string itemId, IDictionary <string, object> customFields = null, bool mergeFields = false)
        {
            if (_endThread)
            {
                return;
            }

            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("addResourceEvent", () =>
            {
                if (!IsSdkReady(true, true, "Could not add resource event"))
                {
                    return;
                }

                GAEvents.AddResourceEvent(flowType, currency, amount, itemType, itemId, customFields, mergeFields);
            });
        }