static void adFinished(AdFinishedEventArgs args) { if (onAdFinishedEvent != null) { onAdFinishedEvent(args); } }
public static void onEvent(string e, string arg) { if (e == "OnAdStart") { OnAdStartEvent(arg); } if (e == "OnAdEnd") { adWinFinishedEventArgs = new AdFinishedEventArgs(); var args = arg.Split(new char[] { ':' }); adWinFinishedEventArgs.WasCallToActionClicked = "1".Equals(args[0]); adWinFinishedEventArgs.IsCompletedView = bool.Parse(args[2]); adWinFinishedEventArgs.TimeWatched = double.Parse(args[3]) / 1000; OnAdFinishedEvent(args[1], adWinFinishedEventArgs); } if (e == "OnAdPlayableChanged") { var args = arg.Split(new char[] { ':' }); OnAdPlayableEvent(args[1], "1".Equals(args[0])); } if (e == "Diagnostic") { OnSDKLogEvent(arg); } if (e == "OnInitCompleted") { if ("1".Equals(arg)) { OnSDKInitializeEvent(); } } }
//methods only for android void OnAdEnd(string param) { bool fireRightNow = adFinishedEventArgs != null; if (!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } var parts = param.Split(new char[] { '-' }); if (parts.Length == 2) { adFinishedEventArgs.IsCompletedView = parts[0].Equals("1"); adFinishedEventArgs.WasCallToActionClicked = parts[1].Equals("1"); } adFinishedEventArgs.TotalDuration = 15; adFinishedEventArgs.TimeWatched = adFinishedEventArgs.IsCompletedView?15:0; OnAdFinishedEvent(adFinishedEventArgs); OnVideoViewEvent(adFinishedEventArgs.IsCompletedView ? 15 : 0, 15); adFinishedEventArgs = null; OnAdEndEvent(); }
void OnAdFinishedEvent(AdFinishedEventArgs arg) { Debug.Log("Cliked : " + arg.WasCallToActionClicked); if (arg.WasCallToActionClicked) { StartCoroutine(Clicked(pack__)); } }
public static void onEvent(string e, string arg) { if (e == "OnAdStart") { OnAdStartEvent(); } if (e == "OnAdEnd") { bool fireRightNow = adWinFinishedEventArgs != null; if(!fireRightNow) { adWinFinishedEventArgs = new AdFinishedEventArgs(); } adWinFinishedEventArgs.WasCallToActionClicked = "1".Equals (arg); if(fireRightNow) { OnAdFinishedEvent(adWinFinishedEventArgs); adWinFinishedEventArgs = null; } OnAdEndEvent(); } if (e == "OnAdPlayableChanged") { if ("1".Equals (arg)) OnCachedAdAvailableEvent(); OnAdPlayableEvent("1".Equals (arg)); } if (e == "OnVideoView") { var parts = arg.Split( new char[] { ':' } ); if(parts.Length == 3 ) { double timeWatched = double.Parse( parts[1] ); double totalDuration = double.Parse( parts[2] ); bool fireRightNow = adWinFinishedEventArgs != null; if(!fireRightNow) { adWinFinishedEventArgs = new AdFinishedEventArgs(); } adWinFinishedEventArgs.IsCompletedView = bool.Parse( parts[0] ); adWinFinishedEventArgs.TimeWatched = timeWatched; adWinFinishedEventArgs.TotalDuration = totalDuration; if(fireRightNow) { OnAdFinishedEvent(adWinFinishedEventArgs); adWinFinishedEventArgs = null; } OnVideoViewEvent(timeWatched, totalDuration); } } if (e == "Diagnostic") { OnSDKLogEvent(arg); } }
public void AdsFinishCallback(AdFinishedEventArgs _event) { bool isComplete = _event.IsCompletedView; bool isAdsClicked = _event.WasCallToActionClicked; if (onAdsCallback != null) { onAdsCallback(isComplete, isAdsClicked); } Log("Ads Finish|isComplete: " + isComplete + "|isAdsClicked: " + isAdsClicked); }
static void adFinished(string placementID, AdFinishedEventArgs args) { if (onAdFinishedEvent != null) #if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO { VungleSceneLoom.Loom.QueueOnMainThread(() => { onAdFinishedEvent(placementID, args); }); } #else { onAdFinishedEvent(placementID, args); } #endif }
void OnVideoView(string param) { #if UNITY_ANDROID //param is not json string var parts = param.Split(new char[] { '-' }); if (parts.Length == 3) { double timeWatched = double.Parse(parts[1]) / 1000; double totalDuration = double.Parse(parts[2]) / 1000; bool fireRightNow = adFinishedEventArgs != null; if (!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } adFinishedEventArgs.IsCompletedView = bool.Parse(parts[0]); adFinishedEventArgs.TimeWatched = timeWatched; adFinishedEventArgs.TotalDuration = totalDuration; if (fireRightNow) { OnAdFinishedEvent(adFinishedEventArgs); adFinishedEventArgs = null; } OnVideoViewEvent(timeWatched, totalDuration); } #elif UNITY_IPHONE //param is the json string Dictionary <string, object> attrs = (Dictionary <string, object>)MiniJSONV.Json.Deserialize(param); bool didDownload = extractBoolValue(attrs, "didDownload"); bool isCompletedView = extractBoolValue(attrs, "completedView"); double timeWatched = double.Parse(attrs["playTime"].ToString()); // we fake the totalDuration and make it accurate only as far as if they completed it or not for iOS double totalDuration = isCompletedView ? timeWatched : timeWatched * 2; AdFinishedEventArgs args = new AdFinishedEventArgs(); args.WasCallToActionClicked = didDownload; args.IsCompletedView = isCompletedView; args.TimeWatched = timeWatched; args.TotalDuration = totalDuration; OnAdFinishedEvent(args); OnAdEndEvent(); OnVideoViewEvent(timeWatched, totalDuration); #elif UNITY_WSA_10_0 #endif }
/// <summary> /// Vungle specific event triggered every time a video is closed /// </summary> /// <param name="placementID"></param> /// <param name="status"></param> private void Vungle_onAdFinishedEvent(string placementID, AdFinishedEventArgs status) { if (placementID == rewardedPlacementId) { if (status.IsCompletedView) { if (OnCompleteMethod != null) { OnCompleteMethod(true); OnCompleteMethod = null; } if (OnCompleteMethodWithAdvertiser != null) { OnCompleteMethodWithAdvertiser(true, SupportedAdvertisers.Vungle.ToString()); OnCompleteMethodWithAdvertiser = null; } } else { if (OnCompleteMethod != null) { OnCompleteMethod(false); OnCompleteMethod = null; } if (OnCompleteMethodWithAdvertiser != null) { OnCompleteMethodWithAdvertiser(false, SupportedAdvertisers.Vungle.ToString()); OnCompleteMethodWithAdvertiser = null; } } Vungle.loadAd(rewardedPlacementId); } else { if (OnInterstitialClosed != null) { OnInterstitialClosed(); OnInterstitialClosed = null; } if (OnInterstitialClosedWithAdvertiser != null) { OnInterstitialClosedWithAdvertiser(SupportedAdvertisers.Vungle.ToString()); OnInterstitialClosedWithAdvertiser = null; } Vungle.loadAd(interstitialPlacementID); } }
private static void AdFinished(string placementId, AdFinishedEventArgs args) { VungleLog.Log(VungleLog.Level.Debug, VungleLog.Context.AdLifecycle, "SendOnAdFinishedEvent", string.Format("An ad finished displaying for {0}", placementId)); if (onAdFinishedEvent != null) { #if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleSceneLoom.Loom.QueueOnMainThread(() => { onAdFinishedEvent(placementId, args); }); #else onAdFinishedEvent(placementId, args); #endif } }
public static void onVungleAdFinished(AdFinishedEventArgs adFinishedEventArags) { if (adFinishedEventArags.IsCompletedView) { if (AdShowSucessed != null) { AdShowSucessed(); } } else { if (AdShowFailed != null) { AdShowFailed(); } } }
//methods only for android void OnAdEnd(string param) { AdFinishedEventArgs args = new AdFinishedEventArgs(); Dictionary <string, object> attrs = (Dictionary <string, object>)MiniJSONV.Json.Deserialize(param); #if UNITY_ANDROID args.WasCallToActionClicked = extractBoolValue(attrs, "wasCallToActionClicked"); args.IsCompletedView = extractBoolValue(attrs, "wasSuccessFulView"); args.TimeWatched = 0.0; #elif UNITY_IPHONE //param is the json string args.WasCallToActionClicked = extractBoolValue(attrs, "didDownload"); args.IsCompletedView = extractBoolValue(attrs, "completedView"); args.TimeWatched = double.Parse(attrs["playTime"].ToString()); #endif OnAdFinishedEvent(attrs["placementID"].ToString(), args); }
private void PlayEnd(string id, AdFinishedEventArgs args) { if (args.IsCompletedView) { if (PlayFinished != null) { PlayFinished(); } } else { if (PlayFailed != null) { PlayFailed(EAdsPlayFailedReason.NotWaitComplent); } } }
void onAdFinishedEvent(AdFinishedEventArgs arg) { AdController.Instance.isShow = false; Debug.Log("onAdFinishedEvent. watched: " + arg.TimeWatched + ", length: " + arg.TotalDuration + ", isCompletedView: " + arg.IsCompletedView); if (arg.IsCompletedView == true || arg.WasCallToActionClicked == true) { AdController.Instance.isSuccess = true; if (AdController.Instance.onAdShowEnd != null) { AdController.Instance.onAdShowEnd(); } } else { AdController.Instance.isFailed = true; } }
//methods only for android void OnAdEnd(string param) { bool fireRightNow = adFinishedEventArgs != null; if (!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } adFinishedEventArgs.WasCallToActionClicked = param.Equals("1"); if (fireRightNow) { OnAdFinishedEvent(adFinishedEventArgs); adFinishedEventArgs = null; } OnAdEndEvent(); }
/// <summary> /// 根据播放完成的事件来发送奖励 /// </summary> /// <param name="args">Arguments.</param> void AdFinished(AdFinishedEventArgs args) { if (args.WasCallToActionClicked) { //点击了下载按钮,奖励20灵魂石 _gameData.AddItem(22020000, 30); GetComponentInChildren <LogManager>().AddLog("You get 30 soulstones from the Magic Stone.", true); } else if (args.IsCompletedView) { //完成了播放,奖励10灵魂石 _gameData.AddItem(22020000, 15); GetComponentInChildren <LogManager>().AddLog("You get 15 soulstone from the Magic Stone.", true); } else { //未完成播放,没有奖励 _gameData.AddItem(22020000, 2); GetComponentInChildren <LogManager>().AddLog("You get 2 soulstone from the Magic Stone.", true); } }
private void OnAdFinished(string vungleId, AdFinishedEventArgs finishedEvent) { VungleAd vungleAd = FindVungleAd(vungleId); if (vungleAd.GetType() == typeof(VungleRewardedAd)) { if (finishedEvent.IsCompletedView) { OnRewardedAdCompleted(vungleAd.Placement); } else { OnRewardedAdSkipped(vungleAd.Placement); } return; } if (vungleAd.GetType() == typeof(InterstitialAdNetwork)) { OnInterstitialAdCompleted(vungleAd.Placement); return; } }
void HandleAdFinished(string placementID, AdFinishedEventArgs arg) { AdsMaster.OnCompletedReward(ID, arg.IsCompletedView); AdsMaster.OnDimissAd(AdType.Rewarded); }
void FinishHandler(object sender, AdFinishedEventArgs e) { OnAdFinished -= FinishHandler; _executor.Post(() => { _showAdCallbacks?.finishCallback(e.result); }); }
void onAdFinishedEvent(AdFinishedEventArgs arg) { Debug.Log("onAdFinishedEvent. watched: " + arg.TimeWatched + ", length: " + arg.TotalDuration + ", isCompletedView: " + arg.IsCompletedView); }
void OnVungleAdFinished(AdFinishedEventArgs args) { VideoAdFinishAction(); }
void OnVideoView( string param ) { #if UNITY_ANDROID //param is not json string var parts = param.Split( new char[] { '-' } ); if(parts.Length == 3 ) { double timeWatched = double.Parse( parts[1] ) / 1000; double totalDuration = double.Parse( parts[2] ) / 1000; bool fireRightNow = adFinishedEventArgs != null; if(!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } adFinishedEventArgs.IsCompletedView = bool.Parse( parts[0] ); adFinishedEventArgs.TimeWatched = timeWatched; adFinishedEventArgs.TotalDuration = totalDuration; if(fireRightNow) { OnAdFinishedEvent(adFinishedEventArgs); adFinishedEventArgs = null; } OnVideoViewEvent(timeWatched, totalDuration); } #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO //param is not json string var parts = param.Split( new char[] { '-' } ); if(parts.Length == 3 ) { double timeWatched = double.Parse( parts[1] ) / 1000; double totalDuration = double.Parse( parts[2] ) / 1000; bool fireRightNow = adFinishedEventArgs != null; if(!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } adFinishedEventArgs.IsCompletedView = bool.Parse( parts[0] ); adFinishedEventArgs.TimeWatched = timeWatched; adFinishedEventArgs.TotalDuration = totalDuration; if(fireRightNow) { OnAdFinishedEvent(adFinishedEventArgs); adFinishedEventArgs = null; } OnVideoViewEvent(timeWatched, totalDuration); } #elif UNITY_IPHONE //param is the json string Dictionary<string,object> attrs = (Dictionary<string,object>) MiniJSONV.Json.Deserialize( param ); bool didDownload = extractBoolValue(attrs,"didDownload"); bool isCompletedView = extractBoolValue(attrs,"completedView"); double timeWatched = double.Parse( attrs["playTime"].ToString() ); // we fake the totalDuration and make it accurate only as far as if they completed it or not for iOS double totalDuration = isCompletedView ? timeWatched : timeWatched * 2; AdFinishedEventArgs args = new AdFinishedEventArgs(); args.WasCallToActionClicked = didDownload; args.IsCompletedView = isCompletedView; args.TimeWatched = timeWatched; args.TotalDuration = totalDuration; OnAdFinishedEvent(args); OnAdEndEvent(); OnVideoViewEvent(timeWatched,totalDuration); #endif }
public static void onEvent(string e, string arg) { if (e == "OnAdStart") { OnAdStartEvent(); } if (e == "OnAdEnd") { bool fireRightNow = adWinFinishedEventArgs != null; if (!fireRightNow) { adWinFinishedEventArgs = new AdFinishedEventArgs(); } adWinFinishedEventArgs.WasCallToActionClicked = "1".Equals(arg); if (fireRightNow) { OnAdFinishedEvent(adWinFinishedEventArgs); adWinFinishedEventArgs = null; } OnAdEndEvent(); } if (e == "OnAdPlayableChanged") { if ("1".Equals(arg)) { OnCachedAdAvailableEvent(); } OnAdPlayableEvent("1".Equals(arg)); } if (e == "OnVideoView") { var parts = arg.Split(new char[] { ':' }); if (parts.Length == 3) { double timeWatched = double.Parse(parts[1]); double totalDuration = double.Parse(parts[2]); bool fireRightNow = adWinFinishedEventArgs != null; if (!fireRightNow) { adWinFinishedEventArgs = new AdFinishedEventArgs(); } adWinFinishedEventArgs.IsCompletedView = bool.Parse(parts[0]); adWinFinishedEventArgs.TimeWatched = timeWatched; adWinFinishedEventArgs.TotalDuration = totalDuration; if (fireRightNow) { OnAdFinishedEvent(adWinFinishedEventArgs); adWinFinishedEventArgs = null; } OnVideoViewEvent(timeWatched, totalDuration); } } if (e == "Diagnostic") { OnSDKLogEvent(arg); } }
static void adFinished(AdFinishedEventArgs args) { if(onAdFinishedEvent != null) onAdFinishedEvent(args); }
// Windows SDK calls this function public static void OnEvent(string sdkEvent, string arg) { switch (sdkEvent) { case "OnAdStart": // Placement if (OnAdStartEvent != null) { OnAdStartEvent(arg); } break; case "OnAdEnd": // CallToActionClicked:Placement:IsCompletedView:WatchedDuration(Milliseconds) if (OnAdFinishedEvent != null) { adWinFinishedEventArgs = new AdFinishedEventArgs(); var args = arg.Split(new char[] { ':' }); adWinFinishedEventArgs.WasCallToActionClicked = "1".Equals(args[0]); adWinFinishedEventArgs.IsCompletedView = bool.Parse(args[2]); adWinFinishedEventArgs.TimeWatched = double.Parse(args[3]) / 1000; OnAdFinishedEvent(args[1], adWinFinishedEventArgs); } break; case "OnAdPlayableChanged": // Playable(int):Placement if (OnAdPlayableEvent != null) { var args1 = arg.Split(new char[] { ':' }); OnAdPlayableEvent(args1[1], "1".Equals(args1[0])); } break; case "Diagnostic": // LogMessage if (OnSDKLogEvent != null) { OnSDKLogEvent(arg); } break; case "OnInitCompleted": // InitializeSuccess(int) if (OnSDKInitializeEvent != null && "1".Equals(arg)) { OnSDKInitializeEvent(); } break; case "OnError": if (OnErrorEvent != null) { OnErrorEvent(arg); } break; case "OnWarning": if (OnWarningEvent != null) { OnWarningEvent(arg); } break; default: VungleLog.Log(VungleLog.Level.Error, VungleLog.Context.LogEvent, "OnEvent", string.Format("nhandled SDK Event: {0}", sdkEvent)); break; } }
private void Vungle_onAdFinishedEvent(AdFinishedEventArgs args) { _isVideoReady = false; _OnFinished(args.IsCompletedView); Debug.Log("Vungle Ad Finished to play: " + args.IsCompletedView); }
//methods only for android void OnAdEnd(string param) { bool fireRightNow = adFinishedEventArgs != null; if(!fireRightNow) { adFinishedEventArgs = new AdFinishedEventArgs(); } adFinishedEventArgs.WasCallToActionClicked = param.Equals ("1"); if(fireRightNow) { OnAdFinishedEvent(adFinishedEventArgs); adFinishedEventArgs = null; } OnAdEndEvent(); }