質問編集履歴
4
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -83,6 +83,51 @@
|
|
83
83
|
function ShopPanel:onRequestIAPKakin(sender, event)
|
84
84
|
sdkbox.IAP:purchase("coin_package");
|
85
85
|
end
|
86
|
+
```
|
86
87
|
|
87
|
-
|
88
|
+
sdkbox_config.jsonも載せておきます。
|
89
|
+
```ここに言語を入力
|
90
|
+
{
|
91
|
+
"android": {
|
92
|
+
"iap": {
|
93
|
+
"items": {
|
94
|
+
"remove_ads": {
|
95
|
+
"type": "non_consumable",
|
96
|
+
"id": "com.cocos2dx.non1"
|
97
|
+
},
|
98
|
+
"double_coin": {
|
99
|
+
"type": "non_consumable",
|
100
|
+
"id": "com.cocos2dx.non2"
|
101
|
+
},
|
102
|
+
"coin_package": {
|
103
|
+
"id": "商品ID"
|
104
|
+
},
|
105
|
+
"coin_package2": {
|
106
|
+
"id": "商品ID"
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"key": "本番用"
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"ios": {
|
113
|
+
"iap": {
|
114
|
+
"items": {
|
115
|
+
"remove_ads": {
|
116
|
+
"type": "non_consumable",
|
117
|
+
"id": "com.cocos2dx.non1"
|
118
|
+
},
|
119
|
+
"double_coin": {
|
120
|
+
"type": "non_consumable",
|
121
|
+
"id": "com.cocos2dx.non2"
|
122
|
+
},
|
123
|
+
"coin_package": {
|
124
|
+
"id": "商品ID"
|
125
|
+
},
|
126
|
+
"coin_package2": {
|
127
|
+
"id": "商品ID"
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
88
133
|
```
|
3
課金処理追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -43,4 +43,46 @@
|
|
43
43
|
課金処理について詳しい方がおられましたら、教えていただきたいです。
|
44
44
|
|
45
45
|
sdkbox.IAP:init()の処理を記述したのですが、sdkboxの値がnil(null)になってしまったので、
|
46
|
-
初期化の処理を書く際にcppみたいにincludeしないと行けないのでしょうか?
|
46
|
+
初期化の処理を書く際にcppみたいにincludeしないと行けないのでしょうか?
|
47
|
+
|
48
|
+
ショップの購入ボタンにsdkbox::IAP::purchase(productId)を記述し、
|
49
|
+
確認を行ったら、onFailureが返って来ました。
|
50
|
+
他に設定を行うことはありますでしょうか?
|
51
|
+
以下課金ボタンに関するソースになります。
|
52
|
+
```ここに言語を入力
|
53
|
+
//ショップの初期化処理
|
54
|
+
function ShopPanel:Init(root, scene)
|
55
|
+
sdkbox.IAP:setListener(function(args)
|
56
|
+
if "onSuccess" == args.event then
|
57
|
+
local product = args.product
|
58
|
+
dump(product, "onSuccess:")
|
59
|
+
elseif "onFailure" == args.event then
|
60
|
+
local product = args.product
|
61
|
+
local msg = args.msg
|
62
|
+
dump(product, "onFailure:")
|
63
|
+
print("msg:", msg)
|
64
|
+
elseif "onCanceled" == args.event then
|
65
|
+
local product = args.product
|
66
|
+
dump(product, "onCanceled:")
|
67
|
+
elseif "onRestored" == args.event then
|
68
|
+
local product = args.product
|
69
|
+
dump(product, "onRestored:")
|
70
|
+
elseif "onProductRequestSuccess" == args.event then
|
71
|
+
local products = args.products
|
72
|
+
dump(products, "onProductRequestSuccess:")
|
73
|
+
elseif "onProductRequestFailure" == args.event then
|
74
|
+
local msg = args.msg
|
75
|
+
print("msg:", msg)
|
76
|
+
else
|
77
|
+
print("unknown event ", args.event)
|
78
|
+
end
|
79
|
+
end)
|
80
|
+
end
|
81
|
+
|
82
|
+
//購入ボタンを押したら以下の関数が走る
|
83
|
+
function ShopPanel:onRequestIAPKakin(sender, event)
|
84
|
+
sdkbox.IAP:purchase("coin_package");
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
```
|
2
質問内容追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,4 +40,7 @@
|
|
40
40
|
この処理で課金の何が出来ているのか?
|
41
41
|
などだいぶ初歩的な部分で躓いてしまっています…
|
42
42
|
|
43
|
-
課金処理について詳しい方がおられましたら、教えていただきたいです。
|
43
|
+
課金処理について詳しい方がおられましたら、教えていただきたいです。
|
44
|
+
|
45
|
+
sdkbox.IAP:init()の処理を記述したのですが、sdkboxの値がnil(null)になってしまったので、
|
46
|
+
初期化の処理を書く際にcppみたいにincludeしないと行けないのでしょうか?
|
1
対策案追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
sdkbox.IAP:init()
|
9
9
|
```
|
10
10
|
このコードはどこに記述しないといけないのか?
|
11
|
+
main.luaに記述するのがいいのでしょうか?
|
11
12
|
|
12
13
|
```ここに言語を入力
|
13
14
|
sdkbox.IAP:setListener(function(args)
|