Пример #1
0
        void _didFailToLoad(string jsonMessage)
        {
            TDDebugLogger.Log("_didFailToLoad " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdNotAvailable(adEvent);
        }
Пример #2
0
        void _didClick(string jsonMessage)
        {
            TDDebugLogger.Log("_onAdClick " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdClicked(adEvent);
        }
Пример #3
0
        public static T GetEnumFromString <T>(string enumString, T defaultValue = default(T))
        {
            Array values = null;

            try {
                values = Enum.GetValues(typeof(T));
            }
            catch (Exception e) {
                TDDebugLogger.LogError("Can't GetEnumFromString: " + enumString);
                return(defaultValue);
            }

            if (values == null)
            {
                return(defaultValue);
            }

            foreach (var val in values)
            {
                if (val.ToString().ToLower() == enumString.ToLower())
                {
                    return((T)val);
                }
            }

            return(defaultValue);
        }
    public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject)
    {
        if (buildTarget != BuildTarget.iOS)
        {
            return;
        }
        TDDebugLogger.Log("OnPostprocessBuild - Path: " + pathToBuiltProject);

        EditorPrefs.SetString(BuildPathKey, pathToBuiltProject);

        var path = PBXProject.GetPBXProjectPath(pathToBuiltProject);

        if (!File.Exists(path))
        {
            TDDebugLogger.LogError(string.Format("pbxproj '{0}' does not exists", path));
            return;
        }

        var proj = new PBXProject();

        proj.ReadFromString(File.ReadAllText(path));

        var unityIPhoneTargetGuid = GetUnityIPhoneTargetGuid(path);

        SetPListProperties(pathToBuiltProject);

        proj.UpdateBuildProperty(unityIPhoneTargetGuid, "OTHER_LDFLAGS", new string [] { "-ObjC" }, new string [] {});

        File.WriteAllText(path, proj.WriteToString());
    }
Пример #5
0
        void _didFailToLoadConfig(string message)
        {
            TDDebugLogger.LogWarning("_didFailToLoadConfig");
            var adEvent = JsonUtility.FromJson <TDAdError> (message);

            TDCallbacks.instance.OnTapdaqConfigFailedToLoad(adEvent);
        }
Пример #6
0
        void _didFailToDisplay(string jsonMessage)
        {
            TDDebugLogger.Log("_didFailToDisplay " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent>(jsonMessage);

            TDCallbacks.instance.OnAdDidFailToDisplay(adEvent);
        }
Пример #7
0
        // banner
        void _didRefresh(string jsonMessage)
        {
            TDDebugLogger.Log("_didRefresh " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdRefresh(adEvent);
        }
Пример #8
0
        void _onValidationFailed(string jsonMessage)
        {
            TDDebugLogger.Log("_onValidationFailed " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdError(adEvent);
        }
Пример #9
0
        void _didVerify(string message)
        {
            TDDebugLogger.Log("_didVerify " + message);
            var reward = JsonUtility.FromJson <TDVideoReward> (message);

            TDCallbacks.instance.OnRewardedVideoValidated(reward);
        }
Пример #10
0
 private static T GetAndroidStatic <T>(string methodName, params object[] paramList)
 {
     LogUnsupportedPlatform();
     if (Application.platform == RuntimePlatform.Android)
     {
         try {
             using (AndroidJavaClass tapdaqUnity = new AndroidJavaClass("com.tapdaq.unityplugin.TapdaqUnity")) {
                 return(tapdaqUnity.CallStatic <T> (methodName, paramList));
             }
         } catch (Exception e) {
             TDDebugLogger.LogException(e);
         }
     }
     TDDebugLogger.LogError("Error while call static method");
     return(default(T));
 }
Пример #11
0
        public static void LogMessage(TDLogSeverity severity, string message)
        {
            string prefix = "Tapdaq Unity SDK: ";

            if (severity == TDLogSeverity.warning)
            {
                TDDebugLogger.LogWarning(prefix + message);
            }
            else if (severity == TDLogSeverity.error)
            {
                TDDebugLogger.LogError(prefix + message);
            }
            else
            {
                TDDebugLogger.Log(prefix + message);
            }
        }
Пример #12
0
        private static void CallAndroidStaticMethodFromClass(string className,
                                                             string methodName, bool logException, params object[] paramList)
        {
            TDEventHandler.instance.Init();

            LogUnsupportedPlatform();
            if (Application.platform == RuntimePlatform.Android)
            {
                try {
                    using (AndroidJavaClass androidClass = new AndroidJavaClass(className)) {
                        androidClass.CallStatic(methodName, paramList);
                    }
                } catch (Exception e) {
                    if (logException)
                    {
                        TDDebugLogger.Log("CallAndroidStaticMethod:  " + methodName + "    FromClass: "
                                          + className + " failed. Message: " + e.Message);
                    }
                }
            }
        }
Пример #13
0
        private void Initialize(string appID, string clientKey, TDStatus isUserSubjectToGDPR, TDStatus isConsentGiven, TDStatus isAgeRestrictedUser, string userId, bool shouldForwardUserId)
        {
            LogUnsupportedPlatform();

            LogMessage(TDLogSeverity.debug, "TapdaqSDK/Initializing");

#if UNITY_IPHONE
            CallIosMethod(() => TD_SetPluginTools(Application.unityVersion));
            var testDevices = new TestDevicesList(settings.testDevices, TestDeviceType.iOS).ToString();
            TDDebugLogger.Log("testDevices:\n" + testDevices);
            CallIosMethod(() => TD_ConfigureTapdaq(appID, clientKey, testDevices,
                                                   settings.isDebugMode, settings.autoReloadAds, TDSettings.pluginVersion, (int)isUserSubjectToGDPR, (int)isConsentGiven, (int)isAgeRestrictedUser, userId, shouldForwardUserId));
#elif UNITY_ANDROID
            CallAndroidStaticMethod("SetPluginTools", Application.unityVersion);

            var testDevices = new TestDevicesList(settings.testDevices, TestDeviceType.Android).ToString();
            TDDebugLogger.Log("testDevices:\n" + testDevices);
            CallAndroidStaticMethod("InitiateTapdaq", appID, clientKey, testDevices,
                                    settings.isDebugMode, settings.autoReloadAds, TDSettings.pluginVersion, (int)isUserSubjectToGDPR, (int)isConsentGiven, (int)isAgeRestrictedUser, userId, shouldForwardUserId);
                        #endif
        }
Пример #14
0
 void _onRejected(string adType)
 {
     TDDebugLogger.Log("_onRejected " + adType);
     TDCallbacks.instance.OnAdError(new TDAdEvent(adType, "VALIDATION_REJECTED"));
 }
Пример #15
0
 void _didLoadConfig(string message)
 {
     TDDebugLogger.LogWarning("_didLoadConfig");
     TDCallbacks.instance.OnTapdaqConfigLoaded();
 }
Пример #16
0
 void _onUserDeclined(string adType)
 {
     TDDebugLogger.Log("_onUserDeclined " + adType);
     TDCallbacks.instance.OnAdClosed(new TDAdEvent(adType, "DECLINED_TO_VIEW"));
 }
Пример #17
0
 private static void LogObsoleteWithTagMethod(string methodName)
 {
     TDDebugLogger.LogError("'" + methodName + "WithTag(string tag)' is Obsolete. Please, use '" + methodName + "(string tag)' instead");
 }
Пример #18
0
 void _didEngagement(string adType)
 {
     TDDebugLogger.Log("_didEngagement " + adType);
 }
Пример #19
0
 public void _UnexpectedErrorHandler(string msg)
 {
     TDDebugLogger.Log(":: Ad test ::" + msg);
     LogMessage(TDLogSeverity.error, msg);
 }
Пример #20
0
 // reeward video
 void _didReachLimit(string adType)
 {
     TDDebugLogger.Log("_didReachLimit " + adType);
     TDCallbacks.instance.OnAdError(new TDAdEvent(adType, "VALIDATION_EXCEEDED_QUOTA"));
 }
Пример #21
0
 public void FetchFailed(string msg)
 {
     TDDebugLogger.Log(msg);
     LogMessage(TDLogSeverity.debug, "unable to fetch more ads");
 }
Пример #22
0
 // video
 void _didComplete(string adType)
 {
     TDDebugLogger.Log("_didComplete " + adType);
 }