Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class VungleManaher : MonoBehaviour {
- string appID = "";
- string windowsAppID = "5a031ad33affebb9040046cf";
- #if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO || UNITY_5_5_3
- string placementID = "DEFAULT39144";
- #endif
- public Text texts;
- private void Awake()
- {
- #if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO || UNITY_5_5_3
- appID = windowsAppID;
- Dictionary<string, bool> placements = new Dictionary<string, bool>
- {
- { placementID, false }
- };
- #endif
- string[] array = new string[placements.Keys.Count];
- placements.Keys.CopyTo(array, 0);
- Vungle.init(appID, array);
- TextShow ();
- }
- void Start()
- {
- StartCoroutine (WaitLoadAd());
- Debug.Log ("Ads load");
- }
- IEnumerator WaitLoadAd()
- {
- yield return new WaitForSeconds (5f);
- Vungle.loadAd (placementID);
- }
- public void TextShow()
- {
- texts.text = "Button Is Work!".ToString();
- Vungle.playAd (placementID);
- initializeEventHandlers ();
- }
- void initializeEventHandlers() {
- Vungle.onAdStartedEvent += (placementID) => {
- texts.text =("Ad " + placementID + " is starting! Pause your game animation or sound here.");
- };
- Vungle.onAdFinishedEvent += (placementID, args) => {
- texts.text= ("Ad finished - placementID " + placementID + ", was call to action clicked:" + args.WasCallToActionClicked + ", is completed view:"
- + args.IsCompletedView);
- };
- Vungle.adPlayableEvent += (placementID, adPlayable) => {
- texts.text =("Ad's playable state has been changed! placementID " + placementID + ". Now: " + adPlayable);
- };
- Vungle.onLogEvent += (log) => {
- texts.text = ("Log: " + log);
- };
- Vungle.onInitializeEvent += () => {
- //adInited = true;
- texts.text = ("SDK initialized");
- };
- }
- }
Add Comment
Please, Sign In to add comment