parent
							
								
									e33b2ae024
								
							
						
					
					
						commit
						7867db4655
					
				|  | @ -22,7 +22,6 @@ namespace Guru | |||
|         private const string DefaultCategory = "Store"; | ||||
| 
 | ||||
|         private static bool _showLog; | ||||
|         private static string _uuid; | ||||
|          | ||||
|         private ConfigurationBuilder _configBuilder; // 商店配置创建器 | ||||
|          | ||||
|  | @ -70,6 +69,7 @@ namespace Guru | |||
| 
 | ||||
|         private byte[] _googlePublicKey; | ||||
|         private byte[] _appleRootCert; | ||||
|         private string _uid; | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 服务初始化回调 | ||||
|  | @ -133,9 +133,11 @@ namespace Guru | |||
|         /// <summary> | ||||
|         /// 初始化支付服务 | ||||
|         /// </summary> | ||||
|         public virtual void Initialize(string uuid, bool showLog = false) | ||||
|         public virtual void Initialize(string uid, bool showLog = false) | ||||
|         { | ||||
|             _uuid = uuid; | ||||
|              | ||||
|             if (string.IsNullOrEmpty(uid)) uid = IPMConfig.IPM_UID; | ||||
|             _uid = uid; | ||||
|             _showLog = showLog; | ||||
|             InitPurchasing(); | ||||
|         } | ||||
|  | @ -147,12 +149,12 @@ namespace Guru | |||
|         /// <param name="googlePublicKey"></param> | ||||
|         /// <param name="appleRootCert"></param> | ||||
|         /// <param name="showLog"></param> | ||||
|         public virtual void InitWithKeys(string uuid, byte[] googlePublicKey, byte[] appleRootCert, bool showLog = false) | ||||
|         public virtual void InitWithKeys(string uid, byte[] googlePublicKey, byte[] appleRootCert, bool showLog = false) | ||||
|         { | ||||
|             _googlePublicKey = googlePublicKey; | ||||
|             _appleRootCert = appleRootCert; | ||||
|             InitModel(); | ||||
|             Initialize(uuid, showLog); | ||||
|             Initialize(uid, showLog); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  | @ -229,13 +231,14 @@ namespace Guru | |||
|         { | ||||
|             _storeController = controller; | ||||
|             _storeExtensionProvider = extensions; | ||||
|             if (string.IsNullOrEmpty(_uuid)) _uuid = IPMConfig.IPM_DEVICE_ID; | ||||
|           | ||||
|             LogI($"--- IAP Initialized Success. With UID: {_uuid}"); | ||||
|             var uuid = IPMConfig.IPM_DEVICE_ID; | ||||
|             if(string.IsNullOrEmpty(_uid)) _uid = IPMConfig.IPM_UID; | ||||
|              | ||||
|             LogI($"--- IAP Initialized Success. With UID: {_uid} and UUID: {uuid}"); | ||||
| 
 | ||||
| #if UNITY_IOS | ||||
|             _appleExtensions = extensions.GetExtension<IAppleExtensions>(); | ||||
|             _appleExtensions.SetApplicationUsername(_uuid);  // SetUp UID | ||||
|             _appleExtensions.SetApplicationUsername(uuid);  // SetUp UUID (8)-(4)-(4)-(12): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||||
|             // On Apple platforms we need to handle deferred purchases caused by Apple's Ask to Buy feature. | ||||
|             // On non-Apple platforms this will have no effect; OnDeferred will never be called. | ||||
|             _appleExtensions.RegisterPurchaseDeferredListener(item => | ||||
|  | @ -244,7 +247,7 @@ namespace Guru | |||
|                 OnAppStorePurchaseDeferred?.Invoke(item); | ||||
|             }); | ||||
| #elif UNITY_ANDROID | ||||
|             _configBuilder.Configure<IGooglePlayConfiguration>().SetObfuscatedAccountId(_uuid); // SetUp UID | ||||
|             _configBuilder.Configure<IGooglePlayConfiguration>().SetObfuscatedAccountId(_uid); // SetUp UID | ||||
|             _googlePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>(); | ||||
|             //添加安装游戏后第一次初试化进行恢复购买的回调 只有安卓才有 | ||||
|             _googlePlayStoreExtensions.RestoreTransactions(OnRestoreHandle); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue