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