fenix il y a 8 ans
Parent
commit
c8db8d9a74
42 fichiers modifiés avec 374 ajouts et 66 suppressions
  1. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/AmazonAppStore.aar
  2. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar
  3. 10 3
      Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar.meta
  4. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/GoogleAIDL.aar
  5. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/GooglePlay.aar
  6. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/SamsungApps.aar
  7. BIN
      Assets/Plugins/UnityPurchasing/Bin/Android/common.aar
  8. BIN
      Assets/Plugins/UnityPurchasing/Bin/Apple/Apple.dll
  9. BIN
      Assets/Plugins/UnityPurchasing/Bin/Apple/live/Apple.dll
  10. BIN
      Assets/Plugins/UnityPurchasing/Bin/Common.dll
  11. BIN
      Assets/Plugins/UnityPurchasing/Bin/Editor.dll
  12. BIN
      Assets/Plugins/UnityPurchasing/Bin/Security.dll
  13. BIN
      Assets/Plugins/UnityPurchasing/Bin/Stores.dll
  14. BIN
      Assets/Plugins/UnityPurchasing/Bin/Tizen/Tizen.dll
  15. BIN
      Assets/Plugins/UnityPurchasing/Bin/Tizen/libTizenStore.so
  16. BIN
      Assets/Plugins/UnityPurchasing/Bin/Tizen/live/Tizen.dll
  17. 5 5
      Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Info.plist
  18. 2 2
      Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Info.plist.meta
  19. BIN
      Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/MacOS/unitypurchasing
  20. 2 2
      Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/MacOS/unitypurchasing.meta
  21. 2 2
      Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Resources/en.lproj/InfoPlist.strings.meta
  22. 32 0
      Assets/Plugins/UnityPurchasing/Changelog.md
  23. 1 1
      Assets/Plugins/UnityPurchasing/ETag
  24. 20 17
      Assets/Plugins/UnityPurchasing/Editor/IAPButtonEditor.cs
  25. 9 0
      Assets/Plugins/UnityPurchasing/Icons.meta
  26. BIN
      Assets/Plugins/UnityPurchasing/Icons/UnityEngine.Purchasing.IAPButtonIcon.png
  27. 59 0
      Assets/Plugins/UnityPurchasing/Icons/UnityEngine.Purchasing.IAPButtonIcon.png.meta
  28. 9 0
      Assets/Plugins/UnityPurchasing/generated.meta
  29. 16 0
      Assets/Plugins/UnityPurchasing/generated/AppleTangle.cs
  30. 12 0
      Assets/Plugins/UnityPurchasing/generated/AppleTangle.cs.meta
  31. 1 0
      Assets/Plugins/UnityPurchasing/script/Demo/DemoInventory.cs
  32. 86 27
      Assets/Plugins/UnityPurchasing/script/IAPButton.cs
  33. 2 1
      Assets/Plugins/UnityPurchasing/script/IAPButton.cs.meta
  34. 31 4
      Assets/Plugins/UnityPurchasing/script/IAPDemo.cs
  35. 3 0
      Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs
  36. 12 0
      Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs.meta
  37. BIN
      Assets/Plugins/UnityPurchasing/winrt/live/winrt.dll
  38. BIN
      Assets/Scenes/Battle.unity
  39. 2 1
      Assets/Scripts/Config.cs
  40. 58 1
      Assets/Scripts/UI/Shop/PaymentManager.cs
  41. BIN
      Keys/qjh.kdb
  42. BIN
      Keys/qjh.kdb.lock

BIN
Assets/Plugins/UnityPurchasing/Bin/Android/AmazonAppStore.aar


BIN
Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar


+ 10 - 3
Assets/Plugins/UnityPurchasing/Bin/Android/CloudMoolah.aar.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: 251857e86b1324e8aa526ab740a50647
-timeCreated: 1480722470
+guid: b43266f2885014b678ad6d4f97e97243
+timeCreated: 1487022644
 licenseType: Pro
 PluginImporter:
   serializedVersion: 1
@@ -8,9 +8,16 @@ PluginImporter:
   executionOrder: {}
   isPreloaded: 0
   platformData:
-    Any:
+    Android:
       enabled: 1
       settings: {}
+    Any:
+      enabled: 0
+      settings: {}
+    Editor:
+      enabled: 0
+      settings:
+        DefaultValueInitialized: true
   userData: 
   assetBundleName: 
   assetBundleVariant: 

BIN
Assets/Plugins/UnityPurchasing/Bin/Android/GoogleAIDL.aar


