yingchigamesdk-cocos-v3 25.7.29 → 25.7.31

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
@@ -13,11 +13,13 @@ var sdkconfig = {
13
13
  subornUserTest: false,
14
14
  version: "1536",
15
15
  pkgName: "",
16
+ appId: "",
16
17
  bannerId: [],
17
18
  intersId: [],
18
19
  videoId: [],
19
20
  nativeId: [],
20
21
  nativeBannerId: [],
22
+ extension: [],
21
23
  ratio: {
22
24
  inters: 50,
23
25
  native: 50,
@@ -440,16 +442,96 @@ var AdType = /* @__PURE__ */ ((AdType2) => {
440
442
  })(AdType || {});
441
443
 
442
444
  // 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";
445
+ import { sys as sys7, view as view3 } from "cc";
446
+
447
+ // assets/script/ycsdk/minigame/DebugGame.ts
448
+ import { instantiate as instantiate2, Node as Node2, Prefab as Prefab2, resources as resources2 } from "cc";
449
+
450
+ // assets/script/ycsdk/minigame/PrivacyEvent.ts
451
+ import { Component, instantiate, Prefab, resources, Node, sys as sys2 } from "cc";
452
+ var PrivacyEvent = class extends Component {
453
+ onLoad() {
454
+ resources.load("Privacy/yinsiUI", Prefab, (err, prefab) => {
455
+ if (err) {
456
+ console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
457
+ return;
458
+ }
459
+ this.yinsiUI = instantiate(prefab);
460
+ const close = this.yinsiUI.getChildByName("window").getChildByName("closeBtn");
461
+ close.on(Node.EventType.TOUCH_END, () => {
462
+ this.yinsiUI.active = false;
463
+ }, this);
464
+ YCSDK.ins.getGameNode().addChild(this.yinsiUI);
465
+ });
466
+ }
467
+ openPrivacyPolicy(event) {
468
+ console.log("\u70B9\u51FB\u9690\u79C1\u653F\u7B56");
469
+ if (YCSDK.ins.isRun(sys2.Platform.HUAWEI_QUICK_GAME)) {
470
+ this.hwOpen();
471
+ return;
472
+ }
473
+ this.open();
474
+ }
475
+ hwOpen() {
476
+ const qg = window["qg"];
477
+ if (!qg) {
478
+ console.log("qg is null");
479
+ return;
480
+ }
481
+ qg.openDeeplink({
482
+ uri: "https://ds.rhino-times.com/tl/docs/m_privateprotocol.html"
483
+ });
484
+ }
485
+ open() {
486
+ this.yinsiUI.active = true;
487
+ }
488
+ };
444
489
 
445
490
  // assets/script/ycsdk/minigame/DebugGame.ts
446
491
  var DebugGame = class {
492
+ constructor() {
493
+ this.privacyKey = "PRIVACY";
494
+ }
447
495
  init(callBack) {
448
496
  console.log("debug init");
449
497
  callBack && callBack();
450
498
  }
451
499
  showPolicy(node, callBack) {
452
- console.log("bubug call show policy");
500
+ let agree = StorageUtils.getStringData(this.privacyKey);
501
+ console.log(agree);
502
+ if (agree == "agree") {
503
+ console.log("user agree privacy, not show");
504
+ callBack.userAgree && callBack.userAgree();
505
+ return;
506
+ }
507
+ if (!node) {
508
+ console.log("node is null");
509
+ callBack.nodeError && callBack.nodeError();
510
+ return;
511
+ }
512
+ resources2.load("Privacy/policyUI", Prefab2, (err, prefab) => {
513
+ if (err) {
514
+ console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
515
+ return;
516
+ }
517
+ const yinsiUI = instantiate2(prefab);
518
+ const content = yinsiUI.getChildByName("panel").getChildByName("content");
519
+ if (!content.getComponent(PrivacyEvent)) {
520
+ content.addComponent(PrivacyEvent);
521
+ }
522
+ const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
523
+ agree2.on(Node2.EventType.TOUCH_END, () => {
524
+ callBack.onAgree && callBack.onAgree();
525
+ StorageUtils.setStringData(this.privacyKey, "agree");
526
+ yinsiUI.active = false;
527
+ }, this);
528
+ const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
529
+ disagree.on(Node2.EventType.TOUCH_END, () => {
530
+ callBack.onDisAgree && callBack.onDisAgree();
531
+ yinsiUI.active = false;
532
+ }, this);
533
+ YCSDK.ins.getGameNode().addChild(yinsiUI);
534
+ });
453
535
  }
454
536
  login(callBack) {
455
537
  console.log("debug call login");
@@ -480,10 +562,10 @@ var DebugGame = class {
480
562
  };
481
563
 
482
564
  // assets/script/ycsdk/minigame/MiniGame.ts
483
- import { sys as sys5 } from "cc";
565
+ import { instantiate as instantiate4, Node as Node4, Prefab as Prefab4, resources as resources4, sys as sys6 } from "cc";
484
566
 
485
567
  // assets/script/ycsdk/AdTactics.ts
486
- import { sys as sys2 } from "cc";
568
+ import { sys as sys3 } from "cc";
487
569
  var AdTactics = class {
488
570
  constructor() {
489
571
  this.bannerIndex = 0;
@@ -520,7 +602,7 @@ var AdTactics = class {
520
602
  }
521
603
  onError(type, callBack) {
522
604
  console.log("on error: ", type);
523
- if (YCSDK.ins.isRun(sys2.Platform.OPPO_MINI_GAME)) {
605
+ if (YCSDK.ins.isRun(sys3.Platform.OPPO_MINI_GAME)) {
524
606
  this.reLoadAd(type, callBack);
525
607
  }
526
608
  }
@@ -1079,7 +1161,7 @@ var HttpRequest = class _HttpRequest {
1079
1161
  };
1080
1162
 
1081
1163
  // assets/script/ycsdk/minigame/huawei/HuaWeiGame.ts
1082
- import { assetManager, instantiate, Label, Node, Prefab, resources, Sprite, SpriteFrame, Texture2D } from "cc";
1164
+ import { assetManager, instantiate as instantiate3, Label, Node as Node3, Prefab as Prefab3, resources as resources3, Sprite, SpriteFrame, Texture2D } from "cc";
1083
1165
  var HuaWeiGame = class {
1084
1166
  constructor() {
1085
1167
  this.qg = window["qg"];
@@ -1095,7 +1177,7 @@ var HuaWeiGame = class {
1095
1177
  login(callBack) {
1096
1178
  this.qg.gameLoginWithReal({
1097
1179
  forceLogin: 1,
1098
- appid: sdkconfig.version,
1180
+ appid: sdkconfig.appId,
1099
1181
  success: function(data) {
1100
1182
  callBack && callBack(true);
1101
1183
  console.log(" game login with real success:" + JSON.stringify(data));
@@ -1138,12 +1220,12 @@ var HuaWeiGame = class {
1138
1220
  var bannerTop = sysInfo.safeArea.height;
1139
1221
  this.bannerAd = this.qg.createBannerAd({
1140
1222
  adUnitId: sdkconfig.ycBannerId,
1141
- adIntervals: 45,
1223
+ adIntervals: 35,
1142
1224
  //刷新时间
1143
1225
  style: {
1144
- top: bannerTop - 60,
1226
+ top: bannerTop - 20,
1145
1227
  left: 0,
1146
- height: 60,
1228
+ height: 57,
1147
1229
  width: 360
1148
1230
  }
1149
1231
  });
@@ -1181,7 +1263,7 @@ var HuaWeiGame = class {
1181
1263
  }
1182
1264
  showInters(type = "Initial" /* Initial */) {
1183
1265
  if (!type) {
1184
- const odds = YCSDK.ins.random(100);
1266
+ let odds = YCSDK.ins.random(100);
1185
1267
  if (odds >= 50 && sdkconfig.intersId.length >= 1) {
1186
1268
  this.showIntersVideo();
1187
1269
  } else if (sdkconfig.nativeId.length >= 1) {
@@ -1238,13 +1320,13 @@ var HuaWeiGame = class {
1238
1320
  // adId: 51790be2-d2c2-48ca-9695-1a55bed81905
1239
1321
  // creativeType: 103
1240
1322
  renderNative(adItem, nativeAd) {
1241
- resources.load("Privacy/bg", Prefab, (err, prefab) => {
1323
+ resources3.load("Privacy/bg", Prefab3, (err, prefab) => {
1242
1324
  if (err) {
1243
1325
  console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
1244
1326
  YCSDK.ins.onError("Native" /* Native */);
1245
1327
  return;
1246
1328
  }
1247
- const node = instantiate(prefab);
1329
+ const node = instantiate3(prefab);
1248
1330
  const native = node.getChildByName("native");
1249
1331
  const close = native.getChildByName("close");
1250
1332
  const title = native.getChildByName("title").getComponent(Label);
@@ -1256,31 +1338,31 @@ var HuaWeiGame = class {
1256
1338
  const pic = native.getChildByName("pic");
1257
1339
  const info = native.getChildByName("info");
1258
1340
  const version = info.getChildByName("verison");
1259
- version.on(Node.EventType.TOUCH_END, () => {
1341
+ version.on(Node3.EventType.TOUCH_END, () => {
1260
1342
  console.log("change version");
1261
1343
  version.getComponent(Label).string = adItem.versionName;
1262
1344
  });
1263
1345
  const description = info.getChildByName("description");
1264
- description.on(Node.EventType.TOUCH_END, () => {
1346
+ description.on(Node3.EventType.TOUCH_END, () => {
1265
1347
  console.log("open description");
1266
1348
  this.qg.openDeeplink({ uri: adItem.appDetailUrl });
1267
1349
  });
1268
1350
  const privacy = info.getChildByName("privacy");
1269
- privacy.on(Node.EventType.TOUCH_END, () => {
1351
+ privacy.on(Node3.EventType.TOUCH_END, () => {
1270
1352
  console.log("open privacy");
1271
1353
  this.qg.openDeeplink({ uri: adItem.privacyUrl });
1272
1354
  });
1273
1355
  const permission = info.getChildByName("permission");
1274
- permission.on(Node.EventType.TOUCH_END, () => {
1356
+ permission.on(Node3.EventType.TOUCH_END, () => {
1275
1357
  console.log("open permission");
1276
1358
  this.qg.openDeeplink({ uri: adItem.permissionUrl });
1277
1359
  });
1278
- pic.on(Node.EventType.TOUCH_END, () => {
1360
+ pic.on(Node3.EventType.TOUCH_END, () => {
1279
1361
  console.log("native click");
1280
1362
  YCSDK.ins.onClick("Native" /* Native */);
1281
1363
  nativeAd.reportAdClick({ adId: adItem.adId });
1282
1364
  });
1283
- close.on(Node.EventType.TOUCH_END, () => {
1365
+ close.on(Node3.EventType.TOUCH_END, () => {
1284
1366
  console.log("close native");
1285
1367
  nativeAd.destroy();
1286
1368
  node.destroy();
@@ -2314,28 +2396,28 @@ var WeChatGame = class {
2314
2396
  // assets/script/ycsdk/minigame/MiniGame.ts
2315
2397
  var MiniGame = class {
2316
2398
  constructor(platform) {
2317
- this.count = 0;
2399
+ this.privacyKey = "PRIVACY";
2318
2400
  this.channelFactory(platform);
2319
2401
  }
2320
2402
  channelFactory(platform) {
2321
2403
  console.log("switch platform:", platform);
2322
2404
  switch (platform) {
2323
- case sys5.Platform.HUAWEI_QUICK_GAME:
2405
+ case sys6.Platform.HUAWEI_QUICK_GAME:
2324
2406
  this.channel = new HuaWeiGame();
2325
2407
  break;
2326
- case sys5.Platform.XIAOMI_QUICK_GAME:
2408
+ case sys6.Platform.XIAOMI_QUICK_GAME:
2327
2409
  this.channel = new XiaoMiGame();
2328
2410
  break;
2329
- case sys5.Platform.OPPO_MINI_GAME:
2411
+ case sys6.Platform.OPPO_MINI_GAME:
2330
2412
  this.channel = new OppoGame();
2331
2413
  break;
2332
- case sys5.Platform.VIVO_MINI_GAME:
2414
+ case sys6.Platform.VIVO_MINI_GAME:
2333
2415
  this.channel = new VivoGame();
2334
2416
  break;
2335
- case sys5.Platform.BYTEDANCE_MINI_GAME:
2417
+ case sys6.Platform.BYTEDANCE_MINI_GAME:
2336
2418
  this.channel = new DouYinGame();
2337
2419
  break;
2338
- case sys5.Platform.WECHAT_GAME:
2420
+ case sys6.Platform.WECHAT_GAME:
2339
2421
  this.channel = new WeChatGame();
2340
2422
  break;
2341
2423
  default:
@@ -2346,7 +2428,7 @@ var MiniGame = class {
2346
2428
  return Object.entries(json).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
2347
2429
  }
2348
2430
  init(callBack) {
2349
- if (!YCSDK.ins.isRun(sys5.Platform.OPPO_MINI_GAME)) {
2431
+ if (!YCSDK.ins.isRun(sys6.Platform.OPPO_MINI_GAME)) {
2350
2432
  this.setAdStateListener();
2351
2433
  this.channel.init(callBack);
2352
2434
  return;
@@ -2370,12 +2452,47 @@ var MiniGame = class {
2370
2452
  });
2371
2453
  }
2372
2454
  setAdStateListener() {
2373
- this.count++;
2374
- console.log("setAdStateListener run count:", this.count);
2375
2455
  const st = new AdTactics();
2376
2456
  st.refreshAll();
2377
2457
  YCSDK.ins.setAdStateListener(st);
2378
2458
  }
2459
+ showPolicy(node, callBack) {
2460
+ let agree = StorageUtils.getStringData(this.privacyKey);
2461
+ console.log(agree);
2462
+ if (agree == "agree") {
2463
+ console.log("user agree privacy, not show");
2464
+ callBack.userAgree && callBack.userAgree();
2465
+ return;
2466
+ }
2467
+ if (!node) {
2468
+ console.log("node is null");
2469
+ callBack.nodeError && callBack.nodeError();
2470
+ return;
2471
+ }
2472
+ resources4.load("Privacy/policyUI", Prefab4, (err, prefab) => {
2473
+ if (err) {
2474
+ console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
2475
+ return;
2476
+ }
2477
+ const yinsiUI = instantiate4(prefab);
2478
+ const content = yinsiUI.getChildByName("panel").getChildByName("content");
2479
+ if (!content.getComponent(PrivacyEvent)) {
2480
+ content.addComponent(PrivacyEvent);
2481
+ }
2482
+ const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
2483
+ agree2.on(Node4.EventType.TOUCH_END, () => {
2484
+ callBack.onAgree && callBack.onAgree();
2485
+ StorageUtils.setStringData(this.privacyKey, "agree");
2486
+ yinsiUI.active = false;
2487
+ }, this);
2488
+ const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
2489
+ disagree.on(Node4.EventType.TOUCH_END, () => {
2490
+ callBack.onDisAgree && callBack.onDisAgree();
2491
+ yinsiUI.getChildByName("panel").getChildByName("tip").active = true;
2492
+ }, this);
2493
+ YCSDK.ins.getGameNode().addChild(yinsiUI);
2494
+ });
2495
+ }
2379
2496
  login(callBack) {
2380
2497
  this.channel.login(callBack);
2381
2498
  }
@@ -2419,47 +2536,6 @@ var MiniGame = class {
2419
2536
  }
2420
2537
  };
2421
2538
 
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
2539
  // assets/script/ycsdk/nativegame/anroid/AndroidGame.ts
2464
2540
  var AndroidGame = class {
2465
2541
  constructor() {
@@ -2471,7 +2547,8 @@ var AndroidGame = class {
2471
2547
  login(callBack) {
2472
2548
  jsb.reflection.callStaticMethod(this.className, "login", "()V");
2473
2549
  }
2474
- pay(params, callBack) {
2550
+ showPolicy(node, callBack) {
2551
+ jsb.reflection.callStaticMethod(this.className, "showPolicy", "()V");
2475
2552
  }
2476
2553
  showBanner(position) {
2477
2554
  jsb.reflection.callStaticMethod(this.className, "showBanner", "()V");
@@ -2545,57 +2622,25 @@ var YCSDK = class _YCSDK {
2545
2622
  return;
2546
2623
  }
2547
2624
  sdkconfig.pkgName = config.pkgName;
2625
+ sdkconfig.appId = config.appId;
2548
2626
  sdkconfig.bannerId = config.bannerId;
2549
2627
  sdkconfig.intersId = config.intersId;
2550
2628
  sdkconfig.nativeId = config.nativeId;
2551
2629
  sdkconfig.videoId = config.videoId;
2552
2630
  sdkconfig.nativeBannerId = config.nativeBannerId;
2631
+ sdkconfig.extension = config.extension;
2553
2632
  this.platform.init(callBack);
2554
2633
  }
2555
2634
  agreePrivacy() {
2635
+ if (this.isRun(sys7.Platform.ANDROID)) {
2636
+ return true;
2637
+ }
2556
2638
  return StorageUtils.getStringData(this.privacyKey) == "agree";
2557
2639
  }
2558
2640
  showPolicy(node, callBack) {
2559
2641
  console.log("ycsdk showPolicy");
2560
- if (this.isRun(sys7.Platform.ANDROID)) {
2561
- return;
2562
- }
2563
2642
  this.gameNode = node;
2564
- let agree = StorageUtils.getStringData(this.privacyKey);
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
- });
2643
+ this.platform.showPolicy(node, callBack);
2599
2644
  }
2600
2645
  login(callBack) {
2601
2646
  console.log("ycsdk login");
@@ -2704,6 +2749,7 @@ export {
2704
2749
  Md5,
2705
2750
  PrivacyEvent,
2706
2751
  StorageUtils,
2707
- YCSDK
2752
+ YCSDK,
2753
+ sdkconfig
2708
2754
  };
2709
2755
  //# sourceMappingURL=index.js.map