Exemplo n.º 1
0
        void _didFailToLoad(string jsonMessage)
        {
            TDDebugLogger.Log("_didFailToLoad " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdNotAvailable(adEvent);
        }
Exemplo n.º 2
0
        void _didClick(string jsonMessage)
        {
            TDDebugLogger.Log("_onAdClick " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdClicked(adEvent);
        }
Exemplo n.º 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());
    }
Exemplo n.º 5
0
        void _didFailToLoadConfig(string message)
        {
            TDDebugLogger.LogWarning("_didFailToLoadConfig");
            var adEvent = JsonUtility.FromJson <TDAdError> (message);

            TDCallbacks.instance.OnTapdaqConfigFailedToLoad(adEvent);
        }
Exemplo n.º 6
0
        void _didFailToDisplay(string jsonMessage)
        {
            TDDebugLogger.Log("_didFailToDisplay " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent>(jsonMessage);

            TDCallbacks.instance.OnAdDidFailToDisplay(adEvent);
        }
Exemplo n.º 7
0
        // banner
        void _didRefresh(string jsonMessage)
        {
            TDDebugLogger.Log("_didRefresh " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdRefresh(adEvent);
        }
Exemplo n.º 8
0
        void _onValidationFailed(string jsonMessage)
        {
            TDDebugLogger.Log("_onValidationFailed " + jsonMessage);
            var adEvent = JsonUtility.FromJson <TDAdEvent> (jsonMessage);

            TDCallbacks.instance.OnAdError(adEvent);
        }
Exemplo n.º 9
0
        void _didVerify(string message)
        {
            TDDebugLogger.Log("_didVerify " + message);
            var reward = JsonUtility.FromJson <TDVideoReward> (message);

            TDCallbacks.instance.OnRewardedVideoValidated(reward);
        }
Exemplo n.º 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));
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
                    }
                }
            }
        }
Exemplo n.º 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
        }
Exemplo n.º 14
0
 void _onRejected(string adType)
 {
     TDDebugLogger.Log("_onRejected " + adType);
     TDCallbacks.instance.OnAdError(new TDAdEvent(adType, "VALIDATION_REJECTED"));
 }
Exemplo n.º 15
0
 void _didLoadConfig(string message)
 {
     TDDebugLogger.LogWarning("_didLoadConfig");
     TDCallbacks.instance.OnTapdaqConfigLoaded();
 }
Exemplo n.º 16
0
 void _onUserDeclined(string adType)
 {
     TDDebugLogger.Log("_onUserDeclined " + adType);
     TDCallbacks.instance.OnAdClosed(new TDAdEvent(adType, "DECLINED_TO_VIEW"));
 }
Exemplo n.º 17
0
 private static void LogObsoleteWithTagMethod(string methodName)
 {
     TDDebugLogger.LogError("'" + methodName + "WithTag(string tag)' is Obsolete. Please, use '" + methodName + "(string tag)' instead");
 }
Exemplo n.º 18
0
 void _didEngagement(string adType)
 {
     TDDebugLogger.Log("_didEngagement " + adType);
 }
Exemplo n.º 19
0
 public void _UnexpectedErrorHandler(string msg)
 {
     TDDebugLogger.Log(":: Ad test ::" + msg);
     LogMessage(TDLogSeverity.error, msg);
 }
Exemplo n.º 20
0
 // reeward video
 void _didReachLimit(string adType)
 {
     TDDebugLogger.Log("_didReachLimit " + adType);
     TDCallbacks.instance.OnAdError(new TDAdEvent(adType, "VALIDATION_EXCEEDED_QUOTA"));
 }
Exemplo n.º 21
0
 public void FetchFailed(string msg)
 {
     TDDebugLogger.Log(msg);
     LogMessage(TDLogSeverity.debug, "unable to fetch more ads");
 }
Exemplo n.º 22
0
 // video
 void _didComplete(string adType)
 {
     TDDebugLogger.Log("_didComplete " + adType);
 }