BIN
Assets/Plugins/UnityPurchasing/Bin/Android/GooglePlay.aar


BIN
Assets/Plugins/UnityPurchasing/Bin/Android/SamsungApps.aar


BIN
Assets/Plugins/UnityPurchasing/Bin/Android/common.aar


BIN
Assets/Plugins/UnityPurchasing/Bin/Apple/Apple.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Apple/live/Apple.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Common.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Editor.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Security.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Stores.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Tizen/Tizen.dll


BIN
Assets/Plugins/UnityPurchasing/Bin/Tizen/libTizenStore.so


BIN
Assets/Plugins/UnityPurchasing/Bin/Tizen/live/Tizen.dll


+ 5 - 5
Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Info.plist

@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
 	<key>BuildMachineOSBuild</key>
-	<string>16B2555</string>
+	<string>16D32</string>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>English</string>
 	<key>CFBundleExecutable</key>
@@ -47,17 +47,17 @@
 	<key>DTCompiler</key>
 	<string>com.apple.compilers.llvm.clang.1_0</string>
 	<key>DTPlatformBuild</key>
-	<string>8B62</string>
+	<string>8C1002</string>
 	<key>DTPlatformVersion</key>
 	<string>GM</string>
 	<key>DTSDKBuild</key>
-	<string>16B2649</string>
+	<string>16C58</string>
 	<key>DTSDKName</key>
 	<string>macosx10.12</string>
 	<key>DTXcode</key>
-	<string>0810</string>
+	<string>0821</string>
 	<key>DTXcodeBuild</key>
-	<string>8B62</string>
+	<string>8C1002</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2013 Alex McAusland. All rights reserved.</string>
 </dict>

+ 2 - 2
Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Info.plist.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: e0f933c87ea0a45cdabe36d7d7844158
-timeCreated: 1480722461
+guid: 6e4c351d26b1f41039fb193808aa4e7e
+timeCreated: 1487022635
 licenseType: Pro
 DefaultImporter:
   userData: 

BIN
Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/MacOS/unitypurchasing


+ 2 - 2
Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/MacOS/unitypurchasing.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: 0dca0b7328daf45fc9a21a4c00ddad1a
-timeCreated: 1480722461
+guid: 9ed33c2e0ffbe4a51bef0dc38008c5d9
+timeCreated: 1487022635
 licenseType: Pro
 DefaultImporter:
   userData: 

+ 2 - 2
Assets/Plugins/UnityPurchasing/Bin/unitypurchasing.bundle/Contents/Resources/en.lproj/InfoPlist.strings.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: fad671684f1e64f41a896aab016c3d59
-timeCreated: 1480722461
+guid: fd8a02044b62e43668a37aae2494f138
+timeCreated: 1487022635
 licenseType: Pro
 DefaultImporter:
   userData: 

+ 32 - 0
Assets/Plugins/UnityPurchasing/Changelog.md

