Example #1
0
        private static void NativeDidReceiveAdCallback(IntPtr nativeClient, string nativeDataKey)
        {
            YumiNativeClient client = IntPtrToNativeClient(nativeClient);

            if (client.OnNativeAdLoaded != null)
            {
                List <YumiNativeData> nativeList = new List <YumiNativeData>();

                if (nativeDataKey != null)
                {
                    string[] keys = nativeDataKey.Split(',');

                    foreach (var adUniqueId in keys)
                    {
                        YumiNativeData model = client.GetNativeAdData(adUniqueId);
                        nativeList.Add(model);
                    }
                }

                YumiNativeToLoadEventArgs args = new YumiNativeToLoadEventArgs()
                {
                    nativeData = nativeList
                };

                Debug.LogFormat("adcount = {0}", nativeDataKey);

                client.OnNativeAdLoaded(client, args);
            }
        }
        void onLayerPrepared(string uniqueIds)
        {
            if (uniqueIds == null || uniqueIds.Length == 0)
            {
                onLayerFailed("YumiBirdge: cannot found valiated uniqueIds");
                return;
            }
            YumiNativeToLoadEventArgs args = new YumiNativeToLoadEventArgs()
            {
                nativeData = getNativeDatas(uniqueIds)
            };

            OnNativeAdLoaded(this, args);
        }
    public void HandleNativeAdLoaded(object sender, YumiNativeToLoadEventArgs args)
    {
        Logger.Log("HandleNativeAdLoaded event opened");
        if (nativeAd == null)
        {
            statusText.text = "nativeAd is null";
            return;
        }

        if (args == null || args.nativeData == null || args.nativeData.Count == 0)
        {
            statusText.text = "nativeAd data not found.";
            return;
        }
        statusText.text = "HandleNativeAdLoaded";
        yumiNativeData  = args.nativeData[0];
    }