예제 #1
0
        public void Load(string placementId, IUnityAdsLoadListener loadListener)
        {
            // If placementId is null, use explicit defaultPlacement to match native behaviour
            if (m_Initialized && placementId == null)
            {
                placementId = m_Configuration.defaultPlacement;
            }

            if (!m_Initialized)
            {
                m_QueuedLoads?.Enqueue(placementId);
                return;
            }

            m_Platform.UnityLifecycleManager.Post(() => {
                if (m_PlacementMap.ContainsKey(placementId))
                {
                    m_PlacementMap[placementId] = true;
                    m_Platform.UnityAdsReady(placementId);
                    loadListener?.OnUnityAdsAdLoaded(placementId);
                }
                else
                {
                    string errorMessage = "Placement " + placementId + " does not exist for gameId: " + m_GameId;
                    m_Platform.UnityAdsDidError(errorMessage);
                    loadListener?.OnUnityAdsFailedToLoad(placementId, UnityAdsLoadError.INVALID_ARGUMENT, errorMessage);
                }
            });
        }
 public override void Dispose()
 {
     if (NativePtr == IntPtr.Zero)
     {
         return;
     }
     LoadListenerDestroy(NativePtr);
     NativePtr = IntPtr.Zero;
     m_UnityAdsInternalListener = null;
     m_UserListener             = null;
 }
예제 #3
0
 public void Load(string placementId, IUnityAdsLoadListener loadListener)
 {
     UnityAdsLoad(placementId, new IosLoadListener(this, loadListener).NativePtr);
 }
예제 #4
0
 public void Load(string placementId, IUnityAdsLoadListener loadListener)
 {
     m_UnityAds?.CallStatic("load", placementId, new AndroidLoadListener(m_Platform, loadListener));
 }
예제 #5
0
 public void Load(string placementId, IUnityAdsLoadListener loadListener)
 {
 }
예제 #6
0
 public AndroidLoadListener(IPlatform platform, IUnityAdsLoadListener loadListener) : base("com.unity3d.ads.IUnityAdsLoadListener")
 {
     m_Platform        = platform;
     m_ManagedListener = loadListener;
 }
 public IosLoadListener(IUnityAdsLoadListener unityAdsInternalListener, IUnityAdsLoadListener userListener)
 {
     NativePtr = LoadListenerCreate(OnLoadSuccess, OnLoadFailure);
     m_UnityAdsInternalListener = unityAdsInternalListener;
     m_UserListener             = userListener;
 }