@@ -1,3 +1,35 @@
+## [1.10.0] - 2017-01-23
+### Added
+- Samsung Galaxy Apps - In-App Purchase SDK v4. Simplifies flow for first-time payment users. See [Samsung Developer IAP Documentation](http://developer.samsung.com/iap) for more.
+- Tizen Store - Add support for subscriptions
+- StandardPurchasingModule - Add `bool useFakeStoreAlways` property to override native stores with the local debug FakeStore for rapid prototyping. Will not connect to any App Store when enabled.
+
+```csharp
+// Enable the FakeStore for all IAP activity
+var module = StandardPurchasingModule.Instance();
+module.useFakeStoreAlways = true;
+```
+
+* Editor Updater - Notify the developer when updates to Unity IAP are available with an actionable dialog. Periodically check the Asset Store version and prompt with an upgrade dialog capable of downloading the latest plugin.
+* Editor Installer - Simplify integration of Unity IAP into a Project, avoiding unexpected breakage of the scripting build environment after package installation. Detect and warn if Unity IAP Core Service is "Off" during installation.
+
+### Removed
+- Samsung Galaxy Apps - remove In-App Purchase SDK v3 and replaced with v4, above.
+
+### Fixed
+- GooglePlay - Fix a problem that occurred when suspending the application during a successful transaction. Previously a consumable product could get stuck in a state where it could not be purchased again until the Google Play cache was cleared.
+
+## [1.9.3] - 2017-01-03
+### Added
+- Windows Store - support for UWP apps running while logged-out of Windows Store. Now fetches app's product metadata if logged out, and requests user sign in to make purchase or to fetch user's purchase history.
+- Editor - diagnostic log at build-time when IAP Service disabled: "Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window." Fewer redundant errors.
+
+### Fixed
+- Editor - checkmarks refresh for Targeted Android Store after Editor Play/Stop
+- Editor - hides spurious Component MenuItems
+- Linux Editor - BillingMode.json path case-sensitivity 
+- IAP Catalog - clearer text for Export button: "App Store Export"
+
 ## [1.9.2] - 2016-11-29
 ### Fixed
 - GooglePlay - addresses warning about usage of WebViewClient.onReceivedSslError if CloudMoolah.aar is included

+ 1 - 1
Assets/Plugins/UnityPurchasing/ETag

@@ -1 +1 @@
-"9b4edb801cc99cc963849b9bdcc91db1"
+"8c6b0f4bcf82b278aa4cc1f8d5985c69"

+ 20 - 17
Assets/Plugins/UnityPurchasing/Editor/IAPButtonEditor.cs

@@ -37,6 +37,7 @@ namespace UnityEngine.Purchasing
 	public class IAPButtonEditor : Editor 
 	{
 		private static readonly string[] excludedFields = new string[] { "m_Script" };
+		private static readonly string[] restoreButtonExcludedFields = new string[] { "m_Script", "consumePurchase", "onPurchaseComplete", "onPurchaseFailed", "titleText", "descriptionText", "priceText" };
 		private const string kNoProduct = "<None>";
 
 		private List<string> m_ValidIDs = new List<string>();
@@ -53,29 +54,31 @@ namespace UnityEngine.Purchasing
 
 			serializedObject.Update();
 
-			EditorGUILayout.LabelField(new GUIContent("Product ID:", "Select a product from the IAP catalog"));
+			if (button.buttonType == IAPButton.ButtonType.Purchase) {
+				EditorGUILayout.LabelField(new GUIContent("Product ID:", "Select a product from the IAP catalog"));
 
-			var catalog = ProductCatalog.LoadDefaultCatalog();
+				var catalog = ProductCatalog.LoadDefaultCatalog();
 
-			m_ValidIDs.Clear();
-			m_ValidIDs.Add(kNoProduct);
-			foreach (var product in catalog.allProducts) {
-				m_ValidIDs.Add(product.id);
-			}
+				m_ValidIDs.Clear();
+				m_ValidIDs.Add(kNoProduct);
+				foreach (var product in catalog.allProducts) {
+					m_ValidIDs.Add(product.id);
+				}
 
-			int currentIndex = string.IsNullOrEmpty(button.productId) ? 0 : m_ValidIDs.IndexOf(button.productId);
-			int newIndex = EditorGUILayout.Popup(currentIndex, m_ValidIDs.ToArray());
-			if (newIndex > 0 && newIndex < m_ValidIDs.Count) {
-				m_ProductIDProperty.stringValue = m_ValidIDs[newIndex];
-			} else {
-				m_ProductIDProperty.stringValue = string.Empty;
-			}
+				int currentIndex = string.IsNullOrEmpty(button.productId) ? 0 : m_ValidIDs.IndexOf(button.productId);
+				int newIndex = EditorGUILayout.Popup(currentIndex, m_ValidIDs.ToArray());
+				if (newIndex > 0 && newIndex < m_ValidIDs.Count) {
+					m_ProductIDProperty.stringValue = m_ValidIDs[newIndex];
+				} else {
+					m_ProductIDProperty.stringValue = string.Empty;
+				}
 
-			if (GUILayout.Button("IAP Catalog...")) {
-				ProductCatalogEditor.ShowWindow();
+				if (GUILayout.Button("IAP Catalog...")) {
+					ProductCatalogEditor.ShowWindow();
+				}
 			}
 			
-			DrawPropertiesExcluding(serializedObject, excludedFields);
+			DrawPropertiesExcluding(serializedObject, button.buttonType == IAPButton.ButtonType.Restore ? restoreButtonExcludedFields : excludedFields);
 
 			serializedObject.ApplyModifiedProperties();
 		}

+ 9 - 0
Assets/Plugins/UnityPurchasing/Icons.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 39bcd3ac60831463b9c857f2631befc6
+folderAsset: yes
+timeCreated: 1479509368
+licenseType: Free
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Plugins/UnityPurchasing/Icons/UnityEngine.Purchasing.IAPButtonIcon.png


+ 59 - 0
Assets/Plugins/UnityPurchasing/Icons/UnityEngine.Purchasing.IAPButtonIcon.png.meta

@@ -0,0 +1,59 @@
+fileFormatVersion: 2
+guid: 55e457740fe60405dac77af143e1a867
+timeCreated: 1479509804
+licenseType: Free
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 2
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    linearTexture: 0
+    correctGamma: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 0
+  cubemapConvolution: 0
+  cubemapConvolutionSteps: 7
+  cubemapConvolutionExponent: 1.5
+  seamlessCubemap: 0
+  textureFormat: -1
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: -1
+  nPOTScale: 1
+  lightmap: 0
+  rGBM: 0
+  compressionQuality: 50
+  allowsAlphaSplitting: 0
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: -1
+  buildTargetSettings: []
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+  spritePackingTag: 
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Plugins/UnityPurchasing/generated.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 04ee3d347b68a3d43820c1aa79dd1b3f
+folderAsset: yes
+timeCreated: 1490840964
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Assets/Plugins/UnityPurchasing/generated/AppleTangle.cs

@@ -0,0 +1,16 @@
+#if UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_TVOS
+// WARNING: Do not modify! Generated file.
+
+namespace UnityEngine.Purchasing.Security {
+    public class AppleTangle
+    {
+        private static byte[] data = System.Convert.FromBase64String("wcbFwMTHwq7j+cfBxMbEzcbFwMTixODy96Hw9+f5tYSEmJHUppubgNq0UgOzuYv8qsTr8veh6dfw7MTijsR29YLE+vL3oen79fUL8PD39vV29fTy/d5yvHIDl5Dx9cR1BsTe8snSk9R+x54D+XY7Kh9X2w2nnq+Q1Le1xHb11sT58v3ecrxyA/n19fXecrxyA/n19fHx9MSWxf/E/fL3oYCcm4adgI3F4sTg8veh8Pfn+bWEmJHUvZqX2sXSxNDy96Hw/+fptYTEdvBPxHb3V1T39vX29vX2xPny/XuHdZQy76/922ZGDLC8BJTMauEBppGYnZWal5HUm5rUgJydh9SXkYZhao74ULN/ryDiw8c/MPu5OuCdJS3CizVzoS1TbU3Gtg8sIYVqilWmjdSVh4eBmZGH1JWXl5GEgJWal5GDg9qVhISYkdqXm5nblYSEmJGXldjUl5GGgJ2SnZeVgJHUhJuYnZeN8veh6frw4vDg3ySds2CC/QoAn3mTe/xA1AM/WNjUm4RCy/XEeEO3O+txd3HvbcmzwwZdb7R62CBFZOYsgJ2SnZeVgJHUlo3UlZqN1ISVhoA97YYBqfohi6tvBtH3TqF7uan5BfLE+/L3oenn9fUL8PHE9/X1C8Tp0sTQ8veh8P/n6bWEhJiR1LeRhoCGlZeAnZeR1IeAlYCRmZGagIfaxPyqxHb15fL3oenU8Hb1/MR29fDE62Uv6rOkH/EZqo1w2R/CVqO4oRjbxHU38vzf8vXx8fP29sR1Qu51R/tpyQffvdzuPAo6QU36LaroIj/JhJiR1LeRhoCdkp2XlYCdm5rUtYHw8uf2oafF58Tl8veh8P7n/rWEhJaYkdSHgJWakJWGkNSAkYaZh9SVSgCHbxomkPs/jbvALFbKDYwLnzyEmJHUppubgNS3tcTq4/nEwsTAxkHOWQD7+vRm/0XV4tqAIcj5L5bi+fL93nK8cgP59fXx8fT3dvX19Kj83/L18fHz9vXi6pyAgISHztvbg1woitbBPtEhLfsinyBW0NflA1VYrVPx/YjjtKLl6oAnQ3/Xz7NXIZvHwq7ElsX/xP3y96Hw8uf2oafF5/H093b1+/TEdvX+9nb19fQQZV39vSyCa8fgkVWDYD3Z9vf19PVXdvV/7X0qDb+YAfNf1sT2HOzKDKT9J9SVmpDUl5GGgJ2SnZeVgJ2bmtSExOXy96Hw/uf+tYSEmJHUvZqX2sWdkp2XlYCdm5rUtYGAnJuGnYCNxZDB1+G/4a3pR2ADAmhqO6RONaykX1eFZrOnoTVb27VHDA8XhDkSV7jzGInNd3+n1CfMMEVLbrv+nwvfCHTg3ySds2CC/QoAn3natFIDs7mLmpDUl5uakJ2AnZuah9SbktSBh5GLtVxsDSU+kmjQn+UkV08Q794367GK67ifpGK1fTCAlv/kd7Vzx3511JuS1ICckdSAnJGa1JWEhJidl5XQFh8lQ4Qr+7EV0z4FmYwZE0Hj40PvSWe20ObeM/vpQrloqpc8v3TjRcSsGK7wxnicR3vpKpGHC5OqkUjCbbjZjEMZeG8oB4NvBoImg8S7NTSXx4MDzvPYoh8u+9X6Lk6H7btBpF5+IS4QCCT988NEgYHV");
+        private static int[] order = new int[] { 7,12,31,28,34,56,13,12,56,28,12,55,38,18,58,40,36,44,30,21,49,39,39,29,38,46,33,40,37,39,34,31,42,50,34,39,47,39,54,52,56,58,56,47,45,52,55,49,54,51,56,51,52,55,58,55,59,59,58,59,60 };
+        private static int key = 244;
+
+        public static byte[] Data() {
+            return Obfuscator.DeObfuscate(data, order, key);
+        }
+    }
+}
+#endif

+ 12 - 0
Assets/Plugins/UnityPurchasing/generated/AppleTangle.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 99da8dd6d94d58440945e03b29ce751d
+timeCreated: 1490840964
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 0
Assets/Plugins/UnityPurchasing/script/Demo/DemoInventory.cs

@@ -2,6 +2,7 @@
 
 namespace UnityEngine.Purchasing
 {
+	[AddComponentMenu("")]
 	public class DemoInventory : MonoBehaviour
 	{
 		public void Fulfill (string productId)

+ 86 - 27
Assets/Plugins/UnityPurchasing/script/IAPButton.cs

@@ -11,6 +11,12 @@ namespace UnityEngine.Purchasing
 	[HelpURL("https://docs.unity3d.com/Manual/UnityIAP.html")]
 	public class IAPButton : MonoBehaviour
 	{
+		public enum ButtonType
+		{
+			Purchase,
+			Restore
+		}
+
 		[System.Serializable]
 		public class OnPurchaseCompletedEvent : UnityEvent<Product> {};
 
@@ -20,6 +26,9 @@ namespace UnityEngine.Purchasing
 		[HideInInspector]
 		public string productId;
 
+		[Tooltip("The type of this button, can be either a purchase or a restore button")]
+		public ButtonType buttonType = ButtonType.Purchase;
+
 		[Tooltip("Consume the product immediately after a successful purchase")]
 		public bool consumePurchase = true;
 
@@ -41,49 +50,72 @@ namespace UnityEngine.Purchasing
 		void Start ()
 		{
 			Button button = GetComponent<Button>();
-			if (button) {
-				button.onClick.AddListener(PurchaseProduct);
-			}
 
-			if (string.IsNullOrEmpty(productId)) {
-				Debug.LogError("IAPButton productId is empty");
-			}
+			if (buttonType == ButtonType.Purchase) {
+				if (button) {
+					button.onClick.AddListener(PurchaseProduct);
+				}
 
-			if (!IAPButtonStoreManager.Instance.HasProductInCatalog(productId)) {
-				Debug.LogWarning("The product catalog has no product with the ID \"" + productId + "\"");
+				if (string.IsNullOrEmpty(productId)) {
+					Debug.LogError("IAPButton productId is empty");
+				}
+
+				if (!IAPButtonStoreManager.Instance.HasProductInCatalog(productId)) {
+					Debug.LogWarning("The product catalog has no product with the ID \"" + productId + "\"");
+				}
+			} else if (buttonType == ButtonType.Restore) {
+				if (button) {
+					button.onClick.AddListener(Restore);
+				}
 			}
 		}
 
 		void OnEnable()
 		{
-			IAPButtonStoreManager.Instance.AddButton(this);
-
-			var product = IAPButtonStoreManager.Instance.GetProduct(productId);
-			if (product != null) {
-				if (titleText != null) {
-					titleText.text = product.metadata.localizedTitle;
-				}
-
-				if (descriptionText != null) {
-					descriptionText.text = product.metadata.localizedDescription;
-				}
-
-				if (priceText != null) {
-					priceText.text = product.metadata.localizedPriceString;
-				}
+			if (buttonType == ButtonType.Purchase) {
+				IAPButtonStoreManager.Instance.AddButton(this);
+				UpdateText();
 			}
 		}
 
 		void OnDisable()
 		{
-			IAPButtonStoreManager.Instance.RemoveButton(this);
+			if (buttonType == ButtonType.Purchase) {
+				IAPButtonStoreManager.Instance.RemoveButton(this);
+			}
 		}
 
 		void PurchaseProduct()
 		{
-			Debug.Log("IAPButton.PurchaseProduct() with product ID: " + productId);
+			if (buttonType == ButtonType.Purchase) {
+				Debug.Log("IAPButton.PurchaseProduct() with product ID: " + productId);
 
-			IAPButtonStoreManager.Instance.InitiatePurchase(productId);
+				IAPButtonStoreManager.Instance.InitiatePurchase(productId);
+			}
+		}
+
+		void Restore()
+		{
+			if (buttonType == ButtonType.Restore) {
+				if (Application.platform == RuntimePlatform.WSAPlayerX86 || Application.platform == RuntimePlatform.WSAPlayerX64 || Application.platform == RuntimePlatform.WSAPlayerARM) {
+					IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IMicrosoftExtensions>().RestoreTransactions();
+				} else if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.tvOS) {
+					IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IAppleExtensions>().RestoreTransactions(OnTransactionsRestored);
+				} else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().androidStore == AndroidStore.SamsungApps) {
+					IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<ISamsungAppsExtensions>().RestoreTransactions(OnTransactionsRestored); 
+				} else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().androidStore == AndroidStore.CloudMoolah) {
+					IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IMoolahExtension>().RestoreTransactionID((restoreTransactionIDState) => { 
+						OnTransactionsRestored(restoreTransactionIDState != RestoreTransactionIDState.RestoreFailed && restoreTransactionIDState != RestoreTransactionIDState.NotKnown);
+					});
+				} else {
+					Debug.LogWarning(Application.platform.ToString() + " is not a supported platform for the Codeless IAP restore button");
+				}
+			}
+		}
+
+		void OnTransactionsRestored(bool success)
+		{
+			Debug.Log("Transactions restored: " + success);
 		}
 
 		/**
@@ -108,6 +140,24 @@ namespace UnityEngine.Purchasing
 			onPurchaseFailed.Invoke(product, reason);
 		}
 
+		private void UpdateText()
+		{
+			var product = IAPButtonStoreManager.Instance.GetProduct(productId);
+			if (product != null) {
+				if (titleText != null) {
+					titleText.text = product.metadata.localizedTitle;
+				}
+
+				if (descriptionText != null) {
+					descriptionText.text = product.metadata.localizedDescription;
+				}
+
+				if (priceText != null) {
+					priceText.text = product.metadata.localizedPriceString;
+				}
+			}
+		}
+
 		public class IAPButtonStoreManager : IStoreListener
 		{
 			private static IAPButtonStoreManager instance = new IAPButtonStoreManager();
@@ -187,6 +237,11 @@ namespace UnityEngine.Purchasing
 
 			public void InitiatePurchase(string productID)
 			{
+				if (controller == null) {
+					Debug.LogError("Purchase failed because Purchasing was not initialized correctly");
+					return;
+				}
+
 				controller.InitiatePurchase(productID);
 			}
 
@@ -194,11 +249,15 @@ namespace UnityEngine.Purchasing
 			{
 				this.controller = controller;
 				this.extensions = extensions;
+
+				foreach (var button in activeButtons) {
+					button.UpdateText();
+				}
 			}
 
 			public void OnInitializeFailed (InitializationFailureReason error)
 			{
-				Debug.LogError("Purchasing failed to initialize.");
+				Debug.LogError(string.Format("Purchasing failed to initialize. Reason: {0}", error.ToString()));
 			}
 
 			public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)

+ 2 - 1
Assets/Plugins/UnityPurchasing/script/IAPButton.cs.meta

@@ -1,11 +1,12 @@
 fileFormatVersion: 2
 guid: 36a5f511b0d8142cba0aeb92d0b264c9
-timeCreated: 1479168178
+timeCreated: 1479509834
 licenseType: Free
 MonoImporter:
   serializedVersion: 2
   defaultReferences: []
   executionOrder: 0
+  icon: {fileID: 2800000, guid: 55e457740fe60405dac77af143e1a867, type: 3}
   userData: 
   assetBundleName: 
   assetBundleVariant: 

+ 31 - 4
Assets/Plugins/UnityPurchasing/script/IAPDemo.cs

@@ -28,6 +28,7 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 	private IAppleExtensions m_AppleExtensions;
 	private IMoolahExtension m_MoolahExtensions;
 	private ISamsungAppsExtensions m_SamsungExtensions;
+	private IMicrosoftExtensions m_MicrosoftExtensions;
 
 	#pragma warning disable 0414
 	private bool m_IsGooglePlayStoreSelected;
@@ -57,6 +58,7 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 		m_AppleExtensions = extensions.GetExtension<IAppleExtensions> ();
 		m_SamsungExtensions = extensions.GetExtension<ISamsungAppsExtensions> ();
 		m_MoolahExtensions = extensions.GetExtension<IMoolahExtension> ();
+		m_MicrosoftExtensions = extensions.GetExtension<IMicrosoftExtensions> ();
 
 		InitUI(controller.products.all);
 
@@ -104,6 +106,8 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 
 		// Now that I have real products, begin showing product purchase history
 		UpdateHistoryUI();
+
+		LogProductDefinitions();
 	}
 
 	/// <summary>
@@ -125,7 +129,8 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 		// Local validation is available for GooglePlay and Apple stores
 		if (m_IsGooglePlayStoreSelected ||
 			Application.platform == RuntimePlatform.IPhonePlayer ||
-			Application.platform == RuntimePlatform.OSXPlayer) {
+			Application.platform == RuntimePlatform.OSXPlayer ||
+			Application.platform == RuntimePlatform.tvOS) {
 			try {
 				var result = validator.Validate(e.purchasedProduct.receipt);
 				Debug.Log("Receipt is valid. Contents:");
@@ -292,7 +297,7 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 		// displays a blocking Android Activity, so: 
 		// A) Unity IAP does not automatically restore purchases on Samsung Galaxy Apps
 		// B) IAPDemo (this) displays the "Restore" GUI button for Samsung Galaxy Apps
-		m_IsSamsungAppsStoreSelected = module.androidStore == AndroidStore.SamsungApps;
+		m_IsSamsungAppsStoreSelected = Application.platform == RuntimePlatform.Android && module.androidStore == AndroidStore.SamsungApps;
 
 
 		// This selects the GroupId that was created in the Tizen Store for this set of products
@@ -337,9 +342,13 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 		// See also UpdateInteractable()
 		m_InteractableSelectable = GetDropdown(); // References any one of the disabled components
 
-		// Show Restore button on Apple platforms
-		if (! (Application.platform == RuntimePlatform.IPhonePlayer || 
+		// Show Restore button on supported platforms
+		if (! (Application.platform == RuntimePlatform.IPhonePlayer ||
 			   Application.platform == RuntimePlatform.OSXPlayer ||
+			   Application.platform == RuntimePlatform.tvOS || 
+			   Application.platform == RuntimePlatform.WSAPlayerX86 ||
+			   Application.platform == RuntimePlatform.WSAPlayerX64 ||
+			   Application.platform == RuntimePlatform.WSAPlayerARM ||
 			m_IsSamsungAppsStoreSelected  || m_IsCloudMoolahStoreSelected) )
 		{
 			GetRestoreButton().gameObject.SetActive(false);
@@ -412,6 +421,12 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 				{
 					m_SamsungExtensions.RestoreTransactions(OnTransactionsRestored);
 				}
+				else if (Application.platform == RuntimePlatform.WSAPlayerX86 ||
+						 Application.platform == RuntimePlatform.WSAPlayerX64 ||
+						 Application.platform == RuntimePlatform.WSAPlayerARM)
+				{
+					m_MicrosoftExtensions.RestoreTransactions();
+				}
 				else
 				{
 					m_AppleExtensions.RestoreTransactions(OnTransactionsRestored);
@@ -586,4 +601,16 @@ public class IAPDemo : MonoBehaviour, IStoreListener
 		var which = right ? "TextR" : "TextL";
 		return GameObject.Find(which).GetComponent<Text>();
 	}
+
+	private void LogProductDefinitions()
+	{
+		var products = m_Controller.products.all;
+		foreach (var product in products) {
+#if UNITY_5_6_OR_NEWER
+			Debug.Log(string.Format("id: {0}\nstore-specific id: {1}\ntype: {2}\nenabled: {3}\n", product.definition.id, product.definition.storeSpecificId, product.definition.type.ToString(), product.definition.enabled ? "enabled" : "disabled"));
+#else
+			Debug.Log(string.Format("id: {0}\nstore-specific id: {1}\ntype: {2}\n", product.definition.id, product.definition.storeSpecificId, product.definition.type.ToString()));
+#endif
+		}
+	}
 }

+ 3 - 0
Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs

@@ -0,0 +1,3 @@
+#if !UNITY_PURCHASING
+#error "Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."
+#endif

+ 12 - 0
Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 70634bf7653af453fb3f668605916a34
+timeCreated: 1479431470
+licenseType: Free
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Plugins/UnityPurchasing/winrt/live/winrt.dll


BIN
Assets/Scenes/Battle.unity


+ 2 - 1
Assets/Scripts/Config.cs

@@ -26,7 +26,8 @@ public class Config
 
 //	public static string SERVER_ADDRESS = "121.199.20.79";
 //	public static string SERVER_ADDRESS = "127.0.0.1";
-	public static string SERVER_ADDRESS = "192.168.1.102";
+//	public static string SERVER_ADDRESS = "192.168.1.102";
+	public static string SERVER_ADDRESS = "45.76.11.200";
 	public static string URL_ADDRESS = "http://121.199.20.79/battlearray/";
 	
 //	public static string SERVER_ADDRESS = "47.90.201.47";

+ 58 - 1
Assets/Scripts/UI/Shop/PaymentManager.cs

@@ -3,6 +3,7 @@ using UnityEngine.Purchasing;
 using System.Collections;
 using System.Collections.Generic;
 using LitJson;
+using UnityEngine.Purchasing.Security;
 
 public class PaymentManager : IStoreListener 
 {
@@ -10,6 +11,7 @@ public class PaymentManager : IStoreListener
 
 	private IStoreController controller;
 	private IExtensionProvider extensions;
+	private CrossPlatformValidator validator;
 
 	public PaymentManager () 
 	{
@@ -38,6 +40,10 @@ public class PaymentManager : IStoreListener
 				{"C75000_EN", AppleAppStore.Name}
 			});
 
+		#if RECEIPT_VALIDATION
+		validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.bundleIdentifier);
+		#endif
+
 		UnityPurchasing.Initialize (this, builder);
 	}
 
@@ -57,6 +63,21 @@ public class PaymentManager : IStoreListener
 	/// </summary>
 	public void OnInitializeFailed (InitializationFailureReason error)
 	{
+		Debuger.Log("Billing failed to initialize!");
+		switch (error)
+		{
+		case InitializationFailureReason.AppNotKnown:
+			Debuger.LogError("Is your App correctly uploaded on the relevant publisher console?");
+			break;
+		case InitializationFailureReason.PurchasingUnavailable:
+			// Ask the user if billing is disabled in device settings.
+			Debuger.Log("Billing disabled!");
+			break;
+		case InitializationFailureReason.NoProductsAvailable:
+			// Developer configuration error; check product metadata.
+			Debuger.Log("No products available for purchase!");
+			break;
+		}
 		Toast.MakeText(Language.GetStr("Shop", "payFail")+" !");
 	}
 
@@ -78,7 +99,43 @@ public class PaymentManager : IStoreListener
 	/// </summary>
 	public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)
 	{
-		
+		Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
+		Debug.Log("Receipt: " + e.purchasedProduct.receipt);
+
+//		#if RECEIPT_VALIDATION
+		// Local validation is available for GooglePlay and Apple stores
+		if (Application.platform == RuntimePlatform.Android ||
+			Application.platform == RuntimePlatform.IPhonePlayer ||
+			Application.platform == RuntimePlatform.OSXPlayer ||
+			Application.platform == RuntimePlatform.tvOS) {
+			try {
+				var result = validator.Validate(e.purchasedProduct.receipt);
+				Debug.Log("Receipt is valid. Contents:");
+				foreach (IPurchaseReceipt productReceipt in result) {
+					Debug.Log(productReceipt.productID);
+					Debug.Log(productReceipt.purchaseDate);
+					Debug.Log(productReceipt.transactionID);
+
+					GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
+					if (null != google) {
+						Debug.Log(google.purchaseState);
+						Debug.Log(google.purchaseToken);
+					}
+
+					AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
+					if (null != apple) {
+						Debug.Log(apple.originalTransactionIdentifier);
+						Debug.Log(apple.subscriptionExpirationDate);
+						Debug.Log(apple.cancellationDate);
+						Debug.Log(apple.quantity);
+					}
+				}
+			} catch (IAPSecurityException) {
+				Debug.Log("Invalid receipt, not unlocking content");
+				return PurchaseProcessingResult.Complete;
+			}
+		}
+//		#endif
 
 		return PurchaseProcessingResult.Complete;
 	}

BIN
Keys/qjh.kdb


BIN
Keys/qjh.kdb.lock