Example #1
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 150, 50), _campaignsAvailable ? "Open Zone 1" : "Waiting..."))
        {
            if (_campaignsAvailable)
            {
                UnityAdsExternal.Log("Open Zone 1 -button clicked");
                UnityAds.show("16-default");
            }
        }

        if (GUI.Button(new Rect(10, 70, 150, 50), _campaignsAvailable ? "Open Zone 2" : "Waiting..."))
        {
            if (_campaignsAvailable)
            {
                UnityAdsExternal.Log("Open Zone 2 -button clicked");
                UnityAds.show("16-default", "ship", new Dictionary <string, string> {
                    { "openAnimated", "true" },
                    { "noOfferScreen", "true" },
                    { "sid", "testiSid" },
                    { "muteVideoSounds", "true" },
                    { "useDeviceOrientationForVideo", "true" }
                });
            }
        }
    }
Example #2
0
    public void onVideoStarted()
    {
        if (_videoStartedDelegate != null)
        {
            _videoStartedDelegate();
        }

        UnityAdsExternal.Log("onVideoStarted");
    }
Example #3
0
    public void onFetchFailed()
    {
        _campaignsAvailable = false;
        if (_campaignsFetchFailedDelegate != null)
        {
            _campaignsFetchFailedDelegate();
        }

        UnityAdsExternal.Log("onFetchFailed");
    }
Example #4
0
    public void onFetchCompleted()
    {
        _campaignsAvailable = true;
        if (_campaignsAvailableDelegate != null)
        {
            _campaignsAvailableDelegate();
        }

        UnityAdsExternal.Log("onFetchCompleted");
    }
Example #5
0
    /* Events */

    public void onHide()
    {
        _adsShow             = false;
        AudioListener.pause  = false;
        AudioListener.volume = _savedAudioVolume;
        Time.timeScale       = _savedTimeScale;

        if (_adsHideDelegate != null)
        {
            _adsHideDelegate();
        }

        UnityAdsExternal.Log("onHide");
    }
Example #6
0
    public void onVideoCompleted(string parameters)
    {
        if (parameters != null)
        {
            List <string> splittedParameters = new List <string>(parameters.Split(';'));
            string        rewardItemKey      = splittedParameters.ToArray().GetValue(0).ToString();
            bool          skipped            = splittedParameters.ToArray().GetValue(1).ToString() == "true" ? true : false;

            if (_videoCompletedDelegate != null)
            {
                _videoCompletedDelegate(rewardItemKey, skipped);
            }

            UnityAdsExternal.Log("onVideoCompleted: " + rewardItemKey + " - " + skipped);
        }
    }
Example #7
0
    public static Dictionary <string, string> getRewardItemDetailsWithKey(string rewardItemKey)
    {
        Dictionary <string, string> retDict = new Dictionary <string, string>();
        string rewardItemDataString         = "";

        if (_campaignsAvailable)
        {
            rewardItemDataString = UnityAdsExternal.getRewardItemDetailsWithKey(rewardItemKey);

            if (rewardItemDataString != null)
            {
                List <string> splittedData = new List <string>(rewardItemDataString.Split(';'));
                UnityAdsExternal.Log("UnityAndroid: getRewardItemDetailsWithKey() rewardItemDataString=" + rewardItemDataString);

                if (splittedData.Count == 2)
                {
                    retDict.Add(getRewardItemNameKey(), splittedData.ToArray().GetValue(0).ToString());
                    retDict.Add(getRewardItemPictureKey(), splittedData.ToArray().GetValue(1).ToString());
                }
            }
        }

        return(retDict);
    }
Example #8
0
 public void onShow()
 {
     UnityAdsExternal.Log("onShow");
 }