yingchigamesdk-cocos-v3 25.7.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/assets/resources/Privacy/PrivacyPolicy.txt.meta +11 -0
  2. package/assets/resources/Privacy/ad.png +0 -0
  3. package/assets/resources/Privacy/ad.png.meta +162 -0
  4. package/assets/resources/Privacy/bg.prefab +3184 -0
  5. package/assets/resources/Privacy/bg.prefab.meta +13 -0
  6. package/assets/resources/Privacy/close.png +0 -0
  7. package/assets/resources/Privacy/close.png.meta +162 -0
  8. package/assets/resources/Privacy/panelBg.png +0 -0
  9. package/assets/resources/Privacy/panelBg.png.meta +134 -0
  10. package/assets/resources/Privacy/panelBtn.png.meta +134 -0
  11. package/assets/resources/Privacy/policyUI.prefab +1450 -0
  12. package/assets/resources/Privacy/policyUI.prefab.meta +13 -0
  13. package/assets/resources/Privacy/rectbg.png.meta +134 -0
  14. package/assets/resources/Privacy/yinsiUI.prefab +2120 -0
  15. package/assets/resources/Privacy/yinsiUI.prefab.meta +13 -0
  16. package/dist/Demo.d.ts +11 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +2673 -0
  19. package/dist/index.js.map +7 -0
  20. package/dist/ycsdk/AdState.d.ts +9 -0
  21. package/dist/ycsdk/AdTactics.d.ts +36 -0
  22. package/dist/ycsdk/AdType.d.ts +7 -0
  23. package/dist/ycsdk/GameInterface.d.ts +52 -0
  24. package/dist/ycsdk/SDKConfig.d.ts +28 -0
  25. package/dist/ycsdk/StorageUtils.d.ts +6 -0
  26. package/dist/ycsdk/YCSDK.d.ts +43 -0
  27. package/dist/ycsdk/minigame/BannerType.d.ts +6 -0
  28. package/dist/ycsdk/minigame/DebugGame.d.ts +16 -0
  29. package/dist/ycsdk/minigame/HttpRequest.d.ts +15 -0
  30. package/dist/ycsdk/minigame/InterstitialType.d.ts +5 -0
  31. package/dist/ycsdk/minigame/MiniGame.d.ts +19 -0
  32. package/dist/ycsdk/minigame/PayParams.d.ts +19 -0
  33. package/dist/ycsdk/minigame/PrivacyEvent.d.ts +8 -0
  34. package/dist/ycsdk/minigame/PrivacyListener.d.ts +6 -0
  35. package/dist/ycsdk/minigame/douyin/DouYinGame.d.ts +18 -0
  36. package/dist/ycsdk/minigame/huawei/HuaWeiGame.d.ts +27 -0
  37. package/dist/ycsdk/minigame/kuaishou/KuaiShouGame.d.ts +15 -0
  38. package/dist/ycsdk/minigame/md5.d.ts +70 -0
  39. package/dist/ycsdk/minigame/oppo/OppoGame.d.ts +29 -0
  40. package/dist/ycsdk/minigame/vivo/VivoGame.d.ts +27 -0
  41. package/dist/ycsdk/minigame/wechat/WeChatGame.d.ts +17 -0
  42. package/dist/ycsdk/minigame/xiaomi/XiaoMiGame.d.ts +30 -0
  43. package/package.json +31 -0
