示例#1
0
 protected static void SetCallbackStateAndTag(string state, string tag)
 {
     if (HZOfferWallAd.adDisplayListener != null)
     {
         HZOfferWallAd.adDisplayListener(state, tag);
     }
 }
示例#2
0
 protected static void SendVCSError(string errorMsg)
 {
     if (HZOfferWallAd.virtualCurrencyErrorListener != null)
     {
         HZOfferWallAd.virtualCurrencyErrorListener(errorMsg);
     }
 }
示例#3
0
 protected static void SendVCSResponse(string jsonString)
 {
     if (HZOfferWallAd.virtualCurrencyResponseListener != null)
     {
         VirtualCurrencyResponse response = (VirtualCurrencyResponse)JsonUtility.FromJson <VirtualCurrencyResponse>(jsonString);
         HZOfferWallAd.virtualCurrencyResponseListener(response);
     }
 }
示例#4
0
 public static void InitReceiver()
 {
     if (_instance == null)
     {
         GameObject receiverObject = new GameObject("HZOfferWallAd");
         DontDestroyOnLoad(receiverObject);
         _instance = receiverObject.AddComponent <HZOfferWallAd>();
     }
 }
        /// <summary>
        /// Starts the Heyzap SDK. Call this method as soon as possible in your app to ensure Heyzap has time to initialize before you want to show an ad.
        /// </summary>
        /// <param name="publisher_id">Your publisher ID. This can be found on your Heyzap dashboards - see https://developers.heyzap.com/docs/unity_sdk_setup_and_requirements for more information.</param>
        /// <param name="options">A bitmask of options you can pass to this call to change the way Heyzap will work.</param>
        public static void Start(string publisher_id, int options)
        {
            #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
                #if UNITY_ANDROID
            HeyzapAdsAndroid.Start(publisher_id, options);
                #elif UNITY_IPHONE
            HeyzapAdsIOS.Start(publisher_id, options);
                #endif
            #else
            UnityEngine.Debug.LogError("Call received to start the Heyzap SDK, but the SDK does not function in the editor. You must use a device/emulator to receive/test ads.");
            #endif

            HeyzapAds.InitReceiver();
            HZInterstitialAd.InitReceiver();
            HZVideoAd.InitReceiver();
            HZIncentivizedAd.InitReceiver();
            HZBannerAd.InitReceiver();
            HZOfferWallAd.InitReceiver();
            HZDemographics.InitReceiver();
        }
示例#6
0
 //provided since JS can't use default parameters
 /// <summary>
 /// Fetches an ad for the default ad tag.
 /// </summary>
 public static void Fetch()
 {
     HZOfferWallAd.Fetch(null);
 }
示例#7
0
 //provided since JS can't use default parameters
 /// <summary>
 /// Shows an ad with the default options.
 /// </summary>
 public static void Show()
 {
     HZOfferWallAd.ShowWithOptions(null);
 }
示例#8
0
        // used for in-editor functionality
        protected static IEnumerator InvokeVCSErrorNextFrame(string errorMsg)
        {
            yield return(null); // wait a frame

            HZOfferWallAd.SendVCSError(errorMsg);
        }
示例#9
0
 // received from native SDK
 public void VCSError(string errorMsg)
 {
     HZOfferWallAd.SendVCSError(errorMsg);
 }
示例#10
0
 // received from native SDK
 public void VCSResponse(string jsonString)
 {
     HZOfferWallAd.SendVCSResponse(jsonString);
 }
示例#11
0
        // used for in-editor functionality
        protected static IEnumerator InvokeCallbackNextFrame(string state, string tag)
        {
            yield return(null); // wait a frame

            HZOfferWallAd.SetCallbackStateAndTag(state, tag);
        }
示例#12
0
 // received from native SDK
 public void SetCallback(string message)
 {
     string[] displayStateParams = message.Split(',');
     HZOfferWallAd.SetCallbackStateAndTag(displayStateParams[0], displayStateParams[1]);
 }
示例#13
0
 //provided since JS can't use default parameters
 /// <summary>
 /// Returns whether or not an ad is available for the default ad tag.
 /// </summary>
 /// <returns><c>true</c>, if an ad is available, <c>false</c> otherwise.</returns>
 public static bool IsAvailable()
 {
     return(HZOfferWallAd.IsAvailable(null));
 }