123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using System;
- public class IronSource : IronSourceIAgent
- {
- private IronSourceIAgent _platformAgent ;
- private static IronSource _instance;
-
- private const string UNITY_PLUGIN_VERSION = "6.7.10";
- public const string GENDER_MALE = "male";
- public const string GENDER_FEMALE = "female";
- public const string GENDER_UNKNOWN = "unknown";
- private IronSource ()
- {
- #if UNITY_EDITOR
- _platformAgent = new UnsupportedPlatformAgent();
- #elif (UNITY_IPHONE || UNITY_IOS)
- _platformAgent = new iOSAgent();
- #elif UNITY_ANDROID
- _platformAgent = new AndroidAgent ();
- #endif
- }
- #region IronSourceIAgent implementation
- public static IronSource Agent {
- get {
- if (_instance == null) {
- _instance = new IronSource ();
- }
- return _instance;
- }
- }
- public static string pluginVersion ()
- {
- return UNITY_PLUGIN_VERSION;
- }
- public static string unityVersion ()
- {
- return Application.unityVersion;
- }
- public void reportAppStarted ()
- {
- _platformAgent.reportAppStarted ();
- }
- //******************* Base API *******************//
- public void onApplicationPause (bool pause)
- {
- _platformAgent.onApplicationPause (pause);
- }
-
- public void setAge (int age)
- {
- _platformAgent.setAge (age);
- }
-
- public void setGender (string gender)
- {
- if (gender.Equals (GENDER_MALE))
- _platformAgent.setGender (GENDER_MALE);
- else if (gender.Equals (GENDER_FEMALE))
- _platformAgent.setGender (GENDER_FEMALE);
- else if (gender.Equals (GENDER_UNKNOWN))
- _platformAgent.setGender (GENDER_UNKNOWN);
- }
- public void setMediationSegment (string segment)
- {
- _platformAgent.setMediationSegment (segment);
- }
- public string getAdvertiserId ()
- {
- return _platformAgent.getAdvertiserId ();
- }
-
- public void validateIntegration ()
- {
- _platformAgent.validateIntegration ();
- }
-
- public void shouldTrackNetworkState (bool track)
- {
- _platformAgent.shouldTrackNetworkState (track);
- }
- public bool setDynamicUserId (string dynamicUserId)
- {
- return _platformAgent.setDynamicUserId (dynamicUserId);
- }
- public void setAdaptersDebug(bool enabled)
- {
- _platformAgent.setAdaptersDebug (enabled);
- }
- //******************* SDK Init *******************//
- public void setUserId (string userId)
- {
- _platformAgent.setUserId (userId);
- }
- public void init (string appKey)
- {
- _platformAgent.init (appKey);
- }
- public void init (string appKey, params string[] adUnits)
- {
- _platformAgent.init (appKey, adUnits);
- }
- public void initISDemandOnly (string appKey, params string[] adUnits)
- {
- _platformAgent.initISDemandOnly (appKey, adUnits);
- }
- //******************* RewardedVideo API *******************//
-
- public void showRewardedVideo ()
- {
- _platformAgent.showRewardedVideo ();
- }
- public void showRewardedVideo (string placementName)
- {
- _platformAgent.showRewardedVideo (placementName);
- }
- public IronSourcePlacement getPlacementInfo (string placementName)
- {
- return _platformAgent.getPlacementInfo (placementName);
- }
- public bool isRewardedVideoAvailable ()
- {
- return _platformAgent.isRewardedVideoAvailable ();
- }
- public bool isRewardedVideoPlacementCapped (string placementName)
- {
- return _platformAgent.isRewardedVideoPlacementCapped (placementName);
- }
- public void setRewardedVideoServerParams(Dictionary<string, string> parameters)
- {
- _platformAgent.setRewardedVideoServerParams(parameters);
- }
- public void clearRewardedVideoServerParams()
- {
- _platformAgent.clearRewardedVideoServerParams();
- }
- //******************* RewardedVideo DemandOnly API *******************//
- public void showISDemandOnlyRewardedVideo (string instanceId)
- {
- _platformAgent.showISDemandOnlyRewardedVideo(instanceId);
- }
- public void showISDemandOnlyRewardedVideo (string instanceId, string placementName)
- {
- _platformAgent.showISDemandOnlyRewardedVideo(instanceId, placementName);
- }
- public bool isISDemandOnlyRewardedVideoAvailable (string instanceId)
- {
- return _platformAgent.isISDemandOnlyRewardedVideoAvailable(instanceId);
- }
- //******************* Interstitial API *******************//
- public void loadInterstitial ()
- {
- _platformAgent.loadInterstitial ();
- }
- public void showInterstitial ()
- {
- _platformAgent.showInterstitial ();
- }
-
- public void showInterstitial (string placementName)
- {
- _platformAgent.showInterstitial (placementName);
- }
- public bool isInterstitialReady ()
- {
- return _platformAgent.isInterstitialReady ();
- }
- public bool isInterstitialPlacementCapped (string placementName)
- {
- return _platformAgent.isInterstitialPlacementCapped (placementName);
- }
- //******************* Interstitial DemandOnly API *******************//
- public void loadISDemandOnlyInterstitial (string instanceId)
- {
- _platformAgent.loadISDemandOnlyInterstitial(instanceId);
- }
- public void showISDemandOnlyInterstitial (string instanceId)
- {
- _platformAgent.showISDemandOnlyInterstitial(instanceId);
- }
- public void showISDemandOnlyInterstitial (string instanceId, string placementName)
- {
- _platformAgent.showISDemandOnlyInterstitial(instanceId, placementName);
- }
- public bool isISDemandOnlyInterstitialReady (string instanceId)
- {
- return _platformAgent.isISDemandOnlyInterstitialReady(instanceId);
- }
-
- //******************* Offerwall API *******************//
- public void showOfferwall ()
- {
- _platformAgent.showOfferwall ();
- }
- public void showOfferwall (string placementName)
- {
- _platformAgent.showOfferwall (placementName);
- }
- public void getOfferwallCredits ()
- {
- _platformAgent.getOfferwallCredits ();
- }
-
- public bool isOfferwallAvailable ()
- {
- return _platformAgent.isOfferwallAvailable ();
- }
- //******************* Banner API *******************//
- public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position)
- {
- _platformAgent.loadBanner (size, position);
- }
-
- public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position, string placementName)
- {
- _platformAgent.loadBanner (size, position, placementName);
- }
-
- public void destroyBanner()
- {
- _platformAgent.destroyBanner ();
- }
- public void displayBanner()
- {
- _platformAgent.displayBanner ();
- }
- public void hideBanner()
- {
- _platformAgent.hideBanner ();
- }
- public bool isBannerPlacementCapped(string placementName)
- {
- return _platformAgent.isBannerPlacementCapped (placementName);
- }
- public void setSegment(IronSourceSegment segment)
- {
- _platformAgent.setSegment (segment);
- }
- public void setConsent(bool consent)
- {
- _platformAgent.setConsent(consent);
- }
-
- #endregion
- }
|