yingchigamesdk-cocos-v3 25.7.29 → 25.7.30
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.
- package/dist/index.js +145 -104
- package/dist/index.js.map +4 -4
- package/dist/ycsdk/GameInterface.d.ts +6 -3
- package/dist/ycsdk/minigame/DebugGame.d.ts +3 -1
- package/dist/ycsdk/minigame/MiniGame.d.ts +4 -1
- package/dist/ycsdk/minigame/PrivacyListener.d.ts +4 -4
- package/dist/ycsdk/nativegame/anroid/AndroidGame.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -440,16 +440,96 @@ var AdType = /* @__PURE__ */ ((AdType2) => {
|
|
|
440
440
|
})(AdType || {});
|
|
441
441
|
|
|
442
442
|
// assets/script/ycsdk/YCSDK.ts
|
|
443
|
-
import { sys as sys7,
|
|
443
|
+
import { sys as sys7, view as view3 } from "cc";
|
|
444
|
+
|
|
445
|
+
// assets/script/ycsdk/minigame/DebugGame.ts
|
|
446
|
+
import { instantiate as instantiate2, Node as Node2, Prefab as Prefab2, resources as resources2 } from "cc";
|
|
447
|
+
|
|
448
|
+
// assets/script/ycsdk/minigame/PrivacyEvent.ts
|
|
449
|
+
import { Component, instantiate, Prefab, resources, Node, sys as sys2 } from "cc";
|
|
450
|
+
var PrivacyEvent = class extends Component {
|
|
451
|
+
onLoad() {
|
|
452
|
+
resources.load("Privacy/yinsiUI", Prefab, (err, prefab) => {
|
|
453
|
+
if (err) {
|
|
454
|
+
console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
this.yinsiUI = instantiate(prefab);
|
|
458
|
+
const close = this.yinsiUI.getChildByName("window").getChildByName("closeBtn");
|
|
459
|
+
close.on(Node.EventType.TOUCH_END, () => {
|
|
460
|
+
this.yinsiUI.active = false;
|
|
461
|
+
}, this);
|
|
462
|
+
YCSDK.ins.getGameNode().addChild(this.yinsiUI);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
openPrivacyPolicy(event) {
|
|
466
|
+
console.log("\u70B9\u51FB\u9690\u79C1\u653F\u7B56");
|
|
467
|
+
if (YCSDK.ins.isRun(sys2.Platform.HUAWEI_QUICK_GAME)) {
|
|
468
|
+
this.hwOpen();
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this.open();
|
|
472
|
+
}
|
|
473
|
+
hwOpen() {
|
|
474
|
+
const qg = window["qg"];
|
|
475
|
+
if (!qg) {
|
|
476
|
+
console.log("qg is null");
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
qg.openDeeplink({
|
|
480
|
+
uri: "https://ds.rhino-times.com/tl/docs/m_privateprotocol.html"
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
open() {
|
|
484
|
+
this.yinsiUI.active = true;
|
|
485
|
+
}
|
|
486
|
+
};
|
|
444
487
|
|
|
445
488
|
// assets/script/ycsdk/minigame/DebugGame.ts
|
|
446
489
|
var DebugGame = class {
|
|
490
|
+
constructor() {
|
|
491
|
+
this.privacyKey = "PRIVACY";
|
|
492
|
+
}
|
|
447
493
|
init(callBack) {
|
|
448
494
|
console.log("debug init");
|
|
449
495
|
callBack && callBack();
|
|
450
496
|
}
|
|
451
497
|
showPolicy(node, callBack) {
|
|
452
|
-
|
|
498
|
+
let agree = StorageUtils.getStringData(this.privacyKey);
|
|
499
|
+
console.log(agree);
|
|
500
|
+
if (agree == "agree") {
|
|
501
|
+
console.log("user agree privacy, not show");
|
|
502
|
+
callBack.userAgree && callBack.userAgree();
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (!node) {
|
|
506
|
+
console.log("node is null");
|
|
507
|
+
callBack.nodeError && callBack.nodeError();
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
resources2.load("Privacy/policyUI", Prefab2, (err, prefab) => {
|
|
511
|
+
if (err) {
|
|
512
|
+
console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const yinsiUI = instantiate2(prefab);
|
|
516
|
+
const content = yinsiUI.getChildByName("panel").getChildByName("content");
|
|
517
|
+
if (!content.getComponent(PrivacyEvent)) {
|
|
518
|
+
content.addComponent(PrivacyEvent);
|
|
519
|
+
}
|
|
520
|
+
const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
|
|
521
|
+
agree2.on(Node2.EventType.TOUCH_END, () => {
|
|
522
|
+
callBack.onAgree && callBack.onAgree();
|
|
523
|
+
StorageUtils.setStringData(this.privacyKey, "agree");
|
|
524
|
+
yinsiUI.active = false;
|
|
525
|
+
}, this);
|
|
526
|
+
const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
|
|
527
|
+
disagree.on(Node2.EventType.TOUCH_END, () => {
|
|
528
|
+
callBack.onDisAgree && callBack.onDisAgree();
|
|
529
|
+
yinsiUI.active = false;
|
|
530
|
+
}, this);
|
|
531
|
+
YCSDK.ins.getGameNode().addChild(yinsiUI);
|
|
532
|
+
});
|
|
453
533
|
}
|
|
454
534
|
login(callBack) {
|
|
455
535
|
console.log("debug call login");
|
|
@@ -480,10 +560,10 @@ var DebugGame = class {
|
|
|
480
560
|
};
|
|
481
561
|
|
|
482
562
|
// assets/script/ycsdk/minigame/MiniGame.ts
|
|
483
|
-
import { sys as
|
|
563
|
+
import { instantiate as instantiate4, Node as Node4, Prefab as Prefab4, resources as resources4, sys as sys6 } from "cc";
|
|
484
564
|
|
|
485
565
|
// assets/script/ycsdk/AdTactics.ts
|
|
486
|
-
import { sys as
|
|
566
|
+
import { sys as sys3 } from "cc";
|
|
487
567
|
var AdTactics = class {
|
|
488
568
|
constructor() {
|
|
489
569
|
this.bannerIndex = 0;
|
|
@@ -520,7 +600,7 @@ var AdTactics = class {
|
|
|
520
600
|
}
|
|
521
601
|
onError(type, callBack) {
|
|
522
602
|
console.log("on error: ", type);
|
|
523
|
-
if (YCSDK.ins.isRun(
|
|
603
|
+
if (YCSDK.ins.isRun(sys3.Platform.OPPO_MINI_GAME)) {
|
|
524
604
|
this.reLoadAd(type, callBack);
|
|
525
605
|
}
|
|
526
606
|
}
|
|
@@ -1079,7 +1159,7 @@ var HttpRequest = class _HttpRequest {
|
|
|
1079
1159
|
};
|
|
1080
1160
|
|
|
1081
1161
|
// assets/script/ycsdk/minigame/huawei/HuaWeiGame.ts
|
|
1082
|
-
import { assetManager, instantiate, Label, Node, Prefab, resources, Sprite, SpriteFrame, Texture2D } from "cc";
|
|
1162
|
+
import { assetManager, instantiate as instantiate3, Label, Node as Node3, Prefab as Prefab3, resources as resources3, Sprite, SpriteFrame, Texture2D } from "cc";
|
|
1083
1163
|
var HuaWeiGame = class {
|
|
1084
1164
|
constructor() {
|
|
1085
1165
|
this.qg = window["qg"];
|
|
@@ -1238,13 +1318,13 @@ var HuaWeiGame = class {
|
|
|
1238
1318
|
// adId: 51790be2-d2c2-48ca-9695-1a55bed81905
|
|
1239
1319
|
// creativeType: 103
|
|
1240
1320
|
renderNative(adItem, nativeAd) {
|
|
1241
|
-
|
|
1321
|
+
resources3.load("Privacy/bg", Prefab3, (err, prefab) => {
|
|
1242
1322
|
if (err) {
|
|
1243
1323
|
console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
|
|
1244
1324
|
YCSDK.ins.onError("Native" /* Native */);
|
|
1245
1325
|
return;
|
|
1246
1326
|
}
|
|
1247
|
-
const node =
|
|
1327
|
+
const node = instantiate3(prefab);
|
|
1248
1328
|
const native = node.getChildByName("native");
|
|
1249
1329
|
const close = native.getChildByName("close");
|
|
1250
1330
|
const title = native.getChildByName("title").getComponent(Label);
|
|
@@ -1256,31 +1336,31 @@ var HuaWeiGame = class {
|
|
|
1256
1336
|
const pic = native.getChildByName("pic");
|
|
1257
1337
|
const info = native.getChildByName("info");
|
|
1258
1338
|
const version = info.getChildByName("verison");
|
|
1259
|
-
version.on(
|
|
1339
|
+
version.on(Node3.EventType.TOUCH_END, () => {
|
|
1260
1340
|
console.log("change version");
|
|
1261
1341
|
version.getComponent(Label).string = adItem.versionName;
|
|
1262
1342
|
});
|
|
1263
1343
|
const description = info.getChildByName("description");
|
|
1264
|
-
description.on(
|
|
1344
|
+
description.on(Node3.EventType.TOUCH_END, () => {
|
|
1265
1345
|
console.log("open description");
|
|
1266
1346
|
this.qg.openDeeplink({ uri: adItem.appDetailUrl });
|
|
1267
1347
|
});
|
|
1268
1348
|
const privacy = info.getChildByName("privacy");
|
|
1269
|
-
privacy.on(
|
|
1349
|
+
privacy.on(Node3.EventType.TOUCH_END, () => {
|
|
1270
1350
|
console.log("open privacy");
|
|
1271
1351
|
this.qg.openDeeplink({ uri: adItem.privacyUrl });
|
|
1272
1352
|
});
|
|
1273
1353
|
const permission = info.getChildByName("permission");
|
|
1274
|
-
permission.on(
|
|
1354
|
+
permission.on(Node3.EventType.TOUCH_END, () => {
|
|
1275
1355
|
console.log("open permission");
|
|
1276
1356
|
this.qg.openDeeplink({ uri: adItem.permissionUrl });
|
|
1277
1357
|
});
|
|
1278
|
-
pic.on(
|
|
1358
|
+
pic.on(Node3.EventType.TOUCH_END, () => {
|
|
1279
1359
|
console.log("native click");
|
|
1280
1360
|
YCSDK.ins.onClick("Native" /* Native */);
|
|
1281
1361
|
nativeAd.reportAdClick({ adId: adItem.adId });
|
|
1282
1362
|
});
|
|
1283
|
-
close.on(
|
|
1363
|
+
close.on(Node3.EventType.TOUCH_END, () => {
|
|
1284
1364
|
console.log("close native");
|
|
1285
1365
|
nativeAd.destroy();
|
|
1286
1366
|
node.destroy();
|
|
@@ -2314,28 +2394,28 @@ var WeChatGame = class {
|
|
|
2314
2394
|
// assets/script/ycsdk/minigame/MiniGame.ts
|
|
2315
2395
|
var MiniGame = class {
|
|
2316
2396
|
constructor(platform) {
|
|
2317
|
-
this.
|
|
2397
|
+
this.privacyKey = "PRIVACY";
|
|
2318
2398
|
this.channelFactory(platform);
|
|
2319
2399
|
}
|
|
2320
2400
|
channelFactory(platform) {
|
|
2321
2401
|
console.log("switch platform:", platform);
|
|
2322
2402
|
switch (platform) {
|
|
2323
|
-
case
|
|
2403
|
+
case sys6.Platform.HUAWEI_QUICK_GAME:
|
|
2324
2404
|
this.channel = new HuaWeiGame();
|
|
2325
2405
|
break;
|
|
2326
|
-
case
|
|
2406
|
+
case sys6.Platform.XIAOMI_QUICK_GAME:
|
|
2327
2407
|
this.channel = new XiaoMiGame();
|
|
2328
2408
|
break;
|
|
2329
|
-
case
|
|
2409
|
+
case sys6.Platform.OPPO_MINI_GAME:
|
|
2330
2410
|
this.channel = new OppoGame();
|
|
2331
2411
|
break;
|
|
2332
|
-
case
|
|
2412
|
+
case sys6.Platform.VIVO_MINI_GAME:
|
|
2333
2413
|
this.channel = new VivoGame();
|
|
2334
2414
|
break;
|
|
2335
|
-
case
|
|
2415
|
+
case sys6.Platform.BYTEDANCE_MINI_GAME:
|
|
2336
2416
|
this.channel = new DouYinGame();
|
|
2337
2417
|
break;
|
|
2338
|
-
case
|
|
2418
|
+
case sys6.Platform.WECHAT_GAME:
|
|
2339
2419
|
this.channel = new WeChatGame();
|
|
2340
2420
|
break;
|
|
2341
2421
|
default:
|
|
@@ -2346,7 +2426,7 @@ var MiniGame = class {
|
|
|
2346
2426
|
return Object.entries(json).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
|
|
2347
2427
|
}
|
|
2348
2428
|
init(callBack) {
|
|
2349
|
-
if (!YCSDK.ins.isRun(
|
|
2429
|
+
if (!YCSDK.ins.isRun(sys6.Platform.OPPO_MINI_GAME)) {
|
|
2350
2430
|
this.setAdStateListener();
|
|
2351
2431
|
this.channel.init(callBack);
|
|
2352
2432
|
return;
|
|
@@ -2370,12 +2450,47 @@ var MiniGame = class {
|
|
|
2370
2450
|
});
|
|
2371
2451
|
}
|
|
2372
2452
|
setAdStateListener() {
|
|
2373
|
-
this.count++;
|
|
2374
|
-
console.log("setAdStateListener run count:", this.count);
|
|
2375
2453
|
const st = new AdTactics();
|
|
2376
2454
|
st.refreshAll();
|
|
2377
2455
|
YCSDK.ins.setAdStateListener(st);
|
|
2378
2456
|
}
|
|
2457
|
+
showPolicy(node, callBack) {
|
|
2458
|
+
let agree = StorageUtils.getStringData(this.privacyKey);
|
|
2459
|
+
console.log(agree);
|
|
2460
|
+
if (agree == "agree") {
|
|
2461
|
+
console.log("user agree privacy, not show");
|
|
2462
|
+
callBack.userAgree && callBack.userAgree();
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
if (!node) {
|
|
2466
|
+
console.log("node is null");
|
|
2467
|
+
callBack.nodeError && callBack.nodeError();
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
resources4.load("Privacy/policyUI", Prefab4, (err, prefab) => {
|
|
2471
|
+
if (err) {
|
|
2472
|
+
console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2475
|
+
const yinsiUI = instantiate4(prefab);
|
|
2476
|
+
const content = yinsiUI.getChildByName("panel").getChildByName("content");
|
|
2477
|
+
if (!content.getComponent(PrivacyEvent)) {
|
|
2478
|
+
content.addComponent(PrivacyEvent);
|
|
2479
|
+
}
|
|
2480
|
+
const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
|
|
2481
|
+
agree2.on(Node4.EventType.TOUCH_END, () => {
|
|
2482
|
+
callBack.onAgree && callBack.onAgree();
|
|
2483
|
+
StorageUtils.setStringData(this.privacyKey, "agree");
|
|
2484
|
+
yinsiUI.active = false;
|
|
2485
|
+
}, this);
|
|
2486
|
+
const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
|
|
2487
|
+
disagree.on(Node4.EventType.TOUCH_END, () => {
|
|
2488
|
+
callBack.onDisAgree && callBack.onDisAgree();
|
|
2489
|
+
yinsiUI.active = false;
|
|
2490
|
+
}, this);
|
|
2491
|
+
YCSDK.ins.getGameNode().addChild(yinsiUI);
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2379
2494
|
login(callBack) {
|
|
2380
2495
|
this.channel.login(callBack);
|
|
2381
2496
|
}
|
|
@@ -2419,47 +2534,6 @@ var MiniGame = class {
|
|
|
2419
2534
|
}
|
|
2420
2535
|
};
|
|
2421
2536
|
|
|
2422
|
-
// assets/script/ycsdk/minigame/PrivacyEvent.ts
|
|
2423
|
-
import { Component, instantiate as instantiate2, Prefab as Prefab2, resources as resources2, Node as Node2, sys as sys6 } from "cc";
|
|
2424
|
-
var PrivacyEvent = class extends Component {
|
|
2425
|
-
onLoad() {
|
|
2426
|
-
resources2.load("Privacy/yinsiUI", Prefab2, (err, prefab) => {
|
|
2427
|
-
if (err) {
|
|
2428
|
-
console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
|
|
2429
|
-
return;
|
|
2430
|
-
}
|
|
2431
|
-
this.yinsiUI = instantiate2(prefab);
|
|
2432
|
-
const close = this.yinsiUI.getChildByName("window").getChildByName("closeBtn");
|
|
2433
|
-
close.on(Node2.EventType.TOUCH_END, () => {
|
|
2434
|
-
this.yinsiUI.active = false;
|
|
2435
|
-
}, this);
|
|
2436
|
-
YCSDK.ins.getGameNode().addChild(this.yinsiUI);
|
|
2437
|
-
console.log("on PrivacyEvent add");
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
openPrivacyPolicy(event) {
|
|
2441
|
-
console.log("\u70B9\u51FB\u9690\u79C1\u653F\u7B56");
|
|
2442
|
-
if (YCSDK.ins.isRun(sys6.Platform.HUAWEI_QUICK_GAME)) {
|
|
2443
|
-
this.hwOpen();
|
|
2444
|
-
return;
|
|
2445
|
-
}
|
|
2446
|
-
this.open();
|
|
2447
|
-
}
|
|
2448
|
-
hwOpen() {
|
|
2449
|
-
const qg = window["qg"];
|
|
2450
|
-
if (!qg) {
|
|
2451
|
-
console.log("qg is null");
|
|
2452
|
-
return;
|
|
2453
|
-
}
|
|
2454
|
-
qg.openDeeplink({
|
|
2455
|
-
uri: "https://ds.rhino-times.com/tl/docs/m_privateprotocol.html"
|
|
2456
|
-
});
|
|
2457
|
-
}
|
|
2458
|
-
open() {
|
|
2459
|
-
this.yinsiUI.active = true;
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
|
|
2463
2537
|
// assets/script/ycsdk/nativegame/anroid/AndroidGame.ts
|
|
2464
2538
|
var AndroidGame = class {
|
|
2465
2539
|
constructor() {
|
|
@@ -2471,7 +2545,8 @@ var AndroidGame = class {
|
|
|
2471
2545
|
login(callBack) {
|
|
2472
2546
|
jsb.reflection.callStaticMethod(this.className, "login", "()V");
|
|
2473
2547
|
}
|
|
2474
|
-
|
|
2548
|
+
showPolicy(node, callBack) {
|
|
2549
|
+
jsb.reflection.callStaticMethod(this.className, "showPolicy", "()V");
|
|
2475
2550
|
}
|
|
2476
2551
|
showBanner(position) {
|
|
2477
2552
|
jsb.reflection.callStaticMethod(this.className, "showBanner", "()V");
|
|
@@ -2553,49 +2628,15 @@ var YCSDK = class _YCSDK {
|
|
|
2553
2628
|
this.platform.init(callBack);
|
|
2554
2629
|
}
|
|
2555
2630
|
agreePrivacy() {
|
|
2631
|
+
if (this.isRun(sys7.Platform.ANDROID)) {
|
|
2632
|
+
return true;
|
|
2633
|
+
}
|
|
2556
2634
|
return StorageUtils.getStringData(this.privacyKey) == "agree";
|
|
2557
2635
|
}
|
|
2558
2636
|
showPolicy(node, callBack) {
|
|
2559
2637
|
console.log("ycsdk showPolicy");
|
|
2560
|
-
if (this.isRun(sys7.Platform.ANDROID)) {
|
|
2561
|
-
return;
|
|
2562
|
-
}
|
|
2563
2638
|
this.gameNode = node;
|
|
2564
|
-
|
|
2565
|
-
console.log(agree);
|
|
2566
|
-
if (agree == "agree") {
|
|
2567
|
-
console.log("user agree privacy, not show");
|
|
2568
|
-
callBack && callBack.userAgree();
|
|
2569
|
-
return;
|
|
2570
|
-
}
|
|
2571
|
-
if (!node) {
|
|
2572
|
-
console.log("node is null");
|
|
2573
|
-
callBack && callBack.nodeError();
|
|
2574
|
-
return;
|
|
2575
|
-
}
|
|
2576
|
-
resources3.load("Privacy/policyUI", Prefab3, (err, prefab) => {
|
|
2577
|
-
if (err) {
|
|
2578
|
-
console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
|
|
2579
|
-
return;
|
|
2580
|
-
}
|
|
2581
|
-
const yinsiUI = instantiate3(prefab);
|
|
2582
|
-
const content = yinsiUI.getChildByName("panel").getChildByName("content");
|
|
2583
|
-
if (!content.getComponent(PrivacyEvent)) {
|
|
2584
|
-
content.addComponent(PrivacyEvent);
|
|
2585
|
-
}
|
|
2586
|
-
const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
|
|
2587
|
-
agree2.on(Node3.EventType.TOUCH_END, () => {
|
|
2588
|
-
callBack.onAgree && callBack.onAgree();
|
|
2589
|
-
StorageUtils.setStringData(this.privacyKey, "agree");
|
|
2590
|
-
yinsiUI.active = false;
|
|
2591
|
-
}, this);
|
|
2592
|
-
const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
|
|
2593
|
-
disagree.on(Node3.EventType.TOUCH_END, () => {
|
|
2594
|
-
callBack.onDisAgree && callBack.onDisAgree();
|
|
2595
|
-
yinsiUI.active = false;
|
|
2596
|
-
}, this);
|
|
2597
|
-
_YCSDK.ins.getGameNode().addChild(yinsiUI);
|
|
2598
|
-
});
|
|
2639
|
+
this.platform.showPolicy(node, callBack);
|
|
2599
2640
|
}
|
|
2600
2641
|
login(callBack) {
|
|
2601
2642
|
console.log("ycsdk login");
|