|
@@ -13,56 +13,39 @@ public class PaymentManager : IStoreListener
|
|
|
private IExtensionProvider extensions;
|
|
|
private CrossPlatformValidator validator;
|
|
|
|
|
|
+ private ConfigurationBuilder builder;
|
|
|
+ private string itemCode;
|
|
|
+
|
|
|
public PaymentManager ()
|
|
|
{
|
|
|
- var builder = ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ());
|
|
|
- if (Config.USER_PORT == Config.USER_PORT_INTERNATIONAL) {
|
|
|
- builder.AddProduct ("VIP4", ProductType.Subscription, new IDs {
|
|
|
- { "VIP4_EN", GooglePlay.Name },
|
|
|
- { "VIP4_EN", AppleAppStore.Name }
|
|
|
- });
|
|
|
-
|
|
|
- builder.AddProduct ("C10000", ProductType.Consumable, new IDs {
|
|
|
- { "C10000_EN", GooglePlay.Name },
|
|
|
- { "C10000_EN", AppleAppStore.Name }
|
|
|
- });
|
|
|
-
|
|
|
- builder.AddProduct ("C25000", ProductType.Consumable, new IDs {
|
|
|
- { "C25000_EN", GooglePlay.Name },
|
|
|
- { "C25000_EN", AppleAppStore.Name }
|
|
|
- });
|
|
|
-
|
|
|
- builder.AddProduct ("C75000", ProductType.Consumable, new IDs {
|
|
|
- { "C75000_EN", GooglePlay.Name },
|
|
|
- { "C75000_EN", AppleAppStore.Name }
|
|
|
- });
|
|
|
- } else {
|
|
|
- builder.AddProduct ("VIP4", ProductType.Subscription, new IDs {
|
|
|
- { "VIP4", GooglePlay.Name },
|
|
|
- { "VIP4", AppleAppStore.Name }
|
|
|
+ builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
|
|
|
+ builder.AddProduct("VIP4", ProductType.Subscription, new IDs
|
|
|
+ {
|
|
|
+ {"VIP4_EN", GooglePlay.Name},
|
|
|
+ {"VIP4_EN", AppleAppStore.Name}
|
|
|
});
|
|
|
|
|
|
- builder.AddProduct ("C10000", ProductType.Consumable, new IDs {
|
|
|
- { "C10000", GooglePlay.Name },
|
|
|
- { "C10000", AppleAppStore.Name }
|
|
|
+ builder.AddProduct("C10000", ProductType.Consumable, new IDs
|
|
|
+ {
|
|
|
+ {"C10000_EN", GooglePlay.Name},
|
|
|
+ {"C10000_EN", AppleAppStore.Name}
|
|
|
});
|
|
|
|
|
|
- builder.AddProduct ("C25000", ProductType.Consumable, new IDs {
|
|
|
- { "C25000", GooglePlay.Name },
|
|
|
- { "C25000", AppleAppStore.Name }
|
|
|
+ builder.AddProduct("C25000", ProductType.Consumable, new IDs
|
|
|
+ {
|
|
|
+ {"C25000_EN", GooglePlay.Name},
|
|
|
+ {"C25000_EN", AppleAppStore.Name}
|
|
|
});
|
|
|
|
|
|
- builder.AddProduct ("C75000", ProductType.Consumable, new IDs {
|
|
|
- { "C75000", GooglePlay.Name },
|
|
|
- { "C75000", AppleAppStore.Name }
|
|
|
+ builder.AddProduct("C75000", ProductType.Consumable, new IDs
|
|
|
+ {
|
|
|
+ {"C75000_EN", GooglePlay.Name},
|
|
|
+ {"C75000_EN", AppleAppStore.Name}
|
|
|
});
|
|
|
- }
|
|
|
|
|
|
#if RECEIPT_VALIDATION
|
|
|
validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.bundleIdentifier);
|
|
|
#endif
|
|
|
-
|
|
|
- UnityPurchasing.Initialize (this, builder);
|
|
|
}
|
|
|
|
|
|
public void OnInitialized (IStoreController controller, IExtensionProvider extensions)
|
|
@@ -78,9 +61,19 @@ public class PaymentManager : IStoreListener
|
|
|
// Refresh failed.
|
|
|
}
|
|
|
Debug.Log("RefreshAppReceipt result "+result);
|
|
|
+ if(!StringUtil.Empty(itemCode))
|
|
|
+ {
|
|
|
+ OnPurchaseClicked (itemCode);
|
|
|
+ }
|
|
|
}, () => {
|
|
|
Debug.Log("RefreshAppReceipt error");
|
|
|
+ if(!StringUtil.Empty(itemCode))
|
|
|
+ {
|
|
|
+ OnPurchaseClicked (itemCode);
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -113,10 +106,12 @@ public class PaymentManager : IStoreListener
|
|
|
public void OnPurchaseClicked(string productId)
|
|
|
{
|
|
|
if (controller != null) {
|
|
|
+ itemCode = "";
|
|
|
// ProgressPanel.Show(Language.GetStr("Shop", "payBegin"));
|
|
|
controller.InitiatePurchase (productId);
|
|
|
} else {
|
|
|
- Toast.MakeText (Language.GetStr ("Shop", "payFail") + " !!");
|
|
|
+ itemCode = productId;
|
|
|
+ UnityPurchasing.Initialize (this, builder);
|
|
|
}
|
|
|
}
|
|
|
|