public void RegisterGameObjectForImpression(GameObject gameObject, Button[] clickableButtons, Camera camera) { // Register click handler foreach (Button button in clickableButtons) { button.onClick.RemoveAllListeners(); button.onClick.AddListener(delegate() { AdLogger.Log("Native ad with unique id " + this.uniqueId + " clicked!"); this.ExternalClick(); }); } // Release the current handler and register for new handler // Whether or not the currentl handler has finished impression validation, // start the impression validation for the new handler. if (this.handler) { this.handler.stopImpressionValidation(); this.handler.removeFromParent(); this.createHandler(camera, gameObject); this.handler.startImpressionValidation(); } else { this.createHandler(camera, gameObject); } }
public void RegisterGameObjectForImpression(GameObject gameObject, UIButton[] clickableButtons, Camera camera) { foreach (UIButton button in clickableButtons) { button.onClick.Clear(); button.onClick.Add(new EventDelegate(delegate() { AdLogger.Log("Native ad with unique id " + this.uniqueId + " clicked!"); this.ExternalClick(); })); } this.createHandler(camera, gameObject); }
public void RegisterGameObjectForImpression(GameObject gameObject, Button[] clickableButtons, Camera camera) { // Register click handler foreach (Button button in clickableButtons) { button.onClick.AddListener(delegate() { AdLogger.Log("Native ad clicked!"); this.ExternalClick(); }); } this.createHandler(camera, gameObject); }
private void createHandler(Camera camera, GameObject gameObject) { this.handler = gameObject.AddComponent <NativeAdHandler> (); this.handler.camera = camera; this.handler.minAlpha = NativeAd.MIN_ALPHA; this.handler.maxRotation = NativeAd.MAX_ROTATION; this.handler.checkViewabilityInterval = NativeAd.CHECK_VIEWABILITY_INTERVAL; this.handler.validationCallback = (delegate(bool success) { Debug.Log("Native ad viewability check for unique id " + this.uniqueId + " returned success? " + success); if (success) { AdLogger.Log("Native ad with unique id " + this.uniqueId + " registered impression!"); this.ExternalLogImpression(); this.handler.stopImpressionValidation(); } }); }
private void createHandler(Camera camera, GameObject gameObject) { handler = gameObject.AddComponent <NativeAdHandler>(); handler.camera = camera; handler.minAlpha = 0.9f; handler.maxRotation = 45; handler.checkViewabilityInterval = 1; handler.validationCallback = delegate(bool success) { UnityEngine.Debug.Log("Native ad viewability check for unique id " + uniqueId + " returned success? " + success); if (success) { AdLogger.Log("Native ad with unique id " + uniqueId + " registered impression!"); ExternalLogImpression(); handler.stopImpressionValidation(); } }; }
public void RegisterGameObjectForImpression(GameObject gameObject, Button[] clickableButtons, Camera camera) { foreach (Button button in clickableButtons) { button.onClick.RemoveAllListeners(); button.onClick.AddListener(delegate { AdLogger.Log("Native ad with unique id " + uniqueId + " clicked!"); ExternalClick(); }); } if ((bool)handler) { handler.stopImpressionValidation(); handler.removeFromParent(); createHandler(camera, gameObject); handler.startImpressionValidation(); } else { createHandler(camera, gameObject); } }