parent
							
								
									2a895b370e
								
							
						
					
					
						commit
						660303e45d
					
				|  | @ -79,7 +79,7 @@ namespace Guru | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// 初始化平台 |         /// 初始化平台 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public void Initialize() |         public void Initialize(bool isDebug = false) | ||||||
|         { |         { | ||||||
| #if UNITY_EDITOR | #if UNITY_EDITOR | ||||||
|             Debug.Log($"<color=orange>=== Amazon will not init on Editor ===</color>"); |             Debug.Log($"<color=orange>=== Amazon will not init on Editor ===</color>"); | ||||||
|  | @ -93,11 +93,8 @@ namespace Guru | ||||||
|             // 初始化Amazon |             // 初始化Amazon | ||||||
|             Amazon.Initialize (AmazonAppID); |             Amazon.Initialize (AmazonAppID); | ||||||
|             Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX)); |             Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX)); | ||||||
| #if UNITY_EDITOR || DEBUG  |             Amazon.EnableTesting (isDebug); // Make sure to take this off when going live. | ||||||
|             Amazon.EnableTesting (true); // Make sure to take this off when going live. |             Amazon.EnableLogging (isDebug); | ||||||
| #else |  | ||||||
|             Amazon.EnableLogging (false); |  | ||||||
| #endif |  | ||||||
| 		 | 		 | ||||||
| #if UNITY_IOS | #if UNITY_IOS | ||||||
|             Amazon.SetAPSPublisherExtendedIdFeatureEnabled(true); |             Amazon.SetAPSPublisherExtendedIdFeatureEnabled(true); | ||||||
|  |  | ||||||
|  | @ -50,7 +50,7 @@ namespace Guru | ||||||
|          * before it can request an ad using OpenWrap SDK. |          * before it can request an ad using OpenWrap SDK. | ||||||
|          * The storeURL is the URL where users can download your app from the App Store/Google Play Store. |          * The storeURL is the URL where users can download your app from the App Store/Google Play Store. | ||||||
|          */ |          */ | ||||||
|         public void Initialize() |         public void Initialize(bool isDebug = false) | ||||||
|         { |         { | ||||||
| #if UNITY_EDITOR | #if UNITY_EDITOR | ||||||
|             Debug.Log($"<color=orange>=== PubMatic will not init on Editor ===</color>"); |             Debug.Log($"<color=orange>=== PubMatic will not init on Editor ===</color>"); | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ namespace Guru | ||||||
|         protected override void InitService() |         protected override void InitService() | ||||||
|         { |         { | ||||||
| 	        base.InitService(); | 	        base.InitService(); | ||||||
| 	        InitChannels();  // 启动各广告渠道代理 | 	        InitChannels(_isDebug);  // 启动各广告渠道代理 | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
| 		#endregion | 		#endregion | ||||||
|  | @ -37,14 +37,14 @@ namespace Guru | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// 各渠道初始化 |         /// 各渠道初始化 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         private void InitChannels() |         private void InitChannels(bool isDebug) | ||||||
|         { |         { | ||||||
|         	_adChannels = new HashSet<IAdChannel>(); |         	_adChannels = new HashSet<IAdChannel>(); | ||||||
|         	IAdChannel channel = null; |         	IAdChannel channel = null; | ||||||
|             _asyncLoader = null; |             _asyncLoader = null; | ||||||
|         	 |         	 | ||||||
|         	_chanelMax = new AdChanelMax(); // 默认持有MAXChannel |         	_chanelMax = new AdChanelMax(); // 默认持有MAXChannel | ||||||
|             _chanelMax.Initialize(); |             _chanelMax.Initialize(isDebug); | ||||||
|             if(_initSpec != null) _chanelMax.SetBannerBackColor(_initSpec.bannerColorHex); |             if(_initSpec != null) _chanelMax.SetBannerBackColor(_initSpec.bannerColorHex); | ||||||
|              |              | ||||||
|         	//------------ 以下为扩展的广告渠道 ------------------ |         	//------------ 以下为扩展的广告渠道 ------------------ | ||||||
|  | @ -52,7 +52,7 @@ namespace Guru | ||||||
|             // 开启渠道需要添加对应的宏 |             // 开启渠道需要添加对应的宏 | ||||||
|              |              | ||||||
|         	channel = new AdChanelAmazon(); |         	channel = new AdChanelAmazon(); | ||||||
|         	channel.Initialize(); |         	channel.Initialize(isDebug); | ||||||
|         	_adChannels.Add(channel); // Amazon |         	_adChannels.Add(channel); // Amazon | ||||||
|             _asyncLoader = channel as IAsyncRequestChannel; |             _asyncLoader = channel as IAsyncRequestChannel; | ||||||
|             if (_asyncLoader != null) |             if (_asyncLoader != null) | ||||||
|  |  | ||||||
|  | @ -49,6 +49,7 @@ namespace Guru | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         internal bool _isDebug = false; | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// 启动广告服务 |         /// 启动广告服务 | ||||||
|  | @ -61,20 +62,22 @@ namespace Guru | ||||||
|             if (IsInitialized) return; // 已经初始化后, 无需再次初始化 |             if (IsInitialized) return; // 已经初始化后, 无需再次初始化 | ||||||
| 
 | 
 | ||||||
|             _initSpec = initSpec; |             _initSpec = initSpec; | ||||||
|  |             if (_initSpec == null) _initSpec = AdsInitSpec.BuildDefault(); | ||||||
|  |              | ||||||
|  |             _isDebug = _initSpec.isDebug; | ||||||
|             _isServiceStarted = true; |             _isServiceStarted = true; | ||||||
|             _onSdkInitReady = callback; |             _onSdkInitReady = callback; | ||||||
|             if(_model == null) _model = AdsModel.Create(); |             if(_model == null) _model = AdsModel.Create(); | ||||||
|             this.Log("AD SDK Start Init"); |             this.Log("AD SDK Start Init"); | ||||||
| 
 | 
 | ||||||
|             InitMaxAds(); // 初始化 MAX 广告 |             InitMaxCallbacks(); // 初始化 MAX 广告 | ||||||
|              |  | ||||||
|             InitService(); // 内部继承接口 |             InitService(); // 内部继承接口 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// 初始化 MAX 广告组件 |         /// 初始化 MAX 广告组件 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         private void InitMaxAds() |         private void InitMaxCallbacks() | ||||||
|         { |         { | ||||||
|             //--------------  初始化回调 ------------------ |             //--------------  初始化回调 ------------------ | ||||||
|             MaxSdkCallbacks.OnSdkInitializedEvent += OnMaxSdkInitializedCallBack; |             MaxSdkCallbacks.OnSdkInitializedEvent += OnMaxSdkInitializedCallBack; | ||||||
|  | @ -103,8 +106,6 @@ namespace Guru | ||||||
|             MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent += OnRewardedAdReceivedRewardEvent; |             MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent += OnRewardedAdReceivedRewardEvent; | ||||||
| 
 | 
 | ||||||
|             //-------------- SDK 初始化 ------------------- |             //-------------- SDK 初始化 ------------------- | ||||||
|             if (_initSpec == null) _initSpec = AdsInitSpec.BuildDefault(); |  | ||||||
|             MaxSdk.SetVerboseLogging(_initSpec.isDebug); |  | ||||||
|             MaxSdk.SetExtraParameter("enable_black_screen_fixes", "true"); // 修复黑屏 |             MaxSdk.SetExtraParameter("enable_black_screen_fixes", "true"); // 修复黑屏 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,10 +32,11 @@ namespace Guru | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// MAX 渠道初始化, 启动服务 |         /// MAX 渠道初始化, 启动服务 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public void Initialize() |         public void Initialize(bool isDebug = false) | ||||||
|         { |         { | ||||||
|             MaxSdk.SetSdkKey(GuruSettings.Instance.ADSetting.SDK_KEY); |             MaxSdk.SetSdkKey(GuruSettings.Instance.ADSetting.SDK_KEY); | ||||||
|             MaxSdk.SetUserId(IPMConfig.IPM_UID);  // 上报用户ID |             MaxSdk.SetUserId(IPMConfig.IPM_UID);  // 上报用户ID | ||||||
|  |             MaxSdk.SetVerboseLogging(isDebug); // 设置调试数据 | ||||||
|             MaxSdk.InitializeSdk(); |             MaxSdk.InitializeSdk(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ namespace Guru | ||||||
|     { |     { | ||||||
|         // Action<string> OnRequestOver { get; set; } |         // Action<string> OnRequestOver { get; set; } | ||||||
| 
 | 
 | ||||||
|         void Initialize(); |         void Initialize(bool isDebug = false); | ||||||
|          |          | ||||||
|         string Name { get;} |         string Name { get;} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue