Пример #1
0
    public void ShowRewardAds()
    {
#if UNITY_EDITOR
        Debug.Log("Editor play Reward ad once");
        if (_onRewardAds != null)
        {
            _onRewardAds((int)Type.ADS_RESULT_FINISHT);
        }
#else
        if (IronSource.Agent.isRewardedVideoAvailable())
        {
#if UNITY_IOS
            _timeScaleCache = Time.timeScale;
            Time.timeScale  = 0;
            SoundManager.Instance.CacheAndMuteAll();
#endif
            IronSource.Agent.showRewardedVideo();
        }
        else
        {
            EzDebug.Log("unity-script: IronSource.Agent.isRewardedVideoAvailable - False");
            if (_onRewardAds != null)
            {
                _onRewardAds((int)Type.ADS_RESULT_NOREADY);
            }
        }
#endif
    }
Пример #2
0
    void RewardedVideoAdClosedEvent()
    {
#if UNITY_IOS
        Time.timeScale = _timeScaleCache;
        SoundManager.Instance.RevertMuteAll();
#endif
        EzDebug.Log("unity-script: I got RewardedVideoAdClosedEvent");
    }
Пример #3
0
 void RewardedVideoAvailabilityChangedEvent(bool canShowAd)
 {
     EzDebug.Log("unity-script: I got RewardedVideoAvailabilityChangedEvent, value = " + canShowAd);
     if (_onAvailability != null)
     {
         _onAvailability(canShowAd);
     }
 }
Пример #4
0
    void RewardedVideoAdShowFailedEvent(IronSourceError error)
    {
#if UNITY_IOS
        Time.timeScale = _timeScaleCache;
        SoundManager.Instance.RevertMuteAll();
#endif
        EzDebug.Log("unity-script: I got RewardedVideoAdShowFailedEvent, code :  " + error.getCode() + ", description : " + error.getDescription());
        if (_onRewardAds != null)
        {
            _onRewardAds((int)Type.ADS_RESULT_FAILED);
        }
    }
Пример #5
0
    void InitRewardAdsEvent()
    {
        EzDebug.Log("unity-script: ShowRewardedVideoScript Start called");

        //Add Rewarded Video Events
        IronSourceEvents.onRewardedVideoAdOpenedEvent            += RewardedVideoAdOpenedEvent;
        IronSourceEvents.onRewardedVideoAdClosedEvent            += RewardedVideoAdClosedEvent;
        IronSourceEvents.onRewardedVideoAvailabilityChangedEvent += RewardedVideoAvailabilityChangedEvent;
        IronSourceEvents.onRewardedVideoAdStartedEvent           += RewardedVideoAdStartedEvent;
        IronSourceEvents.onRewardedVideoAdEndedEvent             += RewardedVideoAdEndedEvent;
        IronSourceEvents.onRewardedVideoAdRewardedEvent          += RewardedVideoAdRewardedEvent;
        IronSourceEvents.onRewardedVideoAdShowFailedEvent        += RewardedVideoAdShowFailedEvent;
        IronSourceEvents.onRewardedVideoAdClickedEvent           += RewardedVideoAdClickedEvent;
    }
Пример #6
0
 void RewardedVideoAdRewardedEvent(IronSourcePlacement ssp)
 {
     EzDebug.Log("unity-script: I got RewardedVideoAdRewardedEvent, amount = " + ssp.getRewardAmount() + " name = " + ssp.getRewardName());
     if (ssp.getRewardAmount() > 0 && !string.IsNullOrEmpty(ssp.getRewardName()))
     {
         if (_onRewardAds != null)
         {
             _onRewardAds((int)Type.ADS_RESULT_FINISHT);
         }
     }
     else
     {
         if (_onRewardAds != null)
         {
             _onRewardAds((int)Type.ADS_RESULT_SKIP);
         }
     }
 }
Пример #7
0
    public void Init(string appKey)
    {
        EzDebug.Log("unity-script: MyAppStart Start called");

        IronSource.Agent.shouldTrackNetworkState(true);
#if UNITY_EDITOR
        _onAvailability(true);
#endif

#if JX_DEBUG
        EzDebug.Log("unity-script: IronSource.Agent.validateIntegration");
        IronSource.Agent.validateIntegration();
#endif
        EzDebug.Log("unity-script: unity version" + IronSource.unityVersion());

        EzDebug.Log("unity-script: IronSource.Agent.init");
        IronSource.Agent.init(appKey, IronSourceAdUnits.REWARDED_VIDEO, IronSourceAdUnits.INTERSTITIAL);
        InitRewardAdsEvent();
        InitIntersAdEvent();
        IronSource.Agent.loadInterstitial();
    }
Пример #8
0
    /// <summary>
    /// 设置玩家属性 必须在初始化App之前调用
    /// </summary>
    /// <param name="level">玩家等级</param>
    /// <param name="iapt">购买总金额</param>
    /// <param name="userCreationDate">创建时间 首次进游戏时间</param>
    /// <param name="att">自定义参数 最多5个 key和value都为string类型 </param>
    public void SetAdsUserInfo(int level, double iapt, long userCreationDate, LuaTable att)
    {
        string id = IronSource.Agent.getAdvertiserId();

        IronSource.Agent.setUserId(id);
        EzDebug.Log("unity-script: getAdvertiserId" + id);

        IronSourceSegment segment = new IronSourceSegment();

        segment.level            = level;
        segment.iapt             = iapt;
        segment.userCreationDate = userCreationDate;

        //自定义参数最多5个
        if (att != null)
        {
            att.ForEach <string, string>((k, v) =>
            {
                segment.customs.Add(k, v);
            });
        }

        IronSource.Agent.setSegment(segment);
    }
Пример #9
0
 void RewardedVideoAdClickedEvent(IronSourcePlacement ssp)
 {
     EzDebug.Log("unity-script: I got RewardedVideoAdClickedEvent, name = " + ssp.getRewardName());
 }
Пример #10
0
 void RewardedVideoAdEndedEvent()
 {
     EzDebug.Log("unity-script: I got RewardedVideoAdEndedEvent");
 }