Ejemplo n.º 1
0
        public static void Initialize(string gameKey, string gameSecret)
        {
#if WINDOWS_UWP || WINDOWS_WSA || WINDOWS_PHONE
            CoreApplication.Suspending += OnSuspending;
            CoreApplication.Resuming   += OnResuming;
#endif
            GADevice.UpdateConnectionType();

            GAThreading.PerformTaskOnGAThread("initialize", () =>
            {
                if (IsSdkReady(true, false))
                {
                    GALogger.W("SDK already initialized. Can only be called once.");
                    return;
                }
                if (!GAValidator.ValidateKeys(gameKey, gameSecret))
                {
                    GALogger.W("SDK failed initialize. Game key or secret key is invalid. Can only contain characters A-z 0-9, gameKey is 32 length, gameSecret is 40 length. Failed keys - gameKey: " + gameKey + ", secretKey: " + gameSecret);
                    return;
                }

                GAState.SetKeys(gameKey, gameSecret);

                if (!GAStore.EnsureDatabase(false))
                {
                    GALogger.W("Could not ensure/validate local event database: " + GADevice.WritablePath);
                }

                GAState.InternalInitialize();
            });
        }
Ejemplo n.º 2
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);
            });
        }
Ejemplo n.º 3
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);
            });
        }
Ejemplo n.º 4
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);
            });
        }
Ejemplo n.º 5
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);
            });
        }
Ejemplo n.º 6
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);
            });
        }
Ejemplo n.º 7
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);
            });
        }
Ejemplo n.º 8
0
        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);
            });
        }
Ejemplo n.º 9
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);
            });
        }
Ejemplo n.º 10
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);
            });
        }
Ejemplo n.º 11
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);
            });
        }
Ejemplo n.º 12
0
        public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, string progression03 /*, IDictionary<string, object> fields = null*/)
        {
            if (_endThread)
            {
                return;
            }

            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, 0, false, null);
            });
        }
Ejemplo n.º 13
0
 static GameAnalytics()
 {
     _endThread = false;
     GADevice.Touch();
 }
Ejemplo n.º 14
0
 static GameAnalytics()
 {
     GADevice.Touch();
 }