package/dist/index.js ADDED
@@ -0,0 +1,2673 @@
1
+ // assets/script/ycsdk/minigame/InterstitialType.ts
2
+ var InterstitialType = /* @__PURE__ */ ((InterstitialType2) => {
3
+ InterstitialType2["Initial"] = "Initial";
4
+ InterstitialType2["Native"] = "Native";
5
+ InterstitialType2["Video"] = "Video";
6
+ return InterstitialType2;
7
+ })(InterstitialType || {});
8
+
9
+ // assets/script/ycsdk/SDKConfig.ts
10
+ var sdkconfig = {
11
+ open: true,
12
+ subornUser: false,
13
+ subornUserTest: false,
14
+ version: "1536",
15
+ pkgName: "",
16
+ bannerId: [],
17
+ intersId: [],
18
+ videoId: [],
19
+ nativeId: [],
20
+ nativeBannerId: [],
21
+ ratio: {
22
+ inters: 50,
23
+ native: 50,
24
+ video: 0
25
+ },
26
+ ycBannerId: "",
27
+ ycNativeId: "",
28
+ ycVideoId: "",
29
+ ycIntersId: "",
30
+ ycBigPicId: "",
31
+ ycNativeBannerId: "",
32
+ customFunc: {}
33
+ };
34
+
35
+ // assets/script/ycsdk/minigame/BannerType.ts
36
+ var BannerType = /* @__PURE__ */ ((BannerType2) => {
37
+ BannerType2["Top"] = "Top";
38
+ BannerType2["Bottom"] = "Bottom";
39
+ BannerType2["Normal"] = "Normal";
40
+ BannerType2["Native"] = "Native";
41
+ return BannerType2;
42
+ })(BannerType || {});
43
+
44
+ // assets/script/ycsdk/StorageUtils.ts
45
+ import { sys } from "cc";
46
+ var StorageUtils = class {
47
+ static setStringData(key, value) {
48
+ if (key == "" || value == "") return;
49
+ if (typeof value != "string") value = JSON.stringify(value);
50
+ sys.localStorage.setItem(key, value);
51
+ }
52
+ static getStringData(key) {
53
+ let value = sys.localStorage.getItem(key);
54
+ if (value == "" || value == void 0 || value == null) value = "";
55
+ return value;
56
+ }
57
+ static setBooleanData(key, value) {
58
+ sys.localStorage.setItem(key, value.toString());
59
+ }
60
+ static getBooleanData(key) {
61
+ let value = sys.localStorage.getItem(key);
62
+ if (value == "" || value == void 0 || value == null) return false;
63
+ if (value == "true") return true;
64
+ if (value == "false") return false;
65
+ return false;
66
+ }
67
+ };
68
+
69
+ // assets/script/ycsdk/minigame/md5.ts
70
+ var Md5 = class _Md5 {
71
+ constructor() {
72
+ this._dataLength = 0;
73
+ this._bufferLength = 0;
74
+ this._state = new Int32Array(4);
75
+ this._buffer = new ArrayBuffer(68);
76
+ this._buffer8 = new Uint8Array(this._buffer, 0, 68);
77
+ this._buffer32 = new Uint32Array(this._buffer, 0, 17);
78
+ this.start();
79
+ }
80
+ static hashStr(str, raw = false) {
81
+ return this.onePassHasher.start().appendStr(str).end(raw);
82
+ }
83
+ static hashAsciiStr(str, raw = false) {
84
+ return this.onePassHasher.start().appendAsciiStr(str).end(raw);
85
+ }
86
+ static {
87
+ // Private Static Variables
88
+ this.stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
89
+ }
90
+ static {
91
+ this.buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
92
+ }
93
+ static {
94
+ this.hexChars = "0123456789abcdef";
95
+ }
96
+ static {
97
+ this.hexOut = [];
98
+ }
99
+ static {
100
+ // Permanent instance is to use for one-call hashing
101
+ this.onePassHasher = new _Md5();
102
+ }
103
+ static _hex(x) {
104
+ const hc = _Md5.hexChars;
105
+ const ho = _Md5.hexOut;
106
+ let n;
107
+ let offset;
108
+ let j;
109
+ let i;
110
+ for (i = 0; i < 4; i += 1) {
111
+ offset = i * 8;
112
+ n = x[i];
113
+ for (j = 0; j < 8; j += 2) {
114
+ ho[offset + 1 + j] = hc.charAt(n & 15);
115
+ n >>>= 4;
116
+ ho[offset + 0 + j] = hc.charAt(n & 15);
117
+ n >>>= 4;
118
+ }
119
+ }
120
+ return ho.join("");
121
+ }
122
+ static _md5cycle(x, k) {
123
+ let a = x[0];
124
+ let b = x[1];
125
+ let c = x[2];
126
+ let d = x[3];
127
+ a += (b & c | ~b & d) + k[0] - 680876936 | 0;
128
+ a = (a << 7 | a >>> 25) + b | 0;
129
+ d += (a & b | ~a & c) + k[1] - 389564586 | 0;
130
+ d = (d << 12 | d >>> 20) + a | 0;
131
+ c += (d & a | ~d & b) + k[2] + 606105819 | 0;
132
+ c = (c << 17 | c >>> 15) + d | 0;
133
+ b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
134
+ b = (b << 22 | b >>> 10) + c | 0;
135
+ a += (b & c | ~b & d) + k[4] - 176418897 | 0;
136
+ a = (a << 7 | a >>> 25) + b | 0;
137
+ d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
138
+ d = (d << 12 | d >>> 20) + a | 0;
139
+ c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
140
+ c = (c << 17 | c >>> 15) + d | 0;
141
+ b += (c & d | ~c & a) + k[7] - 45705983 | 0;
142
+ b = (b << 22 | b >>> 10) + c | 0;
143
+ a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
144
+ a = (a << 7 | a >>> 25) + b | 0;
145
+ d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
146
+ d = (d << 12 | d >>> 20) + a | 0;
147
+ c += (d & a | ~d & b) + k[10] - 42063 | 0;
148
+ c = (c << 17 | c >>> 15) + d | 0;
149
+ b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
150
+ b = (b << 22 | b >>> 10) + c | 0;
151
+ a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
152
+ a = (a << 7 | a >>> 25) + b | 0;
153
+ d += (a & b | ~a & c) + k[13] - 40341101 | 0;
154
+ d = (d << 12 | d >>> 20) + a | 0;
155
+ c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
156
+ c = (c << 17 | c >>> 15) + d | 0;
157
+ b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
158
+ b = (b << 22 | b >>> 10) + c | 0;
159
+ a += (b & d | c & ~d) + k[1] - 165796510 | 0;
160
+ a = (a << 5 | a >>> 27) + b | 0;
161
+ d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
162
+ d = (d << 9 | d >>> 23) + a | 0;
163
+ c += (d & b | a & ~b) + k[11] + 643717713 | 0;
164
+ c = (c << 14 | c >>> 18) + d | 0;
165
+ b += (c & a | d & ~a) + k[0] - 373897302 | 0;
166
+ b = (b << 20 | b >>> 12) + c | 0;
167
+ a += (b & d | c & ~d) + k[5] - 701558691 | 0;
168
+ a = (a << 5 | a >>> 27) + b | 0;
169
+ d += (a & c | b & ~c) + k[10] + 38016083 | 0;
170
+ d = (d << 9 | d >>> 23) + a | 0;
171
+ c += (d & b | a & ~b) + k[15] - 660478335 | 0;
172
+ c = (c << 14 | c >>> 18) + d | 0;
173
+ b += (c & a | d & ~a) + k[4] - 405537848 | 0;
174
+ b = (b << 20 | b >>> 12) + c | 0;
175
+ a += (b & d | c & ~d) + k[9] + 568446438 | 0;
176
+ a = (a << 5 | a >>> 27) + b | 0;
177
+ d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
178
+ d = (d << 9 | d >>> 23) + a | 0;
179
+ c += (d & b | a & ~b) + k[3] - 187363961 | 0;
180
+ c = (c << 14 | c >>> 18) + d | 0;
181
+ b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
182
+ b = (b << 20 | b >>> 12) + c | 0;
183
+ a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
184
+ a = (a << 5 | a >>> 27) + b | 0;
185
+ d += (a & c | b & ~c) + k[2] - 51403784 | 0;
186
+ d = (d << 9 | d >>> 23) + a | 0;
187
+ c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
188
+ c = (c << 14 | c >>> 18) + d | 0;
189
+ b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
190
+ b = (b << 20 | b >>> 12) + c | 0;
191
+ a += (b ^ c ^ d) + k[5] - 378558 | 0;
192
+ a = (a << 4 | a >>> 28) + b | 0;
193
+ d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
194
+ d = (d << 11 | d >>> 21) + a | 0;
195
+ c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
196
+ c = (c << 16 | c >>> 16) + d | 0;
197
+ b += (c ^ d ^ a) + k[14] - 35309556 | 0;
198
+ b = (b << 23 | b >>> 9) + c | 0;
199
+ a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
200
+ a = (a << 4 | a >>> 28) + b | 0;
201
+ d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
202
+ d = (d << 11 | d >>> 21) + a | 0;
203
+ c += (d ^ a ^ b) + k[7] - 155497632 | 0;
204
+ c = (c << 16 | c >>> 16) + d | 0;
205
+ b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
206
+ b = (b << 23 | b >>> 9) + c | 0;
207
+ a += (b ^ c ^ d) + k[13] + 681279174 | 0;
208
+ a = (a << 4 | a >>> 28) + b | 0;
209
+ d += (a ^ b ^ c) + k[0] - 358537222 | 0;
210
+ d = (d << 11 | d >>> 21) + a | 0;
211
+ c += (d ^ a ^ b) + k[3] - 722521979 | 0;
212
+ c = (c << 16 | c >>> 16) + d | 0;
213
+ b += (c ^ d ^ a) + k[6] + 76029189 | 0;
214
+ b = (b << 23 | b >>> 9) + c | 0;
215
+ a += (b ^ c ^ d) + k[9] - 640364487 | 0;
216
+ a = (a << 4 | a >>> 28) + b | 0;
217
+ d += (a ^ b ^ c) + k[12] - 421815835 | 0;
218
+ d = (d << 11 | d >>> 21) + a | 0;
219
+ c += (d ^ a ^ b) + k[15] + 530742520 | 0;
220
+ c = (c << 16 | c >>> 16) + d | 0;
221
+ b += (c ^ d ^ a) + k[2] - 995338651 | 0;
222
+ b = (b << 23 | b >>> 9) + c | 0;
223
+ a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
224
+ a = (a << 6 | a >>> 26) + b | 0;
225
+ d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
226
+ d = (d << 10 | d >>> 22) + a | 0;
227
+ c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
228
+ c = (c << 15 | c >>> 17) + d | 0;
229
+ b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
230
+ b = (b << 21 | b >>> 11) + c | 0;
231
+ a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
232
+ a = (a << 6 | a >>> 26) + b | 0;
233
+ d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
234
+ d = (d << 10 | d >>> 22) + a | 0;
235
+ c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
236
+ c = (c << 15 | c >>> 17) + d | 0;
237
+ b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
238
+ b = (b << 21 | b >>> 11) + c | 0;
239
+ a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
240
+ a = (a << 6 | a >>> 26) + b | 0;
241
+ d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
242
+ d = (d << 10 | d >>> 22) + a | 0;
243
+ c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
244
+ c = (c << 15 | c >>> 17) + d | 0;
245
+ b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
246
+ b = (b << 21 | b >>> 11) + c | 0;
247
+ a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
248
+ a = (a << 6 | a >>> 26) + b | 0;
249
+ d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
250
+ d = (d << 10 | d >>> 22) + a | 0;
251
+ c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
252
+ c = (c << 15 | c >>> 17) + d | 0;
253
+ b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
254
+ b = (b << 21 | b >>> 11) + c | 0;
255
+ x[0] = a + x[0] | 0;
256
+ x[1] = b + x[1] | 0;
257
+ x[2] = c + x[2] | 0;
258
+ x[3] = d + x[3] | 0;
259
+ }
260
+ /**
261
+ * Initialise buffer to be hashed
262
+ */
263
+ start() {
264
+ this._dataLength = 0;
265
+ this._bufferLength = 0;
266
+ this._state.set(_Md5.stateIdentity);
267
+ return this;
268
+ }
269
+ // Char to code point to to array conversion:
270
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
271
+ // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
272
+ /**
273
+ * Append a UTF-8 string to the hash buffer
274
+ * @param str String to append
275
+ */
276
+ appendStr(str) {
277
+ const buf8 = this._buffer8;
278
+ const buf32 = this._buffer32;
279
+ let bufLen = this._bufferLength;
280
+ let code;
281
+ let i;
282
+ for (i = 0; i < str.length; i += 1) {
283
+ code = str.charCodeAt(i);
284
+ if (code < 128) {
285
+ buf8[bufLen++] = code;
286
+ } else if (code < 2048) {
287
+ buf8[bufLen++] = (code >>> 6) + 192;
288
+ buf8[bufLen++] = code & 63 | 128;
289
+ } else if (code < 55296 || code > 56319) {
290
+ buf8[bufLen++] = (code >>> 12) + 224;
291
+ buf8[bufLen++] = code >>> 6 & 63 | 128;
292
+ buf8[bufLen++] = code & 63 | 128;
293
+ } else {
294
+ code = (code - 55296) * 1024 + (str.charCodeAt(++i) - 56320) + 65536;
295
+ if (code > 1114111) {
296
+ throw new Error("Unicode standard supports code points up to U+10FFFF");
297
+ }
298
+ buf8[bufLen++] = (code >>> 18) + 240;
299
+ buf8[bufLen++] = code >>> 12 & 63 | 128;
300
+ buf8[bufLen++] = code >>> 6 & 63 | 128;
301
+ buf8[bufLen++] = code & 63 | 128;
302
+ }
303
+ if (bufLen >= 64) {
304
+ this._dataLength += 64;
305
+ _Md5._md5cycle(this._state, buf32);
306
+ bufLen -= 64;
307
+ buf32[0] = buf32[16];
308
+ }
309
+ }
310
+ this._bufferLength = bufLen;
311
+ return this;
312
+ }
313
+ /**
314
+ * Append an ASCII string to the hash buffer
315
+ * @param str String to append
316
+ */
317
+ appendAsciiStr(str) {
318
+ const buf8 = this._buffer8;
319
+ const buf32 = this._buffer32;
320
+ let bufLen = this._bufferLength;
321
+ let i;
322
+ let j = 0;
323
+ for (; ; ) {
324
+ i = Math.min(str.length - j, 64 - bufLen);
325
+ while (i--) {
326
+ buf8[bufLen++] = str.charCodeAt(j++);
327
+ }
328
+ if (bufLen < 64) {
329
+ break;
330
+ }
331
+ this._dataLength += 64;
332
+ _Md5._md5cycle(this._state, buf32);
333
+ bufLen = 0;
334
+ }
335
+ this._bufferLength = bufLen;
336
+ return this;
337
+ }
338
+ /**
339
+ * Append a byte array to the hash buffer
340
+ * @param input array to append
341
+ */
342
+ appendByteArray(input) {
343
+ const buf8 = this._buffer8;
344
+ const buf32 = this._buffer32;
345
+ let bufLen = this._bufferLength;
346
+ let i;
347
+ let j = 0;
348
+ for (; ; ) {
349
+ i = Math.min(input.length - j, 64 - bufLen);
350
+ while (i--) {
351
+ buf8[bufLen++] = input[j++];
352
+ }
353
+ if (bufLen < 64) {
354
+ break;
355
+ }
356
+ this._dataLength += 64;
357
+ _Md5._md5cycle(this._state, buf32);
358
+ bufLen = 0;
359
+ }
360
+ this._bufferLength = bufLen;
361
+ return this;
362
+ }
363
+ /**
364
+ * Get the state of the hash buffer
365
+ */
366
+ getState() {
367
+ const s = this._state;
368
+ return {
369
+ buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),
370
+ buflen: this._bufferLength,
371
+ length: this._dataLength,
372
+ state: [s[0], s[1], s[2], s[3]]
373
+ };
374
+ }
375
+ /**
376
+ * Override the current state of the hash buffer
377
+ * @param state New hash buffer state
378
+ */
379
+ setState(state) {
380
+ const buf = state.buffer;
381
+ const x = state.state;
382
+ const s = this._state;
383
+ let i;
384
+ this._dataLength = state.length;
385
+ this._bufferLength = state.buflen;
386
+ s[0] = x[0];
387
+ s[1] = x[1];
388
+ s[2] = x[2];
389
+ s[3] = x[3];
390
+ for (i = 0; i < buf.length; i += 1) {
391
+ this._buffer8[i] = buf.charCodeAt(i);
392
+ }
393
+ }
394
+ /**
395
+ * Hash the current state of the hash buffer and return the result
396
+ * @param raw Whether to return the value as an `Int32Array`
397
+ */
398
+ end(raw = false) {
399
+ const bufLen = this._bufferLength;
400
+ const buf8 = this._buffer8;
401
+ const buf32 = this._buffer32;
402
+ const i = (bufLen >> 2) + 1;
403
+ this._dataLength += bufLen;
404
+ const dataBitsLen = this._dataLength * 8;
405
+ buf8[bufLen] = 128;
406
+ buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0;
407
+ buf32.set(_Md5.buffer32Identity.subarray(i), i);
408
+ if (bufLen > 55) {
409
+ _Md5._md5cycle(this._state, buf32);
410
+ buf32.set(_Md5.buffer32Identity);
411
+ }
412
+ if (dataBitsLen <= 4294967295) {
413
+ buf32[14] = dataBitsLen;
414
+ } else {
415
+ const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
416
+ if (matches === null) {
417
+ return;
418
+ }
419
+ const lo = parseInt(matches[2], 16);
420
+ const hi = parseInt(matches[1], 16) || 0;
421
+ buf32[14] = lo;
422
+ buf32[15] = hi;
423
+ }
424
+ _Md5._md5cycle(this._state, buf32);
425
+ return raw ? this._state : _Md5._hex(this._state);
426
+ }
427
+ };
428
+ if (Md5.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592") {
429
+ throw new Error("Md5 self test failed.");
430
+ }
431
+
432
+ // assets/script/ycsdk/AdType.ts
433
+ var AdType = /* @__PURE__ */ ((AdType2) => {
434
+ AdType2["Banner"] = "Banner";
435
+ AdType2["Inters"] = "Inters";
436
+ AdType2["Native"] = "Native";
437
+ AdType2["Video"] = "Video";
438
+ AdType2["NativeBanner"] = "NativeBanner";
439
+ return AdType2;
440
+ })(AdType || {});
441
+
442
+ // assets/script/ycsdk/YCSDK.ts
443
+ import { sys as sys7, Node as Node3, resources as resources3, Prefab as Prefab3, instantiate as instantiate3, view as view3 } from "cc";
444
+
445
+ // assets/script/ycsdk/minigame/DebugGame.ts
446
+ var DebugGame = class {
447
+ init(callBack) {
448
+ console.log("debug init");
449
+ callBack && callBack();
450
+ }
451
+ showPolicy(node, callBack) {
452
+ console.log("bubug call show policy");
453
+ }
454
+ login(callBack) {
455
+ console.log("debug call login");
456
+ }
457
+ pay(params, callBack) {
458
+ console.log("bubug call pay");
459
+ }
460
+ showBanner(position) {
461
+ console.log("bubug call show banner");
462
+ }
463
+ hideBanner() {
464
+ console.log("bubug call hide banner");
465
+ }
466
+ showInters(type) {
467
+ console.log("debug call show interstitial ad type:", type);
468
+ }
469
+ hideInters(type) {
470
+ console.log("bubug call hide interstitial");
471
+ }
472
+ showVideo(callBack) {
473
+ console.log("call debug show video ad");
474
+ YCSDK.ins.onError("Video" /* Video */, callBack);
475
+ return true;
476
+ }
477
+ customFunc(methodName, params, callBack) {
478
+ console.log("bubug call custom function name:", methodName);
479
+ }
480
+ };
481
+
482
+ // assets/script/ycsdk/minigame/MiniGame.ts
483
+ import { sys as sys5 } from "cc";
484
+
485
+ // assets/script/ycsdk/AdTactics.ts
486
+ import { sys as sys2 } from "cc";
487
+ var AdTactics = class {
488
+ constructor() {
489
+ this.bannerIndex = 0;
490
+ this.bannerLoaded = [];
491
+ this.intersIndex = 0;
492
+ this.intersLoaded = [];
493
+ this.nativeIndex = 0;
494
+ this.nativeLoaded = [];
495
+ this.videoIndex = 0;
496
+ this.videoLoaded = [];
497
+ this.nativeBannerIndex = 0;
498
+ this.nativeBanerLoaded = [];
499
+ this.timerBigPic = 0;
500
+ }
501
+ onLoad(type) {
502
+ console.log("on load: ", type);
503
+ this.refreshId(type);
504
+ switch (type) {
505
+ case "Banner" /* Banner */:
506
+ this.bannerLoaded = [];
507
+ break;
508
+ case "NativeBanner" /* NativeBanner */:
509
+ this.nativeBanerLoaded = [];
510
+ break;
511
+ case "Inters" /* Inters */:
512
+ this.intersLoaded = [];
513
+ break;
514
+ case "Native" /* Native */:
515
+ this.nativeLoaded = [];
516
+ break;
517
+ case "Video" /* Video */:
518
+ this.videoLoaded = [];
519
+ break;
520
+ }
521
+ }
522
+ onError(type, callBack) {
523
+ console.log("on error: ", type);
524
+ if (YCSDK.ins.isRun(sys2.Platform.OPPO_MINI_GAME)) {
525
+ this.reLoadAd(type, callBack);
526
+ }
527
+ }
528
+ onShow(type) {
529
+ console.log("on show: ", type);
530
+ }
531
+ onClick(type) {
532
+ console.log("on click: ", type);
533
+ }
534
+ onClose(type, callBack) {
535
+ console.log("on close: ", type);
536
+ }
537
+ onReward() {
538
+ console.log("on reward");
539
+ }
540
+ reLoadAd(type, callback) {
541
+ console.log("reLoadAd: ", type);
542
+ switch (type) {
543
+ case "Banner" /* Banner */:
544
+ this.reshowBanner();
545
+ break;
546
+ case "NativeBanner" /* NativeBanner */:
547
+ this.reshowNativeBanner();
548
+ break;
549
+ case "Inters" /* Inters */:
550
+ this.reshowInterstitial();
551
+ break;
552
+ case "Native" /* Native */:
553
+ this.reshowNative();
554
+ break;
555
+ case "Video" /* Video */:
556
+ this.reshowVideo(callback);
557
+ break;
558
+ }
559
+ }
560
+ reshowBanner() {
561
+ const length = sdkconfig.bannerId.length;
562
+ if (length == 0 || length == 1) {
563
+ console.log("re show banner need more than 1 id");
564
+ return;
565
+ }
566
+ if (this.bannerLoaded.includes(sdkconfig.ycBannerId)) {
567
+ console.log("reshowBanner1: ", sdkconfig.ycBannerId, " already loaded");
568
+ this.bannerLoaded = [];
569
+ return;
570
+ }
571
+ this.bannerLoaded.push(sdkconfig.ycBannerId);
572
+ this.refreshId("Banner" /* Banner */);
573
+ if (this.bannerLoaded.includes(sdkconfig.ycBannerId)) {
574
+ console.log("reshowBanner2: ", sdkconfig.ycBannerId, " already loaded");
575
+ this.bannerLoaded = [];
576
+ return;
577
+ }
578
+ YCSDK.ins.showBanner();
579
+ }
580
+ reshowNativeBanner() {
581
+ const length = sdkconfig.nativeBannerId.length;
582
+ if (length == 0 || length == 1) {
583
+ console.log("re show native banner need more than 1 id");
584
+ return;
585
+ }
586
+ if (this.nativeBanerLoaded.includes(sdkconfig.ycNativeBannerId)) {
587
+ console.log("reshow native Banner1: ", sdkconfig.ycNativeBannerId, " already loaded");
588
+ this.nativeBanerLoaded = [];
589
+ return;
590
+ }
591
+ this.nativeBanerLoaded.push(sdkconfig.ycNativeBannerId);
592
+ this.refreshId("Banner" /* Banner */);
593
+ if (this.nativeBanerLoaded.includes(sdkconfig.ycNativeBannerId)) {
594
+ console.log("reshow native Banner2: ", sdkconfig.ycNativeBannerId, " already loaded");
595
+ this.nativeBanerLoaded = [];
596
+ return;
597
+ }
598
+ YCSDK.ins.showBanner("Native" /* Native */);
599
+ }
600
+ reshowNative() {
601
+ const length = sdkconfig.nativeId.length;
602
+ if (length == 0 || length == 1) {
603
+ console.log("re show native need more than 1 id");
604
+ return;
605
+ }
606
+ if (this.nativeLoaded.includes(sdkconfig.ycNativeId)) {
607
+ console.log("reshowNative1: ", sdkconfig.ycNativeId, " already loaded");
608
+ this.nativeLoaded = [];
609
+ return;
610
+ }
611
+ this.nativeLoaded.push(sdkconfig.ycNativeId);
612
+ this.refreshId("Native" /* Native */);
613
+ if (this.nativeLoaded.includes(sdkconfig.ycNativeId)) {
614
+ console.log("reshowNative2: ", sdkconfig.ycNativeId, " already loaded");
615
+ this.nativeLoaded = [];
616
+ return;
617
+ }
618
+ YCSDK.ins.showInters("Native" /* Native */);
619
+ }
620
+ reshowInterstitial() {
621
+ const length = sdkconfig.intersId.length;
622
+ if (length == 0 || length == 1) {
623
+ console.log("re show inters need more than 1 id");
624
+ return;
625
+ }
626
+ if (this.intersLoaded.includes(sdkconfig.ycIntersId)) {
627
+ console.log("reshowInterstitial1: ", sdkconfig.ycIntersId, " already loaded");
628
+ this.intersLoaded = [];
629
+ return;
630
+ }
631
+ this.intersLoaded.push(sdkconfig.ycIntersId);
632
+ this.refreshId("Inters" /* Inters */);
633
+ if (this.intersLoaded.includes(sdkconfig.ycIntersId)) {
634
+ console.log("reshowInterstitial2: ", sdkconfig.ycIntersId, " already loaded");
635
+ this.intersLoaded = [];
636
+ return;
637
+ }
638
+ YCSDK.ins.showInters("Initial" /* Initial */);
639
+ }
640
+ reshowVideo(callback) {
641
+ const length = sdkconfig.videoId.length;
642
+ if (length == 0 || length == 1) {
643
+ console.log("re show video need more than 1 id");
644
+ callback && callback(false);
645
+ return;
646
+ }
647
+ if (this.videoLoaded.includes(sdkconfig.ycVideoId)) {
648
+ console.log("reshowVideo1: ", sdkconfig.ycVideoId, " already loaded");
649
+ callback && callback(false);
650
+ this.videoLoaded = [];
651
+ return;
652
+ }
653
+ this.videoLoaded.push(sdkconfig.ycVideoId);
654
+ this.refreshId("Video" /* Video */);
655
+ if (this.videoLoaded.includes(sdkconfig.ycVideoId)) {
656
+ console.log("reshowVideo2: ", sdkconfig.ycVideoId, " already loaded");
657
+ callback && callback(false);
658
+ this.videoLoaded = [];
659
+ return;
660
+ }
661
+ YCSDK.ins.showVideo(callback);
662
+ }
663
+ refreshAll() {
664
+ const keys = Object.keys(AdType);
665
+ for (const type of keys) {
666
+ this.refreshId(type);
667
+ }
668
+ console.log("refreshAll");
669
+ }
670
+ checkBannerId() {
671
+ var id = sdkconfig.bannerId;
672
+ if (!id) {
673
+ console.log("bannerId is not config");
674
+ return;
675
+ }
676
+ if (!Array.isArray(id)) {
677
+ console.log("bannerId is only one");
678
+ sdkconfig.ycBannerId = id;
679
+ return;
680
+ }
681
+ if (id.length == 1) {
682
+ if (!id[0]) {
683
+ console.log("id[0] config is empty string");
684
+ return;
685
+ }
686
+ sdkconfig.ycBannerId = id[0];
687
+ return;
688
+ }
689
+ if (id.length == 0) {
690
+ console.log("bannerId config is empty");
691
+ return;
692
+ }
693
+ sdkconfig.ycBannerId = id[this.bannerIndex];
694
+ this.bannerIndex += 1;
695
+ if (this.bannerIndex >= id.length) {
696
+ this.bannerIndex = 0;
697
+ }
698
+ }
699
+ checkNativeBannerId() {
700
+ var id = sdkconfig.nativeBannerId;
701
+ if (!id) {
702
+ console.log("native banner id is not config");
703
+ return;
704
+ }
705
+ if (!Array.isArray(id)) {
706
+ console.log("native banner id is only one");
707
+ sdkconfig.ycNativeBannerId = id;
708
+ return;
709
+ }
710
+ if (id.length == 1) {
711
+ if (!id[0]) {
712
+ console.log("id[0] config is empty string");
713
+ return;
714
+ }
715
+ sdkconfig.ycNativeBannerId = id[0];
716
+ return;
717
+ }
718
+ if (id.length == 0) {
719
+ console.log("native banner id config is empty");
720
+ return;
721
+ }
722
+ sdkconfig.ycNativeBannerId = id[this.nativeBannerIndex];
723
+ this.nativeBannerIndex += 1;
724
+ if (this.nativeBannerIndex >= id.length) {
725
+ this.nativeBannerIndex = 0;
726
+ }
727
+ }
728
+ checkIntersId() {
729
+ var id = sdkconfig.intersId;
730
+ if (!id) {
731
+ console.log("intersId is not config");
732
+ return;
733
+ }
734
+ if (!Array.isArray(id)) {
735
+ console.log("intersId is only one");
736
+ sdkconfig.ycIntersId = id;
737
+ return;
738
+ }
739
+ if (id.length == 1) {
740
+ if (!id[0]) {
741
+ console.log("id[0] config is empty string");
742
+ return;
743
+ }
744
+ sdkconfig.ycIntersId = id[0];
745
+ return;
746
+ }
747
+ if (id.length == 0) {
748
+ console.log("intersId config is empty");
749
+ return;
750
+ }
751
+ sdkconfig.ycIntersId = id[this.intersIndex];
752
+ this.intersIndex += 1;
753
+ if (this.intersIndex >= id.length) {
754
+ this.intersIndex = 0;
755
+ }
756
+ }
757
+ checkNativeId() {
758
+ var id = sdkconfig.nativeId;
759
+ if (!id) {
760
+ console.log("nativeId is not config");
761
+ return;
762
+ }
763
+ if (!Array.isArray(id)) {
764
+ console.log("nativeId is only one");
765
+ sdkconfig.ycNativeId = id;
766
+ return;
767
+ }
768
+ if (id.length == 1) {
769
+ if (!id[0]) {
770
+ console.log("id[0] config is empty string");
771
+ return;
772
+ }
773
+ sdkconfig.ycNativeId = id[0];
774
+ return;
775
+ }
776
+ if (id.length == 0) {
777
+ console.log("nativeId config is empty");
778
+ return;
779
+ }
780
+ sdkconfig.ycNativeId = id[this.nativeIndex];
781
+ this.nativeIndex += 1;
782
+ if (this.nativeIndex >= id.length) {
783
+ this.nativeIndex = 0;
784
+ }
785
+ }
786
+ checkVideoId() {
787
+ var id = sdkconfig.videoId;
788
+ if (!id) {
789
+ console.log("videoId is not config");
790
+ return;
791
+ }
792
+ if (!Array.isArray(id)) {
793
+ console.log("videoId is only one");
794
+ sdkconfig.ycVideoId = id;
795
+ return;
796
+ }
797
+ if (id.length == 1) {
798
+ console.log("videoId length is 1");
799
+ if (!id[0]) {
800
+ console.log("id[0] config is empty string");
801
+ return;
802
+ }
803
+ sdkconfig.ycVideoId = id[0];
804
+ return;
805
+ }
806
+ if (id.length == 0) {
807
+ console.log("videoId config is empty");
808
+ return;
809
+ }
810
+ sdkconfig.ycVideoId = id[this.videoIndex];
811
+ this.videoIndex += 1;
812
+ if (this.videoIndex >= id.length) {
813
+ this.videoIndex = 0;
814
+ }
815
+ }
816
+ refreshId(type) {
817
+ console.log("refresh id, type: ", type);
818
+ switch (type) {
819
+ case "Banner" /* Banner */:
820
+ this.checkBannerId();
821
+ break;
822
+ case "NativeBanner" /* NativeBanner */:
823
+ this.checkNativeBannerId();
824
+ break;
825
+ case "Inters" /* Inters */:
826
+ this.checkIntersId();
827
+ break;
828
+ case "Native" /* Native */:
829
+ this.checkNativeId();
830
+ break;
831
+ case "Video" /* Video */:
832
+ this.checkVideoId();
833
+ break;
834
+ }
835
+ }
836
+ random(max) {
837
+ max = Math.floor(max);
838
+ return Math.floor(Math.random() * max);
839
+ }
840
+ refreshBigPic() {
841
+ if (this.timerBigPic) {
842
+ clearTimeout(this.timerBigPic);
843
+ }
844
+ this.timerBigPic = setTimeout(() => {
845
+ YCSDK.ins.showBanner();
846
+ }, 20 * 1e3);
847
+ }
848
+ };
849
+
850
+ // assets/script/ycsdk/minigame/douyin/DouYinGame.ts
851
+ var DouYinGame = class {
852
+ constructor() {
853
+ this.bannerAd = null;
854
+ this.videoAd = null;
855
+ this.callBack = null;
856
+ }
857
+ init() {
858
+ this.initViedoAd(false);
859
+ }
860
+ login(callBack) {
861
+ }
862
+ pay(params, callBack) {
863
+ }
864
+ showBanner(position) {
865
+ if (!sdkconfig.open) {
866
+ console.log("\u5E7F\u544A\u672A\u5F00\u542F");
867
+ return;
868
+ }
869
+ this.hideBanner();
870
+ this.bannerAd = window["tt"].createBannerAd({
871
+ adUnitId: sdkconfig.ycBannerId
872
+ });
873
+ this.bannerAd.onLoad(() => {
874
+ YCSDK.ins.onLoad("Banner" /* Banner */);
875
+ this.bannerAd.show().then(() => {
876
+ YCSDK.ins.onShow("Banner" /* Banner */);
877
+ console.log("\u5E7F\u544A\u663E\u793A\u6210\u529F");
878
+ }).catch((err) => {
879
+ YCSDK.ins.onError("Banner" /* Banner */);
880
+ console.log("\u5E7F\u544A\u7EC4\u4EF6\u51FA\u73B0\u95EE\u9898", err);
881
+ });
882
+ });
883
+ this.bannerAd.onError(({ errorCode, errMsg }) => {
884
+ YCSDK.ins.onError("Banner" /* Banner */);
885
+ console.log(errorCode, errMsg);
886
+ });
887
+ }
888
+ hideBanner() {
889
+ if (this.bannerAd) {
890
+ this.bannerAd.hide();
891
+ this.bannerAd.destroy();
892
+ this.bannerAd = null;
893
+ }
894
+ }
895
+ showInters(type) {
896
+ const interstitialAd = window["tt"].createInterstitialAd({
897
+ adUnitId: sdkconfig.ycIntersId
898
+ });
899
+ interstitialAd.onLoad(() => {
900
+ YCSDK.ins.onLoad("Inters" /* Inters */);
901
+ console.log("interstitialAd load");
902
+ });
903
+ interstitialAd.onError(({ errCode, errMsg }) => {
904
+ YCSDK.ins.onError("Inters" /* Inters */);
905
+ console.log("\u76D1\u542C\u5230\u9519\u8BEF", errCode, errMsg);
906
+ });
907
+ interstitialAd.load().then(() => {
908
+ interstitialAd.show().then(() => {
909
+ YCSDK.ins.onShow("Inters" /* Inters */);
910
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u6210\u529F");
911
+ });
912
+ }).catch((err) => {
913
+ YCSDK.ins.onError("Inters" /* Inters */);
914
+ console.log(err);
915
+ });
916
+ }
917
+ hideInters(type) {
918
+ }
919
+ initViedoAd(show) {
920
+ this.videoAd = window["tt"].createRewardedVideoAd({
921
+ adUnitId: sdkconfig.ycVideoId
922
+ });
923
+ this.videoAd.onLoad(() => {
924
+ YCSDK.ins.onLoad("Video" /* Video */);
925
+ console.log("\u5E7F\u544A\u52A0\u8F7D\u5B8C\u6210");
926
+ });
927
+ this.videoAd.onError((errMsg) => {
928
+ YCSDK.ins.onError("Video" /* Video */);
929
+ console.log("\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", errMsg);
930
+ });
931
+ this.videoAd.onClose((res) => {
932
+ if (res && res.isEnded || res === void 0) {
933
+ console.log("\u5E7F\u544A\u64AD\u653E\u5B8C\u6210");
934
+ this.callBack && this.callBack(true);
935
+ } else {
936
+ console.log("\u5E7F\u544A\u64AD\u653E\u672A\u5B8C\u6210");
937
+ this.callBack && this.callBack(false);
938
+ }
939
+ });
940
+ if (show) {
941
+ this.videoAd.load().then(() => {
942
+ this.videoAd.show().then(() => {
943
+ YCSDK.ins.onShow("Video" /* Video */);
944
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u6210\u529F");
945
+ }).catch((err) => {
946
+ YCSDK.ins.onError("Video" /* Video */);
947
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", err);
948
+ });
949
+ });
950
+ } else {
951
+ this.videoAd.load();
952
+ }
953
+ }
954
+ showVideo(callBack) {
955
+ this.callBack = callBack;
956
+ if (!sdkconfig.ycVideoId) {
957
+ console.log("\u8BF7\u914D\u7F6E\u6FC0\u52B1\u89C6\u9891\u5E7F\u544AID");
958
+ callBack && callBack(false);
959
+ YCSDK.ins.onError("Video" /* Video */);
960
+ return false;
961
+ }
962
+ if (this.videoAd) {
963
+ this.videoAd.show().then(() => {
964
+ YCSDK.ins.onShow("Video" /* Video */);
965
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u6210\u529F");
966
+ }).catch((err) => {
967
+ YCSDK.ins.onError("Video" /* Video */);
968
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", err);
969
+ });
970
+ return true;
971
+ }
972
+ this.initViedoAd(true);
973
+ return false;
974
+ }
975
+ customFunc(methodName, params, callBack) {
976
+ }
977
+ };
978
+
979
+ // assets/script/ycsdk/minigame/HttpRequest.ts
980
+ var HttpRequest = class _HttpRequest {
981
+ static {
982
+ this.AUTHORIZATION = "Authorization";
983
+ }
984
+ static {
985
+ this.CONTENT_TYPE = "Content-Type";
986
+ }
987
+ static {
988
+ this.Accept = "Accept";
989
+ }
990
+ static get() {
991
+ if (!_HttpRequest.instance) {
992
+ _HttpRequest.instance = new _HttpRequest();
993
+ }
994
+ return _HttpRequest.instance;
995
+ }
996
+ requestPostx3w(url, data, callback, head) {
997
+ console.log("HttpRequest url:", url);
998
+ console.log("HttpRequest data:", JSON.stringify(data));
999
+ this.httpRequest = new XMLHttpRequest();
1000
+ this.httpRequest.onreadystatechange = function() {
1001
+ console.log("HttpRequest", "onreadystatechange:", this.readyState, this.status);
1002
+ if (this.readyState == 4 && this.status == 200) {
1003
+ let res = JSON.parse(this.responseText);
1004
+ console.log("HttpRequest", "response:", JSON.stringify(res));
1005
+ if (res.status == 200) {
1006
+ callback(true, res.data);
1007
+ } else {
1008
+ callback(false, res);
1009
+ }
1010
+ }
1011
+ };
1012
+ this.httpRequest.timeout = 5e3;
1013
+ this.httpRequest.ontimeout = () => {
1014
+ console.log("HttpRequest:", "request time out", url);
1015
+ callback(false);
1016
+ };
1017
+ this.httpRequest.onerror = function(e) {
1018
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1019
+ callback(false);
1020
+ };
1021
+ this.httpRequest.open("POST", url, true);
1022
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1023
+ if (head) {
1024
+ this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1025
+ }
1026
+ this.httpRequest.send(data);
1027
+ }
1028
+ requestGetx3w(url, data, callback, head) {
1029
+ console.log("HttpRequest url:", url);
1030
+ console.log("HttpRequest data:", JSON.stringify(data));
1031
+ this.httpRequest = new XMLHttpRequest();
1032
+ this.httpRequest.onreadystatechange = function() {
1033
+ if (this.readyState == 4 && this.status == 200) {
1034
+ let response = this.responseText.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2');
1035
+ let res = JSON.parse(response);
1036
+ console.log("HttpRequest", "response:", JSON.stringify(res));
1037
+ if (res.status == 200) {
1038
+ callback(true, res.data);
1039
+ } else {
1040
+ callback(false, res);
1041
+ }
1042
+ }
1043
+ };
1044
+ this.httpRequest.timeout = 5e3;
1045
+ this.httpRequest.ontimeout = () => {
1046
+ console.log("HttpRequest:", "request time out", url);
1047
+ callback(false);
1048
+ };
1049
+ this.httpRequest.onerror = function(e) {
1050
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1051
+ callback(false);
1052
+ };
1053
+ this.httpRequest.open("GET", url, true);
1054
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1055
+ if (head) {
1056
+ this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1057
+ }
1058
+ this.httpRequest.send(data);
1059
+ }
1060
+ requestPostjson(url, data, callback, head) {
1061
+ console.log("HttpRequest url:", url);
1062
+ this.httpRequest = new XMLHttpRequest();
1063
+ this.httpRequest.onreadystatechange = function() {
1064
+ if (this.readyState == 4 && this.status == 200) {
1065
+ let res = JSON.parse(this.responseText);
1066
+ console.log("HttpRequest", "response:", JSON.stringify(res));
1067
+ if (res.code == 0) {
1068
+ callback(true, res.data.config);
1069
+ } else {
1070
+ callback(false, res);
1071
+ }
1072
+ }
1073
+ };
1074
+ this.httpRequest.timeout = 3e3;
1075
+ this.httpRequest.ontimeout = () => {
1076
+ console.log("HttpRequest:", "request time out", url);
1077
+ callback(false);
1078
+ };
1079
+ this.httpRequest.onerror = function(e) {
1080
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1081
+ callback(false);
1082
+ };
1083
+ this.httpRequest.open("POST", url, true);
1084
+ this.httpRequest.setRequestHeader(_HttpRequest.Accept, "application/json" /* APPLICATION_JSON */);
1085
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/json" /* APPLICATION_JSON */);
1086
+ this.httpRequest.send(JSON.stringify(data));
1087
+ }
1088
+ };
1089
+
1090
+ // assets/script/ycsdk/minigame/huawei/HuaWeiGame.ts
1091
+ import { assetManager, instantiate, Label, Node, Prefab, resources, Sprite, SpriteFrame, Texture2D } from "cc";
1092
+ var HuaWeiGame = class {
1093
+ constructor() {
1094
+ this.qg = window["qg"];
1095
+ }
1096
+ hideInters(type) {
1097
+ }
1098
+ customFunc(methodName, params, callBack) {
1099
+ }
1100
+ init(callBack) {
1101
+ callBack && callBack();
1102
+ this.loadVideo(this.callback);
1103
+ }
1104
+ login(callBack) {
1105
+ this.qg.gameLoginWithReal({
1106
+ forceLogin: 1,
1107
+ appid: sdkconfig.version,
1108
+ success: function(data) {
1109
+ callBack && callBack(true);
1110
+ console.log(" game login with real success:" + JSON.stringify(data));
1111
+ },
1112
+ fail: function(data, code) {
1113
+ console.log("game login with real fail:" + data + ", code:" + code);
1114
+ if (code == 7004 || code == 2012) {
1115
+ console.log("\u73A9\u5BB6\u53D6\u6D88\u767B\u5F55\uFF0C\u8FD4\u56DE\u6E38\u620F\u754C\u9762\u8BA9\u73A9\u5BB6\u91CD\u65B0\u767B\u5F55\u3002");
1116
+ callBack && callBack(false, 7004);
1117
+ }
1118
+ if (code == 7021) {
1119
+ callBack && callBack(false, 7021);
1120
+ console.log("\u73A9\u5BB6\u53D6\u6D88\u5B9E\u540D\u8BA4\u8BC1\uFF0C\u7981\u6B62\u8FDB\u5165\u6E38\u620F");
1121
+ }
1122
+ }
1123
+ });
1124
+ }
1125
+ pay(params, callBack) {
1126
+ }
1127
+ createPurchaseIntent(params, callBack) {
1128
+ }
1129
+ doCheck(content, sign, publicKey) {
1130
+ if (!sign || !publicKey) {
1131
+ return false;
1132
+ }
1133
+ }
1134
+ consumeOwnedPurchase() {
1135
+ }
1136
+ showBanner(position) {
1137
+ if (!sdkconfig.ycBannerId) {
1138
+ console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1139
+ return;
1140
+ }
1141
+ this.hideBanner();
1142
+ if (this.bannerAd) {
1143
+ this.bannerAd.destroy();
1144
+ this.bannerAd = null;
1145
+ }
1146
+ var sysInfo = this.qg.getSystemInfoSync();
1147
+ var bannerTop = sysInfo.safeArea.height;
1148
+ this.bannerAd = this.qg.createBannerAd({
1149
+ adUnitId: sdkconfig.ycBannerId,
1150
+ adIntervals: 45,
1151
+ //刷新时间
1152
+ style: {
1153
+ top: bannerTop - 60,
1154
+ left: 0,
1155
+ height: 60,
1156
+ width: 360
1157
+ }
1158
+ });
1159
+ this.bannerAd.onError((err) => {
1160
+ console.log("huawei banner error: ", JSON.stringify(err));
1161
+ if (this.bannerAd) {
1162
+ this.bannerAd.destroy();
1163
+ this.bannerAd = null;
1164
+ }
1165
+ YCSDK.ins.onError("Banner" /* Banner */);
1166
+ });
1167
+ this.bannerAd.onLoad(() => {
1168
+ console.log("huawei banner on load");
1169
+ YCSDK.ins.onLoad("Banner" /* Banner */);
1170
+ YCSDK.ins.onShow("Banner" /* Banner */);
1171
+ });
1172
+ this.bannerAd.onClose(() => {
1173
+ console.log("huawei banner on close");
1174
+ if (this.bannerAd) {
1175
+ this.bannerAd.destroy();
1176
+ this.bannerAd = null;
1177
+ }
1178
+ YCSDK.ins.onClose("Banner" /* Banner */);
1179
+ });
1180
+ setTimeout(() => {
1181
+ this.bannerAd.show();
1182
+ }, 1e3);
1183
+ }
1184
+ hideBanner() {
1185
+ if (!this.bannerAd) {
1186
+ console.log("huawei banner ad is hide");
1187
+ return;
1188
+ }
1189
+ this.bannerAd.hide();
1190
+ }
1191
+ showInters(type) {
1192
+ switch (type) {
1193
+ case "Initial" /* Initial */:
1194
+ case "Video" /* Video */:
1195
+ this.showIntersVideo();
1196
+ break;
1197
+ case "Native" /* Native */:
1198
+ this.showNative();
1199
+ break;
1200
+ }
1201
+ }
1202
+ showNative() {
1203
+ if (!sdkconfig.ycNativeId) {
1204
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1205
+ return;
1206
+ }
1207
+ let nativeAd = this.qg.createNativeAd({
1208
+ adUnitId: sdkconfig.ycNativeId,
1209
+ success: (code) => {
1210
+ console.log("loadNativeAd success: ", code);
1211
+ },
1212
+ fail: (data, code) => {
1213
+ console.log("loadNativeAd fail: " + data + "," + code);
1214
+ nativeAd.destroy();
1215
+ }
1216
+ });
1217
+ nativeAd.offLoad();
1218
+ nativeAd.onLoad((data) => {
1219
+ YCSDK.ins.onLoad("Native" /* Native */);
1220
+ let ad = data.adList[0];
1221
+ this.renderNative(ad, nativeAd);
1222
+ });
1223
+ nativeAd.offError();
1224
+ nativeAd.onError((e) => {
1225
+ console.error("load ad error:" + JSON.stringify(e));
1226
+ nativeAd.destroy();
1227
+ YCSDK.ins.onError("Native" /* Native */);
1228
+ });
1229
+ nativeAd.load();
1230
+ }
1231
+ // appName: 百度极速版
1232
+ // developerName: 百度在线网络技术(北京)有限公司
1233
+ // versionName: 6.55.0.10
1234
+ // privacyUrl: https://h5hosting-drcn.dbankcdn.cn/cch5/PPS/ssp-privacy-url/index.html?src=https%3A%2F%2Fs.bdstatic.com%2Fcommon%2Fagreement%2Fprivacy_new_lite.html
1235
+ // permissionUrl: https://appgallery.huawei.com/open/permission?packageName=com.baidu.searchbox.lite&mediaPackageName=com.tl.lxndwzxyx.huawei
1236
+ // appDetailUrl: https://appgallery.huawei.com/#/app_simple/C100029965
1237
+ // imgUrlList: https://contentcenter-drcn.dbankcdn.cn/img/pub_17/PPS_realtimeimage_100_1/e1/v3/A667xiJZQ7SMM7cmqhmMXw/0Vm6YJiyTH-IloGzbCUO5w.png/__source__.jpg
1238
+ // adId: 51790be2-d2c2-48ca-9695-1a55bed81905
1239
+ // creativeType: 103
1240
+ renderNative(adItem, nativeAd) {
1241
+ resources.load("Privacy/bg", Prefab, (err, prefab) => {
1242
+ if (err) {
1243
+ console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
1244
+ YCSDK.ins.onError("Native" /* Native */);
1245
+ return;
1246
+ }
1247
+ const node = instantiate(prefab);
1248
+ const native = node.getChildByName("native");
1249
+ const close = native.getChildByName("close");
1250
+ const title = native.getChildByName("title").getComponent(Label);
1251
+ title.string = adItem.appName;
1252
+ const source = native.getChildByName("source").getComponent(Label);
1253
+ source.string = adItem.source;
1254
+ const company = native.getChildByName("company").getComponent(Label);
1255
+ company.string = adItem.developerName;
1256
+ const pic = native.getChildByName("pic");
1257
+ const info = native.getChildByName("info");
1258
+ const version = info.getChildByName("verison");
1259
+ version.on(Node.EventType.TOUCH_END, () => {
1260
+ console.log("change version");
1261
+ version.getComponent(Label).string = adItem.versionName;
1262
+ });
1263
+ const description = info.getChildByName("description");
1264
+ description.on(Node.EventType.TOUCH_END, () => {
1265
+ console.log("open description");
1266
+ this.qg.openDeeplink({ uri: adItem.appDetailUrl });
1267
+ });
1268
+ const privacy = info.getChildByName("privacy");
1269
+ privacy.on(Node.EventType.TOUCH_END, () => {
1270
+ console.log("open privacy");
1271
+ this.qg.openDeeplink({ uri: adItem.privacyUrl });
1272
+ });
1273
+ const permission = info.getChildByName("permission");
1274
+ permission.on(Node.EventType.TOUCH_END, () => {
1275
+ console.log("open permission");
1276
+ this.qg.openDeeplink({ uri: adItem.permissionUrl });
1277
+ });
1278
+ pic.on(Node.EventType.TOUCH_END, () => {
1279
+ console.log("native click");
1280
+ YCSDK.ins.onClick("Native" /* Native */);
1281
+ nativeAd.reportAdClick({ adId: adItem.adId });
1282
+ });
1283
+ close.on(Node.EventType.TOUCH_END, () => {
1284
+ console.log("close native");
1285
+ nativeAd.destroy();
1286
+ node.destroy();
1287
+ YCSDK.ins.getGameNode().removeChild(node);
1288
+ nativeAd.hideDownloadButton({
1289
+ adId: adItem.adId,
1290
+ success: (code) => {
1291
+ console.log("hideDownloadButton: success");
1292
+ },
1293
+ fail: (data, code) => {
1294
+ console.log(" hideDownloadButton fail: " + data + "," + code);
1295
+ }
1296
+ });
1297
+ YCSDK.ins.onClose("Native" /* Native */);
1298
+ });
1299
+ assetManager.loadRemote(adItem.imgUrlList[0], (err2, image) => {
1300
+ if (err2) {
1301
+ console.error("\u52A0\u8F7D\u8FDC\u7A0B\u56FE\u7247\u5931\u8D25:", err2);
1302
+ YCSDK.ins.onError("Native" /* Native */);
1303
+ return;
1304
+ }
1305
+ const texture = new Texture2D();
1306
+ texture.image = image;
1307
+ let spriteFrame = new SpriteFrame();
1308
+ spriteFrame.texture = texture;
1309
+ pic.getComponent(Sprite).spriteFrame = spriteFrame;
1310
+ YCSDK.ins.getGameNode().addChild(node);
1311
+ YCSDK.ins.onShow("Native" /* Native */);
1312
+ this.showNativeDownload(adItem, nativeAd, node);
1313
+ nativeAd.reportAdShow({ adId: adItem.adId });
1314
+ });
1315
+ });
1316
+ }
1317
+ showNativeDownload(adItem, nativeAd, node) {
1318
+ const { screenWidth, screenHeight } = this.qg.getSystemInfoSync();
1319
+ console.log(screenWidth);
1320
+ console.log(screenHeight);
1321
+ nativeAd.showDownloadButton({
1322
+ adId: adItem.adId,
1323
+ style: {
1324
+ left: screenWidth / 2 - screenWidth / 4,
1325
+ top: screenHeight * 0.65,
1326
+ heightType: "normal",
1327
+ width: screenWidth / 2,
1328
+ fixedWidth: true,
1329
+ textSize: 50,
1330
+ horizontalPadding: 50,
1331
+ cornerRadius: 22,
1332
+ normalTextColor: "#FFFFFF",
1333
+ normalBackground: "#5291FF",
1334
+ pressedColor: "#0A59F7",
1335
+ normalStroke: 5,
1336
+ normalStrokeCorlor: "#FF000000",
1337
+ processingTextColor: "#5291FF",
1338
+ processingBackground: "#0F000000",
1339
+ processingColor: "#000000",
1340
+ processingStroke: 10,
1341
+ processingStrokeCorlor: "#0A59F7",
1342
+ installingTextColor: "#000000",
1343
+ installingBackground: "#FFFFFF",
1344
+ installingStroke: 15,
1345
+ installingStrokeCorlor: "#5291FF"
1346
+ },
1347
+ success: (code) => {
1348
+ console.log("showDownloadButton: success");
1349
+ },
1350
+ fail: (data, code) => {
1351
+ console.log("showDownloadButton fail: " + data + "," + code);
1352
+ }
1353
+ });
1354
+ }
1355
+ showIntersVideo() {
1356
+ if (!sdkconfig.ycIntersId) {
1357
+ console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
1358
+ return;
1359
+ }
1360
+ let interstitialAd = this.qg.createInterstitialAd({
1361
+ adUnitId: sdkconfig.ycIntersId
1362
+ });
1363
+ interstitialAd.onLoad(function(data) {
1364
+ YCSDK.ins.onLoad("Inters" /* Inters */);
1365
+ console.log("huawei inters onLoad data " + JSON.stringify(data));
1366
+ interstitialAd.show();
1367
+ YCSDK.ins.onShow("Inters" /* Inters */);
1368
+ });
1369
+ interstitialAd.onError((err) => {
1370
+ interstitialAd.destroy();
1371
+ console.log("huawei inters on error: ", JSON.stringify(err));
1372
+ YCSDK.ins.onError("Inters" /* Inters */);
1373
+ });
1374
+ interstitialAd.onClose(() => {
1375
+ console.log("huawei interstitialAd closed");
1376
+ interstitialAd.destroy();
1377
+ YCSDK.ins.onClose("Inters" /* Inters */);
1378
+ });
1379
+ interstitialAd.load();
1380
+ }
1381
+ showVideo(callBack) {
1382
+ this.callback = callBack;
1383
+ let lastCallTime = 0;
1384
+ let nowCallTime = (/* @__PURE__ */ new Date()).getTime();
1385
+ if (lastCallTime != 0 && nowCallTime - lastCallTime < 400) {
1386
+ console.log("show video time too many");
1387
+ return;
1388
+ }
1389
+ lastCallTime = nowCallTime;
1390
+ if (this.rewardedVideoAd && this.callback) {
1391
+ this.show();
1392
+ return;
1393
+ }
1394
+ this.loadVideo(true);
1395
+ return false;
1396
+ }
1397
+ loadVideo(show) {
1398
+ if (!sdkconfig.ycVideoId) {
1399
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1400
+ this.callback && this.callback(false);
1401
+ return;
1402
+ }
1403
+ this.rewardedVideoAd = this.qg.createRewardedVideoAd({
1404
+ adUnitId: sdkconfig.ycVideoId,
1405
+ success: (code) => {
1406
+ console.log("loadVideoAd createRewardedVideoAd success" + code);
1407
+ },
1408
+ fail: (data, code) => {
1409
+ console.log("loadVideoAd createRewardedVideoAd fail: " + data + "," + code);
1410
+ }
1411
+ });
1412
+ this.rewardedVideoAd.onLoad(() => {
1413
+ console.log("loadVideoAd: ad loaded.");
1414
+ YCSDK.ins.onLoad("Video" /* Video */);
1415
+ if (show) {
1416
+ this.show();
1417
+ }
1418
+ });
1419
+ this.rewardedVideoAd.onError((e) => {
1420
+ console.error("load ad error:" + JSON.stringify(e));
1421
+ this.callback && this.callback(false);
1422
+ YCSDK.ins.onError("Video" /* Video */, this.callback);
1423
+ });
1424
+ this.rewardedVideoAd.onClose((res) => {
1425
+ console.log("ad onClose: " + res.isEnded);
1426
+ YCSDK.ins.onClose("Video" /* Video */);
1427
+ if (res && res.isEnded || res === void 0) {
1428
+ console.log("\u64AD\u653E\u6FC0\u52B1\u89C6\u9891\u7ED3\u675F\uFF0C\u7ED9\u4E88\u5956\u52B1");
1429
+ this.callback && this.callback(true);
1430
+ YCSDK.ins.onReward();
1431
+ } else {
1432
+ this.callback && this.callback(false);
1433
+ console.log("\u64AD\u653E\u6CA1\u7ED3\u675F\uFF0C\u4E0D\u7ED9\u4E88\u5956\u52B1");
1434
+ }
1435
+ this.rewardedVideoAd.load();
1436
+ });
1437
+ this.rewardedVideoAd.load();
1438
+ }
1439
+ show() {
1440
+ if (this.rewardedVideoAd) {
1441
+ this.rewardedVideoAd.show();
1442
+ YCSDK.ins.onShow("Video" /* Video */);
1443
+ }
1444
+ }
1445
+ };
1446
+
1447
+ // assets/script/ycsdk/minigame/oppo/OppoGame.ts
1448
+ var OppoGame = class {
1449
+ constructor() {
1450
+ this.qg = window["qg"];
1451
+ this.count = 0;
1452
+ console.log("current channel is oppo");
1453
+ }
1454
+ init(callback) {
1455
+ if (sdkconfig.subornUserTest) {
1456
+ sdkconfig.subornUser = true;
1457
+ this.config();
1458
+ callback && callback();
1459
+ return;
1460
+ }
1461
+ const info = this.qg.getEnterOptionsSync();
1462
+ console.log("oppo init: ", info);
1463
+ if (info) {
1464
+ const type = info.type;
1465
+ const query = info.query;
1466
+ const referrerInfo = info.referrerInfo;
1467
+ if (query && query.key1 && query.key2) {
1468
+ sdkconfig.subornUser = true;
1469
+ this.config();
1470
+ }
1471
+ }
1472
+ callback && callback();
1473
+ }
1474
+ config() {
1475
+ this.loadVideoAdNoCallBack();
1476
+ }
1477
+ login(callBack) {
1478
+ }
1479
+ pay(params, callBack) {
1480
+ }
1481
+ showBanner(position = "Bottom" /* Bottom */) {
1482
+ if (!sdkconfig.ycBannerId) {
1483
+ console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1484
+ return;
1485
+ }
1486
+ this.hideBanner();
1487
+ this.createBannerAd(position);
1488
+ }
1489
+ createBannerAd(position) {
1490
+ if (this.bannerAd) {
1491
+ this.bannerAd.destroy();
1492
+ this.bannerAd = null;
1493
+ }
1494
+ this.bannerAd = this.qg.createBannerAd({ adUnitId: sdkconfig.ycBannerId });
1495
+ this.bannerAd.onResize((obj) => {
1496
+ console.log("banner \u5BBD\u5EA6\uFF1A" + obj.width + ", banner \u9AD8\u5EA6\uFF1A" + obj.height);
1497
+ });
1498
+ this.bannerAd.onLoad(() => {
1499
+ console.log("[Banner\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1500
+ YCSDK.ins.onLoad("Banner" /* Banner */);
1501
+ YCSDK.ins.onShow("Banner" /* Banner */);
1502
+ });
1503
+ this.bannerAd.onHide(() => {
1504
+ console.log("banner\u5E7F\u544A\u9690\u85CF");
1505
+ YCSDK.ins.onClose("Banner" /* Banner */);
1506
+ if (this.bannerAd) {
1507
+ this.bannerAd.destroy();
1508
+ this.bannerAd = null;
1509
+ }
1510
+ this.refreshBanner();
1511
+ });
1512
+ this.bannerAd.onError((err) => {
1513
+ console.log("banner\u9519\u8BEF\u76D1\u542C: ", JSON.stringify(err));
1514
+ if (this.bannerAd) {
1515
+ this.bannerAd.destroy();
1516
+ this.bannerAd = null;
1517
+ }
1518
+ YCSDK.ins.onError("Banner" /* Banner */);
1519
+ });
1520
+ this.bannerAd.onClick((obj) => {
1521
+ console.log(`\u5F00\u542FBanner\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
1522
+ });
1523
+ this.bannerAd.show();
1524
+ }
1525
+ refreshBanner() {
1526
+ if (this.timerBanner) {
1527
+ clearTimeout(this.timerBanner);
1528
+ this.timerBanner = 0;
1529
+ }
1530
+ this.timerBanner = setTimeout(() => {
1531
+ this.createBannerAd("Bottom" /* Bottom */);
1532
+ }, 30 * 1e3);
1533
+ }
1534
+ hideBanner() {
1535
+ console.log("oppo hide banner");
1536
+ if (this.bannerAd) {
1537
+ this.bannerAd.hide();
1538
+ }
1539
+ }
1540
+ hideBigPicAd() {
1541
+ console.log("oppo hide bigPicAd");
1542
+ if (this.bigPicAd) {
1543
+ this.bigPicAd.hide();
1544
+ }
1545
+ }
1546
+ showInters(type) {
1547
+ switch (type) {
1548
+ case "Initial" /* Initial */:
1549
+ this.showInitialType();
1550
+ break;
1551
+ case "Native" /* Native */:
1552
+ this.showNativeType();
1553
+ break;
1554
+ case "Video" /* Video */:
1555
+ this.showVideo(() => {
1556
+ console.log("oppo video ad show success");
1557
+ });
1558
+ break;
1559
+ }
1560
+ }
1561
+ showInitialType() {
1562
+ if (!sdkconfig.ycIntersId) {
1563
+ console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
1564
+ return;
1565
+ }
1566
+ if (this.qg.getSystemInfoSync().platformVersionCode < 1061) {
1567
+ console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1061,\u6682\u4E0D\u652F\u6301\u63D2\u5C4F\u5E7F\u544A\u76F8\u5173 API");
1568
+ return;
1569
+ }
1570
+ var interstitialAd = this.qg.createInterstitialAd({
1571
+ adUnitId: sdkconfig.ycIntersId
1572
+ });
1573
+ interstitialAd.onLoad(function() {
1574
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1575
+ YCSDK.ins.onLoad("Inters" /* Inters */);
1576
+ interstitialAd.show();
1577
+ });
1578
+ interstitialAd.onClose(function() {
1579
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u5173\u95ED");
1580
+ YCSDK.ins.onClose("Inters" /* Inters */);
1581
+ });
1582
+ interstitialAd.onError(function(err) {
1583
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u51FA\u9519: ", err);
1584
+ interstitialAd.destroy();
1585
+ interstitialAd = null;
1586
+ YCSDK.ins.onError("Inters" /* Inters */);
1587
+ });
1588
+ interstitialAd.load();
1589
+ }
1590
+ showNativeType() {
1591
+ if (!sdkconfig.ycNativeId) {
1592
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1593
+ return;
1594
+ }
1595
+ if (this.qg.getSystemInfoSync().platformVersionCode < 1094) {
1596
+ console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1094,\u6682\u4E0D\u652F\u6301\u539F\u751F\u6A21\u677F\u5E7F\u544A\u76F8\u5173API");
1597
+ return;
1598
+ }
1599
+ this.hideBigPicAd();
1600
+ if (this.nativeAd) {
1601
+ this.nativeAd.destroy();
1602
+ this.nativeAd = null;
1603
+ }
1604
+ this.nativeAd = this.qg.createCustomAd({
1605
+ adUnitId: sdkconfig.ycNativeId,
1606
+ style: {
1607
+ //开发者自行设置
1608
+ top: this.qg.getSystemInfoSync().windowHeight * 0.3,
1609
+ left: 0,
1610
+ width: this.qg.getSystemInfoSync().screenWidth
1611
+ }
1612
+ });
1613
+ this.nativeAd.onLoad(() => {
1614
+ console.log("[\u539F\u751F\u6A21\u677F\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1615
+ YCSDK.ins.onLoad("Native" /* Native */);
1616
+ });
1617
+ this.nativeAd.onClick((obj) => {
1618
+ console.log(`\u539F\u751F\u6A21\u677F\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
1619
+ YCSDK.ins.onClick("Native" /* Native */);
1620
+ });
1621
+ this.nativeAd.onHide(() => {
1622
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u9690\u85CF");
1623
+ if (this.nativeAd) {
1624
+ this.nativeAd.destroy();
1625
+ this.nativeAd = null;
1626
+ }
1627
+ YCSDK.ins.onClose("Native" /* Native */);
1628
+ });
1629
+ this.nativeAd.onError((err) => {
1630
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u9519\u8BEF\u76D1\u542C\uFF1A", JSON.stringify(err));
1631
+ if (this.nativeAd) {
1632
+ this.nativeAd.destroy();
1633
+ this.nativeAd = null;
1634
+ }
1635
+ YCSDK.ins.onError("Native" /* Native */);
1636
+ });
1637
+ this.nativeAd.show().then(() => {
1638
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544Apromise \u56DE\u8C03\uFF1A\u5C55\u793A\u6210\u529F");
1639
+ YCSDK.ins.onShow("Native" /* Native */);
1640
+ }).catch((err) => {
1641
+ console.log(`\u539F\u751F\u6A21\u677F\u5E7F\u544Apromise \u56DE\u8C03\uFF1A\u5C55\u793A\u5931\u8D25 ${JSON.stringify(err)}`);
1642
+ });
1643
+ }
1644
+ hideInters(type) {
1645
+ if (type = "Native" /* Native */) {
1646
+ if (!!this.nativeAd) {
1647
+ this.nativeAd.hide();
1648
+ }
1649
+ }
1650
+ }
1651
+ showVideo(callBack) {
1652
+ console.log("oppo video ad start show");
1653
+ this.loadVideoAd(callBack);
1654
+ return false;
1655
+ }
1656
+ loadVideoAd(videoCallBack) {
1657
+ if (!sdkconfig.ycVideoId) {
1658
+ console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1659
+ videoCallBack && videoCallBack(false);
1660
+ return;
1661
+ }
1662
+ const videoAd = this.qg.createRewardedVideoAd({
1663
+ adUnitId: sdkconfig.ycVideoId
1664
+ });
1665
+ videoAd.onLoad(() => {
1666
+ console.log("oppo video load success");
1667
+ YCSDK.ins.onLoad("Video" /* Video */);
1668
+ videoAd.show();
1669
+ YCSDK.ins.onShow("Video" /* Video */);
1670
+ });
1671
+ videoAd.onError((err) => {
1672
+ console.log("onError:" + JSON.stringify(err));
1673
+ videoAd.destroy();
1674
+ YCSDK.ins.onError("Video" /* Video */, videoCallBack);
1675
+ });
1676
+ videoAd.onClick(function(obj) {
1677
+ console.log(`on click: code: ${obj.code}, msg: '${obj.msg}'`);
1678
+ YCSDK.ins.onClick("Video" /* Video */);
1679
+ });
1680
+ videoAd.onClose((res) => {
1681
+ YCSDK.ins.onClose("Video" /* Video */);
1682
+ console.log("==> oppoRewardVideoAd onClose", res);
1683
+ if (res == void 0) {
1684
+ videoCallBack && videoCallBack(true);
1685
+ YCSDK.ins.onReward();
1686
+ } else {
1687
+ if (res.isEnded) {
1688
+ videoCallBack && videoCallBack(true);
1689
+ YCSDK.ins.onReward();
1690
+ } else {
1691
+ console.log("\u5E7F\u544A\u6CA1\u770B\u5B8C");
1692
+ YCSDK.ins.onClose("Video" /* Video */);
1693
+ }
1694
+ }
1695
+ });
1696
+ videoAd.load();
1697
+ }
1698
+ loadVideoAdNoCallBack() {
1699
+ if (!sdkconfig.ycVideoId) {
1700
+ console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1701
+ return;
1702
+ }
1703
+ const videoAd = this.qg.createRewardedVideoAd({
1704
+ adUnitId: sdkconfig.ycVideoId
1705
+ });
1706
+ videoAd.onLoad(() => {
1707
+ console.log("oppo video load success");
1708
+ videoAd.show();
1709
+ });
1710
+ videoAd.onError((err) => {
1711
+ console.log("onError:" + JSON.stringify(err));
1712
+ YCSDK.ins.onError("Video" /* Video */);
1713
+ });
1714
+ videoAd.onClose((res) => {
1715
+ this.count++;
1716
+ console.log("oppo video count: ", this.count);
1717
+ if (this.count >= 3) {
1718
+ return;
1719
+ }
1720
+ this.loadVideoAdNoCallBack();
1721
+ });
1722
+ videoAd.load();
1723
+ YCSDK.ins.onLoad("Video" /* Video */);
1724
+ }
1725
+ customFunc(methodName, params, callBack) {
1726
+ console.log("oppo custom function name:", methodName);
1727
+ }
1728
+ };
1729
+
1730
+ // assets/script/ycsdk/minigame/vivo/VivoGame.ts
1731
+ import { view as view2 } from "cc";
1732
+ var VivoGame = class {
1733
+ constructor() {
1734
+ this.qg = window["qg"];
1735
+ this.bannerShowing = false;
1736
+ }
1737
+ init() {
1738
+ this.platformVersionCode = this.qg.getSystemInfoSync().platformVersionCode;
1739
+ console.log("vivo platformVersionCode: ", this.platformVersionCode);
1740
+ }
1741
+ login(callBack) {
1742
+ }
1743
+ pay(params, callBack) {
1744
+ }
1745
+ showBanner(position) {
1746
+ if (this.platformVersionCode < 1031) {
1747
+ console.log("platformVersionCode below 1031, can't show banner");
1748
+ return;
1749
+ }
1750
+ if (!sdkconfig.ycBannerId) {
1751
+ console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1752
+ return;
1753
+ }
1754
+ if (this.bannerShowing) {
1755
+ console.log("banner\u5E7F\u544A\u5C55\u793A\u4E2D");
1756
+ return;
1757
+ }
1758
+ this.hideBanner();
1759
+ this.bannerShowing = true;
1760
+ this.bannerAd = this.qg.createBannerAd({
1761
+ posId: sdkconfig.ycBannerId,
1762
+ adIntervals: 35,
1763
+ style: {}
1764
+ });
1765
+ this.bannerAd.onLoad(() => {
1766
+ console.log("banner load");
1767
+ this.bannerShowing = true;
1768
+ YCSDK.ins.onLoad("Banner" /* Banner */);
1769
+ });
1770
+ this.bannerAd.onClose(() => {
1771
+ console.log("banner close");
1772
+ this.bannerShowing = false;
1773
+ YCSDK.ins.onClose("Banner" /* Banner */);
1774
+ });
1775
+ this.bannerAd.onError((err) => {
1776
+ console.log("banner\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25:", err);
1777
+ this.bannerShowing = false;
1778
+ YCSDK.ins.onError("Banner" /* Banner */);
1779
+ });
1780
+ this.bannerAd.show().then(() => {
1781
+ console.log("banner\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
1782
+ YCSDK.ins.onShow("Banner" /* Banner */);
1783
+ this.bannerShowing = true;
1784
+ }).catch((err) => {
1785
+ this.bannerShowing = false;
1786
+ console.log("banner\u5E7F\u544A\u5C55\u793A\u5931\u8D25:", JSON.stringify(err));
1787
+ YCSDK.ins.onError("Banner" /* Banner */);
1788
+ });
1789
+ }
1790
+ hideBanner() {
1791
+ this.bannerShowing = false;
1792
+ if (this.bannerAd) {
1793
+ this.bannerAd.hide();
1794
+ this.bannerAd.destroy();
1795
+ this.bannerAd = null;
1796
+ }
1797
+ }
1798
+ showInters(type) {
1799
+ switch (type) {
1800
+ case "Native" /* Native */:
1801
+ this.showNative();
1802
+ break;
1803
+ case "Initial" /* Initial */:
1804
+ case "Video" /* Video */:
1805
+ this.showInitial();
1806
+ break;
1807
+ }
1808
+ }
1809
+ showInitial() {
1810
+ if (this.platformVersionCode < 1031) {
1811
+ console.log("platformVersionCode below 1031, can't show interstitialAd");
1812
+ return;
1813
+ }
1814
+ if (!sdkconfig.ycIntersId) {
1815
+ console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
1816
+ return;
1817
+ }
1818
+ let interstitialAd = this.qg.createInterstitialAd({
1819
+ posId: sdkconfig.ycIntersId
1820
+ });
1821
+ interstitialAd.onError((err) => {
1822
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
1823
+ YCSDK.ins.onError("Inters" /* Inters */);
1824
+ });
1825
+ interstitialAd.onLoad(() => {
1826
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1827
+ YCSDK.ins.onLoad("Inters" /* Inters */);
1828
+ });
1829
+ interstitialAd.onClose(() => {
1830
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u5173\u95ED");
1831
+ YCSDK.ins.onClose("Inters" /* Inters */);
1832
+ });
1833
+ interstitialAd.show().then(() => {
1834
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
1835
+ YCSDK.ins.onShow("Inters" /* Inters */);
1836
+ }).catch((err) => {
1837
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
1838
+ YCSDK.ins.onError("Inters" /* Inters */);
1839
+ });
1840
+ }
1841
+ hideNative() {
1842
+ if (this.customAd) {
1843
+ this.customAd.hide();
1844
+ this.customAd.destroy();
1845
+ this.customAd = null;
1846
+ }
1847
+ }
1848
+ showNative() {
1849
+ if (this.platformVersionCode < 1091) {
1850
+ console.log("platformVersionCode below 1091, can't show custom ad");
1851
+ return;
1852
+ }
1853
+ if (!sdkconfig.ycNativeId) {
1854
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1855
+ return;
1856
+ }
1857
+ if (this.customAd && this.customAd.isShow()) {
1858
+ console.log("native ad is show ing");
1859
+ this.hideNative();
1860
+ }
1861
+ this.customAd = this.qg.createCustomAd({
1862
+ posId: sdkconfig.ycNativeId,
1863
+ style: {
1864
+ width: view2.getVisibleSize().width,
1865
+ gravity: "center"
1866
+ }
1867
+ });
1868
+ this.customAd.onClose(() => {
1869
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95EDclose");
1870
+ YCSDK.ins.onClose("Native" /* Native */);
1871
+ });
1872
+ this.customAd.onHide(() => {
1873
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95EDhide");
1874
+ YCSDK.ins.onClose("Native" /* Native */);
1875
+ });
1876
+ this.customAd.onLoad(() => {
1877
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1878
+ YCSDK.ins.onLoad("Native" /* Native */);
1879
+ });
1880
+ this.customAd.onError((err) => {
1881
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
1882
+ YCSDK.ins.onError("Native" /* Native */);
1883
+ });
1884
+ this.customAd.show().then(() => {
1885
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
1886
+ YCSDK.ins.onShow("Native" /* Native */);
1887
+ }).catch((err) => {
1888
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
1889
+ YCSDK.ins.onError("Native" /* Native */);
1890
+ });
1891
+ }
1892
+ hideInters(type) {
1893
+ this.hideNative();
1894
+ }
1895
+ showVideo(callBack) {
1896
+ this.callback = callBack;
1897
+ if (this.rewardedAd) {
1898
+ this.rewardedAd.load();
1899
+ } else {
1900
+ this.loadVideo();
1901
+ }
1902
+ return false;
1903
+ }
1904
+ loadVideo() {
1905
+ if (this.platformVersionCode < 1041) {
1906
+ console.log("platformVersionCode below 1041, can't show video ad");
1907
+ return;
1908
+ }
1909
+ if (!sdkconfig.ycVideoId) {
1910
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1911
+ return;
1912
+ }
1913
+ this.rewardedAd = this.qg.createRewardedVideoAd({
1914
+ posId: sdkconfig.ycVideoId
1915
+ });
1916
+ this.rewardedAd.onLoad((res) => {
1917
+ if (res == "localAdVideo") {
1918
+ console.log("\u6FC0\u52B1\u89C6\u9891 \u515C\u5E95\u5E7F\u544A-onload\u89E6\u53D1 ", res);
1919
+ } else {
1920
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u52A0\u8F7D\u5B8C\u6210-onload\u89E6\u53D1 ", res);
1921
+ }
1922
+ YCSDK.ins.onLoad("Video" /* Video */);
1923
+ this.rewardedAd.show().then(() => {
1924
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
1925
+ YCSDK.ins.onShow("Video" /* Video */);
1926
+ }).catch((err) => {
1927
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
1928
+ this.callback && this.callback(false);
1929
+ this.showNative();
1930
+ YCSDK.ins.onError("Video" /* Video */);
1931
+ });
1932
+ });
1933
+ this.rewardedAd.onError((err) => {
1934
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25: ", JSON.stringify(err));
1935
+ this.callback && this.callback(false);
1936
+ YCSDK.ins.onError("Video" /* Video */);
1937
+ });
1938
+ this.rewardedAd.onClose((res) => {
1939
+ console.log("\u6FC0\u52B1\u89C6\u9891\u5173\u95ED");
1940
+ YCSDK.ins.onClose("Video" /* Video */);
1941
+ if (res && res.isEnded) {
1942
+ console.log("\u6B63\u5E38\u64AD\u653E\u7ED3\u675F\uFF0C\u53EF\u4EE5\u4E0B\u53D1\u6E38\u620F\u5956\u52B1");
1943
+ this.callback && this.callback(true);
1944
+ YCSDK.ins.onReward();
1945
+ } else {
1946
+ YCSDK.ins.onClose("Video" /* Video */);
1947
+ console.log("\u64AD\u653E\u4E2D\u9014\u9000\u51FA\uFF0C\u4E0D\u4E0B\u53D1\u6E38\u620F\u5956\u52B1");
1948
+ }
1949
+ });
1950
+ }
1951
+ customFunc(methodName, params, callBack) {
1952
+ }
1953
+ };
1954
+
1955
+ // assets/script/ycsdk/minigame/xiaomi/XiaoMiGame.ts
1956
+ var XiaoMiGame = class {
1957
+ constructor() {
1958
+ this.qg = window["qg"];
1959
+ this.bannerShowing = false;
1960
+ }
1961
+ init() {
1962
+ this.platformVersionCode = this.qg.getSystemInfoSync().platformVersionCode;
1963
+ }
1964
+ login(callBack) {
1965
+ }
1966
+ pay(params, callBack) {
1967
+ console.log("mi pay not support");
1968
+ }
1969
+ showBanner(position) {
1970
+ if (!sdkconfig.ycBannerId) {
1971
+ console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1972
+ return;
1973
+ }
1974
+ let timeTag = Date.now();
1975
+ if (timeTag - this.lastBanner < 30 * 1e3) {
1976
+ console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---banner");
1977
+ return;
1978
+ }
1979
+ if (this.bannerShowing) {
1980
+ console.log("banner already showing");
1981
+ return;
1982
+ }
1983
+ this.hideBanner();
1984
+ this.bannerShowing = true;
1985
+ this.bannerAd = this.qg.createBannerAd({
1986
+ adUnitId: sdkconfig.ycBannerId,
1987
+ adIntervals: 35
1988
+ // style: {
1989
+ // left: 0,
1990
+ // top: 0,
1991
+ // width: 1080
1992
+ // }
1993
+ });
1994
+ this.bannerAd.onLoad(() => {
1995
+ console.log("mi banner on load");
1996
+ this.bannerShowing = true;
1997
+ YCSDK.ins.onLoad("Banner" /* Banner */);
1998
+ YCSDK.ins.onShow("Banner" /* Banner */);
1999
+ });
2000
+ this.bannerAd.onError((err) => {
2001
+ console.log("mi banner error: ", err);
2002
+ this.bannerShowing = false;
2003
+ YCSDK.ins.onError("Banner" /* Banner */);
2004
+ });
2005
+ this.bannerAd.onClose(() => {
2006
+ console.log("mi banner on close");
2007
+ this.bannerShowing = false;
2008
+ this.lastBanner = Date.now();
2009
+ YCSDK.ins.onClose("Banner" /* Banner */);
2010
+ });
2011
+ this.bannerAd.show();
2012
+ console.log("mi banner load");
2013
+ }
2014
+ hideBanner() {
2015
+ this.bannerShowing = false;
2016
+ if (this.bannerAd) {
2017
+ this.bannerAd.hide();
2018
+ this.bannerAd.destroy();
2019
+ this.bannerAd = null;
2020
+ }
2021
+ }
2022
+ showInters(type) {
2023
+ switch (type) {
2024
+ case "Initial" /* Initial */:
2025
+ case "Video" /* Video */:
2026
+ this.showInitial();
2027
+ break;
2028
+ case "Native" /* Native */:
2029
+ this.showNative();
2030
+ break;
2031
+ }
2032
+ }
2033
+ showNative() {
2034
+ if (this.platformVersionCode < 1110) {
2035
+ console.log("platformVersionCode below 1110, current code: ", this.platformVersionCode);
2036
+ return;
2037
+ }
2038
+ if (!sdkconfig.ycNativeId) {
2039
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2040
+ return;
2041
+ }
2042
+ let timeTag = Date.now();
2043
+ if (timeTag - this.lastNative < 30 * 1e3) {
2044
+ console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---native");
2045
+ return;
2046
+ }
2047
+ this.hideInters("Native" /* Native */);
2048
+ this.customAd = this.qg.createCustomAd({
2049
+ adUnitId: sdkconfig.ycNativeId,
2050
+ style: {
2051
+ left: 0,
2052
+ top: 300,
2053
+ width: 1080
2054
+ }
2055
+ });
2056
+ this.customAd.onLoad(() => {
2057
+ console.log("mi native on load");
2058
+ YCSDK.ins.onLoad("Native" /* Native */);
2059
+ });
2060
+ this.customAd.onClose(() => {
2061
+ console.log("mi native on close");
2062
+ YCSDK.ins.onClose("Native" /* Native */);
2063
+ this.lastNative = Date.now();
2064
+ });
2065
+ this.customAd.onShow(() => {
2066
+ console.log("mi native show");
2067
+ YCSDK.ins.onShow("Native" /* Native */);
2068
+ });
2069
+ this.customAd.onError((err) => {
2070
+ console.log("mi native error: ", err);
2071
+ YCSDK.ins.onError("Native" /* Native */);
2072
+ });
2073
+ this.customAd.show();
2074
+ }
2075
+ showInitial() {
2076
+ if (!sdkconfig.ycIntersId) {
2077
+ console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
2078
+ return;
2079
+ }
2080
+ let timeTag = Date.now();
2081
+ if (timeTag - this.lastInters < 30 * 1e3) {
2082
+ console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---inters");
2083
+ return;
2084
+ }
2085
+ let interstitialAd = this.qg.createInterstitialAd({
2086
+ adUnitId: sdkconfig.ycIntersId
2087
+ });
2088
+ interstitialAd.onLoad(() => {
2089
+ console.log("mi\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2090
+ YCSDK.ins.onLoad("Inters" /* Inters */);
2091
+ interstitialAd.show();
2092
+ YCSDK.ins.onShow("Inters" /* Inters */);
2093
+ });
2094
+ interstitialAd.onClose(() => {
2095
+ console.log("mi innters on close");
2096
+ YCSDK.ins.onClose("Inters" /* Inters */);
2097
+ this.lastInters = Date.now();
2098
+ });
2099
+ interstitialAd.onError((err) => {
2100
+ console.log("mi inters error: ", err);
2101
+ YCSDK.ins.onError("Inters" /* Inters */);
2102
+ interstitialAd.destroy();
2103
+ });
2104
+ }
2105
+ hideInters(type) {
2106
+ if (this.customAd && type == "Native" /* Native */) {
2107
+ this.customAd.hide();
2108
+ this.customAd.destroy();
2109
+ this.customAd = null;
2110
+ }
2111
+ }
2112
+ showVideo(callBack) {
2113
+ this.callback = callBack;
2114
+ let timeTag = Date.now();
2115
+ if (timeTag - this.lastReward < 30 * 1e3) {
2116
+ console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---video");
2117
+ this.callback && this.callback(false);
2118
+ return;
2119
+ }
2120
+ this.loadVideo(true);
2121
+ return false;
2122
+ }
2123
+ loadVideo(show) {
2124
+ if (!sdkconfig.ycVideoId) {
2125
+ console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2126
+ this.callback && this.callback(false);
2127
+ this.callback = null;
2128
+ return;
2129
+ }
2130
+ if (this.rewardedVideoAd) {
2131
+ this.rewardedVideoAd = this.qg.createRewardedVideoAd({
2132
+ adUnitId: sdkconfig.ycVideoId
2133
+ });
2134
+ console.log("reload video, ad id: ", sdkconfig.ycVideoId);
2135
+ this.rewardedVideoAd.load();
2136
+ return;
2137
+ }
2138
+ this.rewardedVideoAd = this.qg.createRewardedVideoAd({
2139
+ adUnitId: sdkconfig.ycVideoId
2140
+ });
2141
+ console.log("create video, ad id: ", sdkconfig.ycVideoId);
2142
+ this.rewardedVideoAd.onLoad(() => {
2143
+ console.log("mi video on load");
2144
+ YCSDK.ins.onLoad("Video" /* Video */);
2145
+ if (show) {
2146
+ setTimeout(() => {
2147
+ this.rewardedVideoAd.show();
2148
+ YCSDK.ins.onShow("Video" /* Video */);
2149
+ }, 100);
2150
+ }
2151
+ });
2152
+ this.rewardedVideoAd.onClose((isEnded) => {
2153
+ console.log("mi video on close: ", isEnded);
2154
+ this.lastReward = Date.now();
2155
+ YCSDK.ins.onClose("Video" /* Video */);
2156
+ if (isEnded.isEnded) {
2157
+ YCSDK.ins.onReward();
2158
+ this.callback && this.callback(isEnded.isEnded);
2159
+ } else {
2160
+ YCSDK.ins.onClose("Video" /* Video */);
2161
+ }
2162
+ });
2163
+ this.rewardedVideoAd.onError((err) => {
2164
+ console.log("mi video error: ", err);
2165
+ YCSDK.ins.onError("Video" /* Video */);
2166
+ });
2167
+ this.rewardedVideoAd.load();
2168
+ }
2169
+ customFunc(methodName, params, callBack) {
2170
+ console.log("custom function name:", methodName);
2171
+ }
2172
+ };
2173
+
2174
+ // assets/script/ycsdk/minigame/wechat/WeChatGame.ts
2175
+ var WeChatGame = class {
2176
+ constructor() {
2177
+ this.wx = window["wx"];
2178
+ }
2179
+ init(callBack) {
2180
+ callBack && callBack();
2181
+ }
2182
+ login(callBack) {
2183
+ }
2184
+ pay(params, callBack) {
2185
+ }
2186
+ showBanner(position) {
2187
+ if (this.bannerAd) {
2188
+ this.bannerAd.destroy();
2189
+ this.bannerAd = null;
2190
+ }
2191
+ const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2192
+ this.bannerAd = this.wx.createBannerAd({
2193
+ adUnitId: sdkconfig.ycBannerId,
2194
+ style: {
2195
+ left: 0,
2196
+ top: 0,
2197
+ width: screenWidth
2198
+ }
2199
+ });
2200
+ this.bannerAd.onResize((size) => {
2201
+ this.bannerAd.style.top = screenHeight - size.height;
2202
+ });
2203
+ this.bannerAd.onLoad(() => {
2204
+ console.log("banner \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2205
+ YCSDK.ins.onLoad("Banner" /* Banner */);
2206
+ YCSDK.ins.onShow("Banner" /* Banner */);
2207
+ });
2208
+ this.bannerAd.onError((err) => {
2209
+ console.log("banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25:", err);
2210
+ YCSDK.ins.onError("Banner" /* Banner */);
2211
+ this.showNativeBanner();
2212
+ });
2213
+ this.bannerAd.show();
2214
+ }
2215
+ showNativeBanner() {
2216
+ const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2217
+ const customAd = this.wx.createCustomAd({
2218
+ adUnitId: sdkconfig.ycNativeId,
2219
+ style: {
2220
+ left: (screenWidth - 360) / 2,
2221
+ top: screenHeight - 106,
2222
+ width: 360,
2223
+ height: 106
2224
+ }
2225
+ });
2226
+ customAd.onResize((res) => {
2227
+ console.log("on resize:", res);
2228
+ customAd.style.top = screenHeight - res.height;
2229
+ customAd.style.left = (screenWidth - res.width) / 2;
2230
+ });
2231
+ customAd.onLoad(() => {
2232
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2233
+ YCSDK.ins.onLoad("Native" /* Native */);
2234
+ });
2235
+ customAd.onError((err) => {
2236
+ console.log("\u539F\u751F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
2237
+ YCSDK.ins.onError("Native" /* Native */);
2238
+ });
2239
+ customAd.onClose(() => {
2240
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95ED");
2241
+ YCSDK.ins.onClose("Native" /* Native */);
2242
+ });
2243
+ customAd.show().then(() => {
2244
+ console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u663E\u793A");
2245
+ YCSDK.ins.onShow("Native" /* Native */);
2246
+ });
2247
+ }
2248
+ hideBanner() {
2249
+ if (this.bannerAd) {
2250
+ this.bannerAd.hide();
2251
+ this.bannerAd.destroy();
2252
+ this.bannerAd = null;
2253
+ }
2254
+ }
2255
+ showInters(type) {
2256
+ let interstitialAd = this.wx.createInterstitialAd({ adUnitId: sdkconfig.ycIntersId });
2257
+ interstitialAd.onLoad(() => {
2258
+ console.log("\u63D2\u5C4F \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2259
+ YCSDK.ins.onLoad("Inters" /* Inters */);
2260
+ YCSDK.ins.onShow("Inters" /* Inters */);
2261
+ });
2262
+ interstitialAd.onError((err) => {
2263
+ console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err);
2264
+ YCSDK.ins.onError("Inters" /* Inters */);
2265
+ });
2266
+ interstitialAd.onClose((res) => {
2267
+ console.log("\u63D2\u5C4F \u5E7F\u544A\u5173\u95ED");
2268
+ YCSDK.ins.onClose("Inters" /* Inters */);
2269
+ });
2270
+ interstitialAd.show().catch((err) => {
2271
+ console.error("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5931\u8D25\uFF1A", err);
2272
+ YCSDK.ins.onError("Inters" /* Inters */);
2273
+ });
2274
+ }
2275
+ hideInters(type) {
2276
+ }
2277
+ showVideo(callBack) {
2278
+ let rewardedVideoAd = this.wx.createRewardedVideoAd({ adUnitId: sdkconfig.ycVideoId });
2279
+ rewardedVideoAd.onLoad(() => {
2280
+ console.log("\u6FC0\u52B1\u89C6\u9891 \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2281
+ YCSDK.ins.onLoad("Video" /* Video */);
2282
+ });
2283
+ rewardedVideoAd.onError((err) => {
2284
+ console.log("\u6FC0\u52B1\u89C6\u9891 \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err);
2285
+ YCSDK.ins.onError("Video" /* Video */, callBack);
2286
+ });
2287
+ rewardedVideoAd.onClose((res) => {
2288
+ YCSDK.ins.onClose("Video" /* Video */);
2289
+ if (res && res.isEnded || res === void 0) {
2290
+ YCSDK.ins.onReward();
2291
+ callBack && callBack(true);
2292
+ } else {
2293
+ callBack && callBack(false);
2294
+ }
2295
+ });
2296
+ rewardedVideoAd.show().catch((err) => {
2297
+ rewardedVideoAd.load().then(() => {
2298
+ rewardedVideoAd.show();
2299
+ YCSDK.ins.onShow("Video" /* Video */);
2300
+ });
2301
+ });
2302
+ return false;
2303
+ }
2304
+ customFunc(methodName, params, callBack) {
2305
+ const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2306
+ let CustomAd = this.wx.createCustomAd({
2307
+ adUnitId: sdkconfig.ycBigPicId,
2308
+ style: {
2309
+ left: 0,
2310
+ top: (screenHeight - screenWidth) / 2,
2311
+ width: screenWidth
2312
+ }
2313
+ });
2314
+ CustomAd.onResize((res) => {
2315
+ console.log("on resize:", res);
2316
+ CustomAd.style.top = screenHeight - res.height;
2317
+ CustomAd.style.left = (screenWidth - res.width) / 2;
2318
+ });
2319
+ CustomAd.onError((err) => {
2320
+ console.error("\u77E9\u9635\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err.errMsg);
2321
+ });
2322
+ CustomAd.show();
2323
+ }
2324
+ };
2325
+
2326
+ // assets/script/ycsdk/minigame/MiniGame.ts
2327
+ var MiniGame = class {
2328
+ constructor(platform) {
2329
+ this.channelFactory(platform);
2330
+ }
2331
+ channelFactory(platform) {
2332
+ console.log("switch platform:", platform);
2333
+ switch (platform) {
2334
+ case sys5.Platform.HUAWEI_QUICK_GAME:
2335
+ this.channel = new HuaWeiGame();
2336
+ break;
2337
+ case sys5.Platform.XIAOMI_QUICK_GAME:
2338
+ this.channel = new XiaoMiGame();
2339
+ break;
2340
+ case sys5.Platform.OPPO_MINI_GAME:
2341
+ this.channel = new OppoGame();
2342
+ break;
2343
+ case sys5.Platform.VIVO_MINI_GAME:
2344
+ this.channel = new VivoGame();
2345
+ break;
2346
+ case sys5.Platform.BYTEDANCE_MINI_GAME:
2347
+ this.channel = new DouYinGame();
2348
+ break;
2349
+ case sys5.Platform.WECHAT_GAME:
2350
+ this.channel = new WeChatGame();
2351
+ break;
2352
+ default:
2353
+ break;
2354
+ }
2355
+ }
2356
+ jsonToKeyValue(json) {
2357
+ return Object.entries(json).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
2358
+ }
2359
+ init(callBack) {
2360
+ if (!YCSDK.ins.isRun(sys5.Platform.OPPO_MINI_GAME)) {
2361
+ this.setAdStateListener();
2362
+ this.channel.init(callBack);
2363
+ return;
2364
+ }
2365
+ const url = "https://iaa.rhino-times.com/api/game/query-match-config";
2366
+ const data = { pkgName: sdkconfig.pkgName, version: sdkconfig.version };
2367
+ const sign = Md5.hashStr(this.jsonToKeyValue(data));
2368
+ data["sign"] = sign;
2369
+ HttpRequest.get().requestPostjson(url, data, (success, result) => {
2370
+ if (!success || !result) {
2371
+ this.setAdStateListener();
2372
+ this.channel.init(callBack);
2373
+ return;
2374
+ }
2375
+ const res = result.oexts;
2376
+ sdkconfig.open = result.open;
2377
+ sdkconfig.ratio = res.ratio;
2378
+ sdkconfig.subornUserTest = res.subornUserTest;
2379
+ this.setAdStateListener();
2380
+ this.channel.init(callBack);
2381
+ });
2382
+ }
2383
+ setAdStateListener() {
2384
+ const st = new AdTactics();
2385
+ st.refreshAll();
2386
+ YCSDK.ins.setAdStateListener(st);
2387
+ }
2388
+ login(callBack) {
2389
+ this.channel.login(callBack);
2390
+ }
2391
+ pay(params, callBack) {
2392
+ this.channel.pay(params, callBack);
2393
+ }
2394
+ showBanner(position) {
2395
+ if (!sdkconfig.open) {
2396
+ console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2397
+ return;
2398
+ }
2399
+ this.channel.showBanner(position);
2400
+ }
2401
+ hideBanner() {
2402
+ this.channel.hideBanner();
2403
+ }
2404
+ showInters(type) {
2405
+ if (!sdkconfig.open) {
2406
+ console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2407
+ return;
2408
+ }
2409
+ console.log("interstitial type:", type);
2410
+ this.channel.showInters(type);
2411
+ }
2412
+ hideInters(type = "Native" /* Native */) {
2413
+ this.channel.hideInters(type);
2414
+ }
2415
+ showVideo(callBack) {
2416
+ if (!sdkconfig.open) {
2417
+ console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2418
+ callBack && callBack(true);
2419
+ return false;
2420
+ }
2421
+ return this.channel.showVideo(callBack);
2422
+ }
2423
+ customFunc(methodName, params, callBack) {
2424
+ if (!sdkconfig.open) {
2425
+ console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2426
+ return;
2427
+ }
2428
+ this.channel.customFunc(methodName, params, callBack);
2429
+ }
2430
+ };
2431
+
2432
+ // assets/script/ycsdk/minigame/PrivacyEvent.ts
2433
+ import { Component, instantiate as instantiate2, Prefab as Prefab2, resources as resources2, Node as Node2, sys as sys6 } from "cc";
2434
+ var PrivacyEvent = class extends Component {
2435
+ onLoad() {
2436
+ resources2.load("Privacy/yinsiUI", Prefab2, (err, prefab) => {
2437
+ if (err) {
2438
+ console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
2439
+ return;
2440
+ }
2441
+ this.yinsiUI = instantiate2(prefab);
2442
+ const close = this.yinsiUI.getChildByName("window").getChildByName("closeBtn");
2443
+ close.on(Node2.EventType.TOUCH_END, () => {
2444
+ this.yinsiUI.active = false;
2445
+ }, this);
2446
+ YCSDK.ins.getGameNode().addChild(this.yinsiUI);
2447
+ console.log("on PrivacyEvent add");
2448
+ });
2449
+ }
2450
+ openPrivacyPolicy(event) {
2451
+ console.log("\u70B9\u51FB\u9690\u79C1\u653F\u7B56");
2452
+ if (YCSDK.ins.isRun(sys6.Platform.HUAWEI_QUICK_GAME)) {
2453
+ this.hwOpen();
2454
+ return;
2455
+ }
2456
+ this.open();
2457
+ }
2458
+ hwOpen() {
2459
+ const qg = window["qg"];
2460
+ if (!qg) {
2461
+ console.log("qg is null");
2462
+ return;
2463
+ }
2464
+ qg.openDeeplink({
2465
+ uri: "https://ds.rhino-times.com/tl/docs/m_privateprotocol.html"
2466
+ });
2467
+ }
2468
+ open() {
2469
+ this.yinsiUI.active = true;
2470
+ }
2471
+ };
2472
+
2473
+ // assets/script/ycsdk/YCSDK.ts
2474
+ var YCSDK = class _YCSDK {
2475
+ constructor() {
2476
+ this.states = [];
2477
+ this.suportPlatfrom = [sys7.Platform.HUAWEI_QUICK_GAME, sys7.Platform.XIAOMI_QUICK_GAME, sys7.Platform.OPPO_MINI_GAME, sys7.Platform.VIVO_MINI_GAME, sys7.Platform.BYTEDANCE_MINI_GAME, sys7.Platform.WECHAT_GAME];
2478
+ this.privacyKey = "PRIVACY";
2479
+ this.createPlatform();
2480
+ }
2481
+ static get ins() {
2482
+ if (!_YCSDK.instance) {
2483
+ _YCSDK.instance = new _YCSDK();
2484
+ }
2485
+ return _YCSDK.instance;
2486
+ }
2487
+ createPlatform() {
2488
+ let platform = sys7.platform;
2489
+ console.log("current platform:", platform);
2490
+ if (this.isSupportMiniGame(platform)) {
2491
+ this.platform = new MiniGame(platform);
2492
+ return;
2493
+ }
2494
+ console.log("ycsdk\u6682\u4E0D\u652F\u6301\u8BE5\u5C0F\u6E38\u620F\u5E73\u53F0,\u4EE5\u8C03\u8BD5\u6A21\u5F0F\u8FD0\u884C");
2495
+ this.platform = new DebugGame();
2496
+ }
2497
+ isSupportMiniGame(platform) {
2498
+ return this.suportPlatfrom.includes(platform);
2499
+ }
2500
+ isRun(platform) {
2501
+ return sys7.platform == platform;
2502
+ }
2503
+ init(config, callBack) {
2504
+ console.log("ycsdk init");
2505
+ if (!config) {
2506
+ console.log("ycsdk init fail, config is null");
2507
+ callBack && callBack();
2508
+ return;
2509
+ }
2510
+ sdkconfig.pkgName = config.pkgName;
2511
+ sdkconfig.bannerId = config.bannerId;
2512
+ sdkconfig.intersId = config.intersId;
2513
+ sdkconfig.nativeId = config.nativeId;
2514
+ sdkconfig.videoId = config.videoId;
2515
+ sdkconfig.nativeBannerId = config.nativeBannerId;
2516
+ this.platform.init(callBack);
2517
+ }
2518
+ agreePrivacy() {
2519
+ return StorageUtils.getStringData(this.privacyKey) == "agree";
2520
+ }
2521
+ showPolicy(node, callBack) {
2522
+ console.log("ycsdk showPolicy");
2523
+ this.gameNode = node;
2524
+ let agree = StorageUtils.getStringData(this.privacyKey);
2525
+ console.log(agree);
2526
+ if (agree == "agree") {
2527
+ console.log("user agree privacy, not show");
2528
+ callBack && callBack.userAgree();
2529
+ return;
2530
+ }
2531
+ if (!node) {
2532
+ console.log("node is null");
2533
+ callBack && callBack.nodeError();
2534
+ return;
2535
+ }
2536
+ resources3.load("Privacy/policyUI", Prefab3, (err, prefab) => {
2537
+ if (err) {
2538
+ console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
2539
+ return;
2540
+ }
2541
+ const yinsiUI = instantiate3(prefab);
2542
+ const content = yinsiUI.getChildByName("panel").getChildByName("content");
2543
+ if (!content.getComponent(PrivacyEvent)) {
2544
+ content.addComponent(PrivacyEvent);
2545
+ }
2546
+ const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
2547
+ agree2.on(Node3.EventType.TOUCH_END, () => {
2548
+ callBack.onAgree && callBack.onAgree();
2549
+ StorageUtils.setStringData(this.privacyKey, "agree");
2550
+ yinsiUI.active = false;
2551
+ }, this);
2552
+ const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
2553
+ disagree.on(Node3.EventType.TOUCH_END, () => {
2554
+ callBack.onDisAgree && callBack.onDisAgree();
2555
+ yinsiUI.active = false;
2556
+ }, this);
2557
+ _YCSDK.ins.getGameNode().addChild(yinsiUI);
2558
+ });
2559
+ }
2560
+ login(callBack) {
2561
+ console.log("ycsdk login");
2562
+ this.platform.login(callBack);
2563
+ }
2564
+ pay(params, callBack) {
2565
+ this.platform.pay(params.toJSonString(), callBack);
2566
+ }
2567
+ showBanner(position = "Bottom" /* Bottom */) {
2568
+ console.log("ycsdk show banner, type:", position);
2569
+ this.platform.showBanner(position);
2570
+ }
2571
+ hideBanner() {
2572
+ this.platform.hideBanner();
2573
+ }
2574
+ random(max) {
2575
+ max = Math.floor(max);
2576
+ return Math.floor(Math.random() * max) + 1;
2577
+ }
2578
+ showInters(type = "Initial" /* Initial */) {
2579
+ console.log("ycsdk show interstitial, type:", type);
2580
+ if (type) {
2581
+ this.platform.showInters(type);
2582
+ return;
2583
+ }
2584
+ this.platform.showInters(type);
2585
+ }
2586
+ hideInters(type = "Native" /* Native */) {
2587
+ this.platform.hideInters(type);
2588
+ }
2589
+ showVideo(callback) {
2590
+ console.log("ycsdk show video");
2591
+ return this.platform.showVideo(callback);
2592
+ }
2593
+ customFunc(methodName, params, callBack) {
2594
+ this.platform.customFunc(methodName, params, callBack);
2595
+ }
2596
+ setAdStateListener(state) {
2597
+ if (this.states.includes(state)) {
2598
+ console.log("setAdStateListener interface is called");
2599
+ return;
2600
+ }
2601
+ this.states.push(state);
2602
+ }
2603
+ vertical() {
2604
+ let winSize = view3.getDesignResolutionSize();
2605
+ console.log("vertical:", winSize.height > winSize.width);
2606
+ return winSize.height > winSize.width;
2607
+ }
2608
+ setGameNode(node) {
2609
+ this.gameNode = node;
2610
+ }
2611
+ getGameNode() {
2612
+ return this.gameNode;
2613
+ }
2614
+ onLoad(type) {
2615
+ if (!this.states.length) {
2616
+ return;
2617
+ }
2618
+ this.states.forEach((state) => {
2619
+ state.onLoad(type);
2620
+ });
2621
+ }
2622
+ onError(type, callback) {
2623
+ if (!this.states.length) {
2624
+ return;
2625
+ }
2626
+ this.states.forEach((state) => {
2627
+ state.onError(type, callback);
2628
+ });
2629
+ }
2630
+ onShow(type) {
2631
+ if (!this.states.length) {
2632
+ return;
2633
+ }
2634
+ this.states.forEach((state) => {
2635
+ state.onShow(type);
2636
+ });
2637
+ }
2638
+ onClick(type) {
2639
+ if (!this.states.length) {
2640
+ return;
2641
+ }
2642
+ this.states.forEach((state) => {
2643
+ state.onClick(type);
2644
+ });
2645
+ }
2646
+ onClose(type) {
2647
+ if (!this.states.length) {
2648
+ return;
2649
+ }
2650
+ this.states.forEach((state) => {
2651
+ state.onClose(type);
2652
+ });
2653
+ }
2654
+ onReward() {
2655
+ if (!this.states.length) {
2656
+ return;
2657
+ }
2658
+ this.states.forEach((state) => {
2659
+ state.onReward();
2660
+ });
2661
+ }
2662
+ };
2663
+ export {
2664
+ AdType,
2665
+ BannerType,
2666
+ HttpRequest,
2667
+ InterstitialType,
2668
+ Md5,
2669
+ PrivacyEvent,
2670
+ StorageUtils,
2671
+ YCSDK
2672
+ };
2673
+ //# sourceMappingURL=index.js.map