質問編集履歴
4
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -168,8 +168,98 @@
|
|
168
168
|
|
169
169
|
end
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
```
|
171
|
+
```
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
sdkbox_config.jsonも載せておきます。
|
176
|
+
|
177
|
+
```ここに言語を入力
|
178
|
+
|
179
|
+
{
|
180
|
+
|
181
|
+
"android": {
|
182
|
+
|
183
|
+
"iap": {
|
184
|
+
|
185
|
+
"items": {
|
186
|
+
|
187
|
+
"remove_ads": {
|
188
|
+
|
189
|
+
"type": "non_consumable",
|
190
|
+
|
191
|
+
"id": "com.cocos2dx.non1"
|
192
|
+
|
193
|
+
},
|
194
|
+
|
195
|
+
"double_coin": {
|
196
|
+
|
197
|
+
"type": "non_consumable",
|
198
|
+
|
199
|
+
"id": "com.cocos2dx.non2"
|
200
|
+
|
201
|
+
},
|
202
|
+
|
203
|
+
"coin_package": {
|
204
|
+
|
205
|
+
"id": "商品ID"
|
206
|
+
|
207
|
+
},
|
208
|
+
|
209
|
+
"coin_package2": {
|
210
|
+
|
211
|
+
"id": "商品ID"
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
},
|
216
|
+
|
217
|
+
"key": "本番用"
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
},
|
222
|
+
|
223
|
+
"ios": {
|
224
|
+
|
225
|
+
"iap": {
|
226
|
+
|
227
|
+
"items": {
|
228
|
+
|
229
|
+
"remove_ads": {
|
230
|
+
|
231
|
+
"type": "non_consumable",
|
232
|
+
|
233
|
+
"id": "com.cocos2dx.non1"
|
234
|
+
|
235
|
+
},
|
236
|
+
|
237
|
+
"double_coin": {
|
238
|
+
|
239
|
+
"type": "non_consumable",
|
240
|
+
|
241
|
+
"id": "com.cocos2dx.non2"
|
242
|
+
|
243
|
+
},
|
244
|
+
|
245
|
+
"coin_package": {
|
246
|
+
|
247
|
+
"id": "商品ID"
|
248
|
+
|
249
|
+
},
|
250
|
+
|
251
|
+
"coin_package2": {
|
252
|
+
|
253
|
+
"id": "商品ID"
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
```
|
3
課金処理追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -89,3 +89,87 @@
|
|
89
89
|
sdkbox.IAP:init()の処理を記述したのですが、sdkboxの値がnil(null)になってしまったので、
|
90
90
|
|
91
91
|
初期化の処理を書く際にcppみたいにincludeしないと行けないのでしょうか?
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
ショップの購入ボタンにsdkbox::IAP::purchase(productId)を記述し、
|
96
|
+
|
97
|
+
確認を行ったら、onFailureが返って来ました。
|
98
|
+
|
99
|
+
他に設定を行うことはありますでしょうか?
|
100
|
+
|
101
|
+
以下課金ボタンに関するソースになります。
|
102
|
+
|
103
|
+
```ここに言語を入力
|
104
|
+
|
105
|
+
//ショップの初期化処理
|
106
|
+
|
107
|
+
function ShopPanel:Init(root, scene)
|
108
|
+
|
109
|
+
sdkbox.IAP:setListener(function(args)
|
110
|
+
|
111
|
+
if "onSuccess" == args.event then
|
112
|
+
|
113
|
+
local product = args.product
|
114
|
+
|
115
|
+
dump(product, "onSuccess:")
|
116
|
+
|
117
|
+
elseif "onFailure" == args.event then
|
118
|
+
|
119
|
+
local product = args.product
|
120
|
+
|
121
|
+
local msg = args.msg
|
122
|
+
|
123
|
+
dump(product, "onFailure:")
|
124
|
+
|
125
|
+
print("msg:", msg)
|
126
|
+
|
127
|
+
elseif "onCanceled" == args.event then
|
128
|
+
|
129
|
+
local product = args.product
|
130
|
+
|
131
|
+
dump(product, "onCanceled:")
|
132
|
+
|
133
|
+
elseif "onRestored" == args.event then
|
134
|
+
|
135
|
+
local product = args.product
|
136
|
+
|
137
|
+
dump(product, "onRestored:")
|
138
|
+
|
139
|
+
elseif "onProductRequestSuccess" == args.event then
|
140
|
+
|
141
|
+
local products = args.products
|
142
|
+
|
143
|
+
dump(products, "onProductRequestSuccess:")
|
144
|
+
|
145
|
+
elseif "onProductRequestFailure" == args.event then
|
146
|
+
|
147
|
+
local msg = args.msg
|
148
|
+
|
149
|
+
print("msg:", msg)
|
150
|
+
|
151
|
+
else
|
152
|
+
|
153
|
+
print("unknown event ", args.event)
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
end)
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
//購入ボタンを押したら以下の関数が走る
|
164
|
+
|
165
|
+
function ShopPanel:onRequestIAPKakin(sender, event)
|
166
|
+
|
167
|
+
sdkbox.IAP:purchase("coin_package");
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
```
|
2
質問内容追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -83,3 +83,9 @@
|
|
83
83
|
|
84
84
|
|
85
85
|
課金処理について詳しい方がおられましたら、教えていただきたいです。
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
sdkbox.IAP:init()の処理を記述したのですが、sdkboxの値がnil(null)になってしまったので、
|
90
|
+
|
91
|
+
初期化の処理を書く際にcppみたいにincludeしないと行けないのでしょうか?
|
1
対策案追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,6 +17,8 @@
|
|
17
17
|
```
|
18
18
|
|
19
19
|
このコードはどこに記述しないといけないのか?
|
20
|
+
|
21
|
+
main.luaに記述するのがいいのでしょうか?
|
20
22
|
|
21
23
|
|
22
24
|
|