yingchigamesdk-cocos-v3 25.7.28 → 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 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, Node as Node3, resources as resources3, Prefab as Prefab3, instantiate as instantiate3, view as view3 } from "cc";
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
- console.log("bubug call show policy");
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 sys5 } from "cc";
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 sys2 } from "cc";
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(sys2.Platform.OPPO_MINI_GAME)) {
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"];
@@ -1179,7 +1259,16 @@ var HuaWeiGame = class {
1179
1259
  }
1180
1260
  this.bannerAd.hide();
1181
1261
  }
1182
- showInters(type) {
1262
+ showInters(type = "Initial" /* Initial */) {
1263
+ if (!type) {
1264
+ const odds = YCSDK.ins.random(100);
1265
+ if (odds >= 50 && sdkconfig.intersId.length >= 1) {
1266
+ this.showIntersVideo();
1267
+ } else if (sdkconfig.nativeId.length >= 1) {
1268
+ this.showNative();
1269
+ }
1270
+ return;
1271
+ }
1183
1272
  switch (type) {
1184
1273
  case "Initial" /* Initial */:
1185
1274
  case "Video" /* Video */:
@@ -1229,13 +1318,13 @@ var HuaWeiGame = class {
1229
1318
  // adId: 51790be2-d2c2-48ca-9695-1a55bed81905
1230
1319
  // creativeType: 103
1231
1320
  renderNative(adItem, nativeAd) {
1232
- resources.load("Privacy/bg", Prefab, (err, prefab) => {
1321
+ resources3.load("Privacy/bg", Prefab3, (err, prefab) => {
1233
1322
  if (err) {
1234
1323
  console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
1235
1324
  YCSDK.ins.onError("Native" /* Native */);
1236
1325
  return;
1237
1326
  }
1238
- const node = instantiate(prefab);
1327
+ const node = instantiate3(prefab);
1239
1328
  const native = node.getChildByName("native");
1240
1329
  const close = native.getChildByName("close");
1241
1330
  const title = native.getChildByName("title").getComponent(Label);
@@ -1247,31 +1336,31 @@ var HuaWeiGame = class {
1247
1336
  const pic = native.getChildByName("pic");
1248
1337
  const info = native.getChildByName("info");
1249
1338
  const version = info.getChildByName("verison");
1250
- version.on(Node.EventType.TOUCH_END, () => {
1339
+ version.on(Node3.EventType.TOUCH_END, () => {
1251
1340
  console.log("change version");
1252
1341
  version.getComponent(Label).string = adItem.versionName;
1253
1342
  });
1254
1343
  const description = info.getChildByName("description");
1255
- description.on(Node.EventType.TOUCH_END, () => {
1344
+ description.on(Node3.EventType.TOUCH_END, () => {
1256
1345
  console.log("open description");
1257
1346
  this.qg.openDeeplink({ uri: adItem.appDetailUrl });
1258
1347
  });
1259
1348
  const privacy = info.getChildByName("privacy");
1260
- privacy.on(Node.EventType.TOUCH_END, () => {
1349
+ privacy.on(Node3.EventType.TOUCH_END, () => {
1261
1350
  console.log("open privacy");
1262
1351
  this.qg.openDeeplink({ uri: adItem.privacyUrl });
1263
1352
  });
1264
1353
  const permission = info.getChildByName("permission");
1265
- permission.on(Node.EventType.TOUCH_END, () => {
1354
+ permission.on(Node3.EventType.TOUCH_END, () => {
1266
1355
  console.log("open permission");
1267
1356
  this.qg.openDeeplink({ uri: adItem.permissionUrl });
1268
1357
  });
1269
- pic.on(Node.EventType.TOUCH_END, () => {
1358
+ pic.on(Node3.EventType.TOUCH_END, () => {
1270
1359
  console.log("native click");
1271
1360
  YCSDK.ins.onClick("Native" /* Native */);
1272
1361
  nativeAd.reportAdClick({ adId: adItem.adId });
1273
1362
  });
1274
- close.on(Node.EventType.TOUCH_END, () => {
1363
+ close.on(Node3.EventType.TOUCH_END, () => {
1275
1364
  console.log("close native");
1276
1365
  nativeAd.destroy();
1277
1366
  node.destroy();
@@ -1498,7 +1587,6 @@ var OppoGame = class {
1498
1587
  this.bannerAd.destroy();
1499
1588
  this.bannerAd = null;
1500
1589
  }
1501
- this.refreshBanner();
1502
1590
  });
1503
1591
  this.bannerAd.onError((err) => {
1504
1592
  console.log("banner\u9519\u8BEF\u76D1\u542C: ", JSON.stringify(err));
@@ -1513,28 +1601,17 @@ var OppoGame = class {
1513
1601
  });
1514
1602
  this.bannerAd.show();
1515
1603
  }
1516
- refreshBanner() {
1517
- if (this.timerBanner) {
1518
- clearTimeout(this.timerBanner);
1519
- this.timerBanner = 0;
1520
- }
1521
- this.timerBanner = setTimeout(() => {
1522
- this.createBannerAd("Bottom" /* Bottom */);
1523
- }, 30 * 1e3);
1524
- }
1525
1604
  hideBanner() {
1526
1605
  console.log("oppo hide banner");
1527
1606
  if (this.bannerAd) {
1528
1607
  this.bannerAd.hide();
1529
1608
  }
1530
1609
  }
1531
- hideBigPicAd() {
1532
- console.log("oppo hide bigPicAd");
1533
- if (this.bigPicAd) {
1534
- this.bigPicAd.hide();
1610
+ showInters(type = "Initial" /* Initial */) {
1611
+ if (!type) {
1612
+ this.showInitialType();
1613
+ return;
1535
1614
  }
1536
- }
1537
- showInters(type) {
1538
1615
  switch (type) {
1539
1616
  case "Initial" /* Initial */:
1540
1617
  this.showInitialType();
@@ -1587,7 +1664,6 @@ var OppoGame = class {
1587
1664
  console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1094,\u6682\u4E0D\u652F\u6301\u539F\u751F\u6A21\u677F\u5E7F\u544A\u76F8\u5173API");
1588
1665
  return;
1589
1666
  }
1590
- this.hideBigPicAd();
1591
1667
  if (this.nativeAd) {
1592
1668
  this.nativeAd.destroy();
1593
1669
  this.nativeAd = null;
@@ -1681,6 +1757,7 @@ var OppoGame = class {
1681
1757
  } else {
1682
1758
  console.log("\u5E7F\u544A\u6CA1\u770B\u5B8C");
1683
1759
  YCSDK.ins.onClose("Video" /* Video */);
1760
+ videoCallBack && videoCallBack(false);
1684
1761
  }
1685
1762
  }
1686
1763
  });
@@ -2317,28 +2394,28 @@ var WeChatGame = class {
2317
2394
  // assets/script/ycsdk/minigame/MiniGame.ts
2318
2395
  var MiniGame = class {
2319
2396
  constructor(platform) {
2320
- this.count = 0;
2397
+ this.privacyKey = "PRIVACY";
2321
2398
  this.channelFactory(platform);
2322
2399
  }
2323
2400
  channelFactory(platform) {
2324
2401
  console.log("switch platform:", platform);
2325
2402
  switch (platform) {
2326
- case sys5.Platform.HUAWEI_QUICK_GAME:
2403
+ case sys6.Platform.HUAWEI_QUICK_GAME:
2327
2404
  this.channel = new HuaWeiGame();
2328
2405
  break;
2329
- case sys5.Platform.XIAOMI_QUICK_GAME:
2406
+ case sys6.Platform.XIAOMI_QUICK_GAME:
2330
2407
  this.channel = new XiaoMiGame();
2331
2408
  break;
2332
- case sys5.Platform.OPPO_MINI_GAME:
2409
+ case sys6.Platform.OPPO_MINI_GAME:
2333
2410
  this.channel = new OppoGame();
2334
2411
  break;
2335
- case sys5.Platform.VIVO_MINI_GAME:
2412
+ case sys6.Platform.VIVO_MINI_GAME:
2336
2413
  this.channel = new VivoGame();
2337
2414
  break;
2338
- case sys5.Platform.BYTEDANCE_MINI_GAME:
2415
+ case sys6.Platform.BYTEDANCE_MINI_GAME:
2339
2416
  this.channel = new DouYinGame();
2340
2417
  break;
2341
- case sys5.Platform.WECHAT_GAME:
2418
+ case sys6.Platform.WECHAT_GAME:
2342
2419
  this.channel = new WeChatGame();
2343
2420
  break;
2344
2421
  default:
@@ -2349,7 +2426,7 @@ var MiniGame = class {
2349
2426
  return Object.entries(json).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
2350
2427
  }
2351
2428
  init(callBack) {
2352
- if (!YCSDK.ins.isRun(sys5.Platform.OPPO_MINI_GAME)) {
2429
+ if (!YCSDK.ins.isRun(sys6.Platform.OPPO_MINI_GAME)) {
2353
2430
  this.setAdStateListener();
2354
2431
  this.channel.init(callBack);
2355
2432
  return;
@@ -2373,12 +2450,47 @@ var MiniGame = class {
2373
2450
  });
2374
2451
  }
2375
2452
  setAdStateListener() {
2376
- this.count++;
2377
- console.log("setAdStateListener run count:", this.count);
2378
2453
  const st = new AdTactics();
2379
2454
  st.refreshAll();
2380
2455
  YCSDK.ins.setAdStateListener(st);
2381
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
+ }
2382
2494
  login(callBack) {
2383
2495
  this.channel.login(callBack);
2384
2496
  }
@@ -2400,7 +2512,6 @@ var MiniGame = class {
2400
2512
  console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2401
2513
  return;
2402
2514
  }
2403
- console.log("interstitial type:", type);
2404
2515
  this.channel.showInters(type);
2405
2516
  }
2406
2517
  hideInters(type = "Native" /* Native */) {
@@ -2423,47 +2534,6 @@ var MiniGame = class {
2423
2534
  }
2424
2535
  };
2425
2536
 
2426
- // assets/script/ycsdk/minigame/PrivacyEvent.ts
2427
- import { Component, instantiate as instantiate2, Prefab as Prefab2, resources as resources2, Node as Node2, sys as sys6 } from "cc";
2428
- var PrivacyEvent = class extends Component {
2429
- onLoad() {
2430
- resources2.load("Privacy/yinsiUI", Prefab2, (err, prefab) => {
2431
- if (err) {
2432
- console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
2433
- return;
2434
- }
2435
- this.yinsiUI = instantiate2(prefab);
2436
- const close = this.yinsiUI.getChildByName("window").getChildByName("closeBtn");
2437
- close.on(Node2.EventType.TOUCH_END, () => {
2438
- this.yinsiUI.active = false;
2439
- }, this);
2440
- YCSDK.ins.getGameNode().addChild(this.yinsiUI);
2441
- console.log("on PrivacyEvent add");
2442
- });
2443
- }
2444
- openPrivacyPolicy(event) {
2445
- console.log("\u70B9\u51FB\u9690\u79C1\u653F\u7B56");
2446
- if (YCSDK.ins.isRun(sys6.Platform.HUAWEI_QUICK_GAME)) {
2447
- this.hwOpen();
2448
- return;
2449
- }
2450
- this.open();
2451
- }
2452
- hwOpen() {
2453
- const qg = window["qg"];
2454
- if (!qg) {
2455
- console.log("qg is null");
2456
- return;
2457
- }
2458
- qg.openDeeplink({
2459
- uri: "https://ds.rhino-times.com/tl/docs/m_privateprotocol.html"
2460
- });
2461
- }
2462
- open() {
2463
- this.yinsiUI.active = true;
2464
- }
2465
- };
2466
-
2467
2537
  // assets/script/ycsdk/nativegame/anroid/AndroidGame.ts
2468
2538
  var AndroidGame = class {
2469
2539
  constructor() {
@@ -2475,7 +2545,8 @@ var AndroidGame = class {
2475
2545
  login(callBack) {
2476
2546
  jsb.reflection.callStaticMethod(this.className, "login", "()V");
2477
2547
  }
2478
- pay(params, callBack) {
2548
+ showPolicy(node, callBack) {
2549
+ jsb.reflection.callStaticMethod(this.className, "showPolicy", "()V");
2479
2550
  }
2480
2551
  showBanner(position) {
2481
2552
  jsb.reflection.callStaticMethod(this.className, "showBanner", "()V");
@@ -2557,49 +2628,15 @@ var YCSDK = class _YCSDK {
2557
2628
  this.platform.init(callBack);
2558
2629
  }
2559
2630
  agreePrivacy() {
2631
+ if (this.isRun(sys7.Platform.ANDROID)) {
2632
+ return true;
2633
+ }
2560
2634
  return StorageUtils.getStringData(this.privacyKey) == "agree";
2561
2635
  }
2562
2636
  showPolicy(node, callBack) {
2563
2637
  console.log("ycsdk showPolicy");
2564
- if (this.isRun(sys7.Platform.ANDROID)) {
2565
- return;
2566
- }
2567
2638
  this.gameNode = node;
2568
- let agree = StorageUtils.getStringData(this.privacyKey);
2569
- console.log(agree);
2570
- if (agree == "agree") {
2571
- console.log("user agree privacy, not show");
2572
- callBack && callBack.userAgree();
2573
- return;
2574
- }
2575
- if (!node) {
2576
- console.log("node is null");
2577
- callBack && callBack.nodeError();
2578
- return;
2579
- }
2580
- resources3.load("Privacy/policyUI", Prefab3, (err, prefab) => {
2581
- if (err) {
2582
- console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
2583
- return;
2584
- }
2585
- const yinsiUI = instantiate3(prefab);
2586
- const content = yinsiUI.getChildByName("panel").getChildByName("content");
2587
- if (!content.getComponent(PrivacyEvent)) {
2588
- content.addComponent(PrivacyEvent);
2589
- }
2590
- const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
2591
- agree2.on(Node3.EventType.TOUCH_END, () => {
2592
- callBack.onAgree && callBack.onAgree();
2593
- StorageUtils.setStringData(this.privacyKey, "agree");
2594
- yinsiUI.active = false;
2595
- }, this);
2596
- const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
2597
- disagree.on(Node3.EventType.TOUCH_END, () => {
2598
- callBack.onDisAgree && callBack.onDisAgree();
2599
- yinsiUI.active = false;
2600
- }, this);
2601
- _YCSDK.ins.getGameNode().addChild(yinsiUI);
2602
- });
2639
+ this.platform.showPolicy(node, callBack);
2603
2640
  }
2604
2641
  login(callBack) {
2605
2642
  console.log("ycsdk login");
@@ -2619,12 +2656,8 @@ var YCSDK = class _YCSDK {
2619
2656
  max = Math.floor(max);
2620
2657
  return Math.floor(Math.random() * max) + 1;
2621
2658
  }
2622
- showInters(type = "Initial" /* Initial */) {
2659
+ showInters(type) {
2623
2660
  console.log("ycsdk show interstitial, type:", type);
2624
- if (type) {
2625
- this.platform.showInters(type);
2626
- return;
2627
- }
2628
2661
  this.platform.showInters(type);
2629
2662
  }
2630
2663
  hideInters(type = "Native" /* Native */) {