예제 #1
0
        public static AnalyticsResult Transaction(string productId, decimal amount, string currency, string receiptPurchaseData, string signature, bool usingIAPService)
        {
            if (string.IsNullOrEmpty(productId))
            {
                throw new ArgumentException("Cannot set productId to an empty or null string");
            }
            if (string.IsNullOrEmpty(currency))
            {
                throw new ArgumentException("Cannot set currency to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            if (receiptPurchaseData == null)
            {
                receiptPurchaseData = string.Empty;
            }
            if (signature == null)
            {
                signature = string.Empty;
            }
            return(unityAnalyticsHandler.Transaction(productId, Convert.ToDouble(amount), currency, receiptPurchaseData, signature, usingIAPService));
        }
예제 #2
0
        public static AnalyticsResult CustomEvent(string customEventName, IDictionary <string, object> eventData)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (unityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else if (eventData == null)
            {
                result = unityAnalyticsHandler.CustomEvent(customEventName);
            }
            else
            {
                CustomEventData customEventData = new CustomEventData(customEventName);
                customEventData.Add(eventData);
                result = unityAnalyticsHandler.CustomEvent(customEventData);
            }
            return(result);
        }
예제 #3
0
 internal static UnityAnalyticsHandler GetUnityAnalyticsHandler()
 {
     if (s_UnityAnalyticsHandler == null)
     {
         s_UnityAnalyticsHandler = new UnityAnalyticsHandler();
     }
     return(s_UnityAnalyticsHandler);
 }
예제 #4
0
        public static AnalyticsResult SetUserBirthYear(int birthYear)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (s_UnityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.SetUserBirthYear(birthYear));
        }
예제 #5
0
        public static AnalyticsResult Transaction(string productId, decimal amount, string currency)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.Transaction(productId, Convert.ToDouble(amount), currency, null, null));
        }
예제 #6
0
        public static AnalyticsResult SetUserGender(Gender gender)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.SetUserGender(gender));
        }
예제 #7
0
        public static AnalyticsResult Transaction(string productId, decimal amount, string currency, string receiptPurchaseData, string signature)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.Transaction(productId, Convert.ToDouble(amount), currency, receiptPurchaseData, signature));
        }
예제 #8
0
        public static AnalyticsResult FlushEvents()
        {
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }

            return(unityAnalyticsHandler.FlushEvents() ? AnalyticsResult.Ok : AnalyticsResult.NotInitialized);
        }
예제 #9
0
 internal static UnityAnalyticsHandler GetUnityAnalyticsHandler()
 {
     if (s_UnityAnalyticsHandler == null)
     {
         s_UnityAnalyticsHandler = new UnityAnalyticsHandler();
     }
     if (s_UnityAnalyticsHandler.IsInitialized())
     {
         return(s_UnityAnalyticsHandler);
     }
     return(null);
 }
예제 #10
0
        public static AnalyticsResult SetUserId(string userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException("Cannot set userId to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.SetUserId(userId));
        }
예제 #11
0
        private static AnalyticsResult RegisterEvent(string eventName, int maxEventPerHour, int maxItems, string vendorKey, int ver, string prefix, string assemblyInfo)
        {
            if (string.IsNullOrEmpty(eventName))
            {
                throw new ArgumentException("Cannot set event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.RegisterEvent(eventName, maxEventPerHour, maxItems, vendorKey, ver, prefix, assemblyInfo));
        }
예제 #12
0
        public static AnalyticsResult CustomEvent(string customEventName)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.SendCustomEventName(customEventName));
        }
예제 #13
0
        public static AnalyticsResult SetUserGender(Gender gender)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (unityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                result = unityAnalyticsHandler.SetUserGender(gender);
            }
            return(result);
        }
예제 #14
0
        public static AnalyticsResult SetUserBirthYear(int birthYear)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (Analytics.s_UnityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                result = unityAnalyticsHandler.SetUserBirthYear(birthYear);
            }
            return(result);
        }
예제 #15
0
        public static AnalyticsResult Transaction(string productId, decimal amount, string currency, string receiptPurchaseData, string signature, bool usingIAPService)
        {
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (unityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                result = unityAnalyticsHandler.Transaction(productId, Convert.ToDouble(amount), currency, receiptPurchaseData, signature, usingIAPService);
            }
            return(result);
        }
예제 #16
0
        public static AnalyticsResult FlushEvents()
        {
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (unityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                result = unityAnalyticsHandler.FlushEvents();
            }
            return(result);
        }
예제 #17
0
        public static AnalyticsResult SendEvent(string eventName, object parameters, int ver = 1, string prefix = "")
        {
            if (string.IsNullOrEmpty(eventName))
            {
                throw new ArgumentException("Cannot set event name to an empty or null string");
            }
            if (parameters == null)
            {
                throw new ArgumentException("Cannot set parameters to null");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            return(unityAnalyticsHandler.SendEvent(eventName, parameters, ver, prefix));
        }
예제 #18
0
        public static AnalyticsResult CustomEvent(string customEventName)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = Analytics.GetUnityAnalyticsHandler();
            AnalyticsResult       result;

            if (unityAnalyticsHandler == null)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                result = unityAnalyticsHandler.CustomEvent(customEventName);
            }
            return(result);
        }
예제 #19
0
        public static AnalyticsResult CustomEvent(string customEventName, Vector3 position)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            CustomEventData customEventData = new CustomEventData(customEventName);

            customEventData.Add("x", (double)Convert.ToDecimal(position.x));
            customEventData.Add("y", (double)Convert.ToDecimal(position.y));
            customEventData.Add("z", (double)Convert.ToDecimal(position.z));
            return(unityAnalyticsHandler.CustomEvent(customEventData));
        }
예제 #20
0
        public static AnalyticsResult CustomEvent(string customEventName, IDictionary <string, object> eventData)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            if (eventData == null)
            {
                return(unityAnalyticsHandler.SendCustomEventName(customEventName));
            }
            CustomEventData customEvent = new CustomEventData(customEventName);

            customEvent.AddDictionary(eventData);
            return(unityAnalyticsHandler.SendCustomEvent(customEvent));
        }
예제 #21
0
 internal static extern IntPtr Internal_Create(UnityAnalyticsHandler u);
예제 #22
0
 internal static UnityAnalyticsHandler GetUnityAnalyticsHandler()
 {
     if (s_UnityAnalyticsHandler == null)
     {
         s_UnityAnalyticsHandler = new UnityAnalyticsHandler();
     }
     return s_UnityAnalyticsHandler;
 }