Skip to content

Commit 96e15eb

Browse files
committed
- add dependency extensions-unity
1 parent 03651cd commit 96e15eb

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ for version `1.0.0`
2727
```csharp
2828
"com.wolf-package.in-app-purchasing":"https://github.com/wolf-package/in-app-purchasing-unity.git#1.0.0",
2929
```
30+
dependency `extensions-unity-1.0.0`
31+
```csharp
32+
"com.wolf-package.extensions":"https://github.com/wolf-package/extensions-unity.git#1.0.0",
33+
```
3034

3135
## Use
3236

Runtime/IapManager.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using UnityEngine;
66
using UnityEngine.Purchasing;
77
using UnityEngine.Purchasing.Extension;
8+
using VirtueSky.Misc;
89

910
namespace VirtueSky.Iap
1011
{
@@ -93,7 +94,7 @@ private void InternalPurchaseFailed(string id)
9394
{
9495
if (product.Id != id) continue;
9596
OnPurchaseFailedEvent?.Invoke(product.Id);
96-
CallActionAndClean(ref product.purchaseFailedCallback);
97+
Common.CallActionAndClean(ref product.purchaseFailedCallback);
9798
}
9899
}
99100

@@ -166,7 +167,7 @@ void InternalPurchaseSuccess(string id)
166167
{
167168
if (product.Id != id) continue;
168169
OnPurchaseSucceedEvent?.Invoke(product.Id);
169-
CallActionAndClean(ref product.purchaseSuccessCallback);
170+
Common.CallActionAndClean(ref product.purchaseSuccessCallback);
170171
}
171172
}
172173

@@ -248,14 +249,6 @@ private static void AutoInitialize()
248249
}
249250
}
250251

251-
private void CallActionAndClean(ref Action action)
252-
{
253-
if (action == null) return;
254-
var a = action;
255-
a();
256-
action = null;
257-
}
258-
259252
#region API
260253

261254
public IapDataProduct PurchaseProduct(string id)

Runtime/UnityCommon.IAP.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"GUID:e63a64384cc3ef04cac761c1ce76e9c2",
88
"GUID:08d1c582746949b40ba6a45cdb776bdf",
99
"GUID:fe25561d224ed4743af4c60938a59d0b",
10-
"GUID:70ea675efa2644cef98c7ece24158333"
10+
"GUID:70ea675efa2644cef98c7ece24158333",
11+
"GUID:928509ee676cc2e439010e69f455e144"
1112
],
1213
"includePlatforms": [],
1314
"excludePlatforms": [],

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"UnityIAP"
1919
],
2020
"dependencies": {
21-
"com.unity.purchasing": "4.12.0"
21+
"com.unity.purchasing": "4.12.0",
22+
"com.wolf-package.extensions": "https://github.com/wolf-package/extensions-unity.git#1.0.0"
2223
}
2324
}

0 commit comments

Comments
 (0)