説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

FakeAppleExtensions.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #nullable enable
  2. using System;
  3. using System.Collections.Generic;
  4. namespace UnityEngine.Purchasing
  5. {
  6. /// <summary>
  7. /// Provides fake functionality for Apple specific APIs.
  8. ///
  9. /// Refresh receipt calls alternate between success and failure.
  10. /// </summary>
  11. class FakeAppleExtensions : IAppleExtensions
  12. {
  13. bool m_FailRefresh;
  14. public void RefreshAppReceipt(Action<string> successCallback, Action<string> errorCallback)
  15. {
  16. if (m_FailRefresh)
  17. {
  18. errorCallback("A fake error message");
  19. }
  20. else
  21. {
  22. successCallback("A fake refreshed receipt!");
  23. }
  24. m_FailRefresh = !m_FailRefresh;
  25. }
  26. [Obsolete("RefreshAppReceipt(Action<string> successCallback, Action errorCallback) is deprecated, please use RefreshAppReceipt(Action<string> successCallback, Action<string> errorCallback) instead.")]
  27. public void RefreshAppReceipt(Action<string> successCallback, Action errorCallback)
  28. {
  29. if (m_FailRefresh)
  30. {
  31. errorCallback();
  32. }
  33. else
  34. {
  35. successCallback("A fake refreshed receipt!");
  36. }
  37. m_FailRefresh = !m_FailRefresh;
  38. }
  39. [Obsolete("RestoreTransactions(Action<bool> callback) is deprecated, please use RestoreTransactions(Action<bool, string> callback) instead.")]
  40. public void RestoreTransactions(Action<bool>? callback)
  41. {
  42. callback?.Invoke(true);
  43. }
  44. public void RestoreTransactions(Action<bool, string?>? callback)
  45. {
  46. callback?.Invoke(true, null);
  47. }
  48. public void RegisterPurchaseDeferredListener(Action<Product> callback)
  49. {
  50. }
  51. public bool simulateAskToBuy
  52. {
  53. get;
  54. set;
  55. }
  56. public void FetchStorePromotionOrder(Action<List<Product>> successCallback, Action errorCallback)
  57. {
  58. errorCallback();
  59. }
  60. public void SetStorePromotionOrder(List<Product> products)
  61. {
  62. }
  63. public void FetchStorePromotionVisibility(Product product, Action<string, AppleStorePromotionVisibility> successCallback, Action errorCallback)
  64. {
  65. errorCallback();
  66. }
  67. public void SetStorePromotionVisibility(Product product, AppleStorePromotionVisibility visible)
  68. {
  69. }
  70. public void SetApplicationUsername(string applicationUsername)
  71. {
  72. }
  73. public string GetTransactionReceiptForProduct(Product product)
  74. {
  75. return "";
  76. }
  77. public void ContinuePromotionalPurchases()
  78. {
  79. }
  80. public Dictionary<string, string> GetIntroductoryPriceDictionary()
  81. {
  82. return new Dictionary<string, string>();
  83. }
  84. public Dictionary<string, string> GetProductDetails()
  85. {
  86. return new Dictionary<string, string>();
  87. }
  88. public void PresentCodeRedemptionSheet()
  89. {
  90. }
  91. }
  92. }