yingchigamesdk-cocos-v3 25.9.2 → 25.9.3

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.
@@ -4,8 +4,8 @@
4
4
  "imported": true,
5
5
  "uuid": "36f85d9e-b4bd-4149-a95e-3061a59784d6",
6
6
  "files": [
7
- ".png",
8
- ".json"
7
+ ".json",
8
+ ".png"
9
9
  ],
10
10
  "subMetas": {
11
11
  "ad": {
@@ -4,8 +4,8 @@
4
4
  "imported": true,
5
5
  "uuid": "20b8e4a3-e89a-47e3-aa1f-fdbba176aaef",
6
6
  "files": [
7
- ".png",
8
- ".json"
7
+ ".json",
8
+ ".png"
9
9
  ],
10
10
  "subMetas": {
11
11
  "close": {
@@ -4,8 +4,8 @@
4
4
  "imported": true,
5
5
  "uuid": "9fea1df9-2161-47b6-a8c0-27bbfb0a956f",
6
6
  "files": [
7
- ".png",
8
- ".json"
7
+ ".json",
8
+ ".png"
9
9
  ],
10
10
  "subMetas": {
11
11
  "6c48a": {
package/dist/index.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  import { InterstitialType } from "./ycsdk/minigame/InterstitialType";
2
- import { Config } from "./ycsdk/SDKConfig";
3
2
  import { BannerType } from "./ycsdk/minigame/BannerType";
4
3
  import { StorageUtils } from "./ycsdk/StorageUtils";
5
- import { AdState } from "./ycsdk/AdState";
6
4
  import { Md5 } from "./ycsdk/minigame/md5";
7
5
  import { AdType } from "./ycsdk/AdType";
8
6
  import { YCSDK } from "./ycsdk/YCSDK";
9
7
  import HttpRequest from "./ycsdk/minigame/HttpRequest";
10
8
  import { PrivacyEvent } from "./ycsdk/minigame/PrivacyEvent";
11
- import { PrivacyListener } from "./ycsdk/minigame/PrivacyListener";
12
- export { YCSDK, BannerType, Config, InterstitialType, StorageUtils, AdState, AdType, Md5, HttpRequest, PrivacyEvent, PrivacyListener };
9
+ export { YCSDK, BannerType, InterstitialType, StorageUtils, AdType, Md5, HttpRequest, PrivacyEvent };
package/dist/index.js CHANGED
@@ -6,34 +6,6 @@ var InterstitialType = /* @__PURE__ */ ((InterstitialType2) => {
6
6
  return InterstitialType2;
7
7
  })(InterstitialType || {});
8
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
- appId: "",
17
- bannerId: [],
18
- intersId: [],
19
- videoId: [],
20
- nativeId: [],
21
- nativeBannerId: [],
22
- extension: [],
23
- ratio: {
24
- inters: 50,
25
- native: 50,
26
- video: 0
27
- },
28
- ycBannerId: "",
29
- ycNativeId: "",
30
- ycVideoId: "",
31
- ycIntersId: "",
32
- ycBigPicId: "",
33
- ycNativeBannerId: "",
34
- customFunc: {}
35
- };
36
-
37
9
  // assets/script/ycsdk/minigame/BannerType.ts
38
10
  var BannerType = /* @__PURE__ */ ((BannerType2) => {
39
11
  BannerType2["Top"] = "Top";
@@ -583,6 +555,36 @@ import { instantiate as instantiate4, Node as Node4, Prefab as Prefab4, resource
583
555
 
584
556
  // assets/script/ycsdk/AdTactics.ts
585
557
  import { sys as sys3 } from "cc";
558
+
559
+ // assets/script/ycsdk/SDKConfig.ts
560
+ var sdkconfig = {
561
+ open: true,
562
+ subornUser: false,
563
+ subornUserTest: false,
564
+ version: "1536",
565
+ pkgName: "",
566
+ appId: "",
567
+ bannerId: [],
568
+ intersId: [],
569
+ videoId: [],
570
+ nativeId: [],
571
+ nativeBannerId: [],
572
+ extension: [],
573
+ ratio: {
574
+ inters: 50,
575
+ native: 50,
576
+ video: 0
577
+ },
578
+ ycBannerId: "",
579
+ ycNativeId: "",
580
+ ycVideoId: "",
581
+ ycIntersId: "",
582
+ ycBigPicId: "",
583
+ ycNativeBannerId: "",
584
+ customFunc: {}
585
+ };
586
+
587
+ // assets/script/ycsdk/AdTactics.ts
586
588
  var AdTactics = class {
587
589
  constructor() {
588
590
  this.bannerIndex = 0;
@@ -1605,6 +1607,10 @@ var OppoGame = class {
1605
1607
  console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1606
1608
  return;
1607
1609
  }
1610
+ if (position == "Native" /* Native */) {
1611
+ this.showNativeBanner();
1612
+ return;
1613
+ }
1608
1614
  this.hideBanner();
1609
1615
  this.createBannerAd(position);
1610
1616
  }
@@ -1636,7 +1642,12 @@ var OppoGame = class {
1636
1642
  this.bannerAd.destroy();
1637
1643
  this.bannerAd = null;
1638
1644
  }
1639
- YCSDK.ins.onError("Banner" /* Banner */);
1645
+ if (!sdkconfig.nativeBannerId || sdkconfig.nativeBannerId.length <= 0) {
1646
+ YCSDK.ins.onError("Banner" /* Banner */);
1647
+ return;
1648
+ }
1649
+ YCSDK.ins.onLoad("Banner" /* Banner */);
1650
+ this.showNativeBanner();
1640
1651
  });
1641
1652
  this.bannerAd.onClick((obj) => {
1642
1653
  console.log(`\u5F00\u542FBanner\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
@@ -1702,7 +1713,7 @@ var OppoGame = class {
1702
1713
  console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1703
1714
  return;
1704
1715
  }
1705
- let { windowHeight, windowWidth, platformVersionCode, screenWidth, screenHeight } = this.qg.getSystemInfoSync();
1716
+ let { windowHeight, windowWidth, platformVersionCode } = this.qg.getSystemInfoSync();
1706
1717
  if (platformVersionCode < 1094) {
1707
1718
  console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1094,\u6682\u4E0D\u652F\u6301\u539F\u751F\u6A21\u677F\u5E7F\u544A\u76F8\u5173API");
1708
1719
  return;
@@ -1711,13 +1722,24 @@ var OppoGame = class {
1711
1722
  this.nativeAd.destroy();
1712
1723
  this.nativeAd = null;
1713
1724
  }
1714
- this.nativeAd = this.qg.createCustomAd({
1715
- adUnitId: sdkconfig.ycNativeId,
1716
- style: {
1725
+ let style;
1726
+ if (YCSDK.ins.vertical()) {
1727
+ style = {
1717
1728
  top: windowHeight * 0.4,
1718
1729
  left: (windowWidth - windowWidth * 0.6) / 2,
1719
1730
  width: windowWidth * 0.6
1720
- }
1731
+ };
1732
+ } else {
1733
+ style = {
1734
+ //广告尺寸按4:3计算
1735
+ top: (windowHeight - windowWidth * 0.6 * 0.75) / 2,
1736
+ left: (windowWidth - windowWidth * 0.6) / 2,
1737
+ width: windowWidth * 0.6
1738
+ };
1739
+ }
1740
+ this.nativeAd = this.qg.createCustomAd({
1741
+ adUnitId: sdkconfig.ycNativeId,
1742
+ style
1721
1743
  });
1722
1744
  this.nativeAd.onLoad(() => {
1723
1745
  console.log("[\u539F\u751F\u6A21\u677F\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
@@ -1831,6 +1853,192 @@ var OppoGame = class {
1831
1853
  videoAd.load();
1832
1854
  YCSDK.ins.onLoad("Video" /* Video */);
1833
1855
  }
1856
+ showNativeBanner() {
1857
+ if (this.qg.getSystemInfoSync().platformVersionCode < 1144) {
1858
+ console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1144\uFF0C\u6682\u4E0D\u652F\u6301\u539F\u751F2.0\u76F8\u5173API");
1859
+ return;
1860
+ }
1861
+ let { windowHeight, windowWidth } = this.qg.getSystemInfoSync();
1862
+ let style = null;
1863
+ let bannerHeight = null;
1864
+ if (YCSDK.ins.vertical()) {
1865
+ bannerHeight = windowWidth / 5;
1866
+ style = {
1867
+ top: windowHeight - bannerHeight,
1868
+ left: 0,
1869
+ width: windowWidth,
1870
+ height: bannerHeight
1871
+ };
1872
+ } else {
1873
+ bannerHeight = windowHeight / 5;
1874
+ style = {
1875
+ top: windowHeight - bannerHeight,
1876
+ left: (windowWidth - windowHeight) / 2,
1877
+ width: windowHeight,
1878
+ height: bannerHeight
1879
+ };
1880
+ }
1881
+ let nativeAdvanceAd = this.qg.createNativeAdvanceAd({
1882
+ adUnitId: sdkconfig.ycNativeBannerId,
1883
+ style
1884
+ });
1885
+ nativeAdvanceAd.load().then(() => {
1886
+ console.log("promise \u56DE\u8C03\uFF1A\u52A0\u8F7D\u6210\u529F");
1887
+ }).catch((err) => {
1888
+ console.log(`promise \u56DE\u8C03\uFF1A\u52A0\u8F7D\u5931\u8D25 ${JSON.stringify(err)}`);
1889
+ });
1890
+ nativeAdvanceAd.onLoad(function(res) {
1891
+ console.log(`\u539F\u751F\u5E7F\u544A2.0\u52A0\u8F7D\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}, adList:${JSON.stringify(res.adList)}`);
1892
+ YCSDK.ins.onLoad("NativeBanner" /* NativeBanner */);
1893
+ if (res.code === 0 && res.adList && res.adList.length > 0) {
1894
+ let _adId = res.adList[0].adId;
1895
+ console.log("\u83B7\u53D6\u5E7F\u544Aid: " + _adId);
1896
+ if (_adId) {
1897
+ try {
1898
+ let nativeAdvanceAdRect = nativeAdvanceAd.createComponent({
1899
+ adId: _adId,
1900
+ componentType: "Rect",
1901
+ style: {
1902
+ color: "#FFFFFFFF",
1903
+ borderRadius: 20,
1904
+ borderWidth: 4,
1905
+ borderColor: "#89FFFFFF",
1906
+ opacity: 1,
1907
+ left: 0,
1908
+ top: 0,
1909
+ width: windowWidth,
1910
+ height: bannerHeight
1911
+ }
1912
+ });
1913
+ console.log(
1914
+ "\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 Rect, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
1915
+ nativeAdvanceAdRect.getComponentId()
1916
+ );
1917
+ } catch (error) {
1918
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 Rect \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
1919
+ }
1920
+ try {
1921
+ let nativeAdvanceAdImage = nativeAdvanceAd.createComponent({
1922
+ adId: _adId,
1923
+ componentType: "AdImage",
1924
+ style: {
1925
+ imageStyle: "icon",
1926
+ width: windowWidth / 5 - 30,
1927
+ height: bannerHeight - 30,
1928
+ borderRadius: 20,
1929
+ left: 15,
1930
+ top: 15
1931
+ }
1932
+ });
1933
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdImage, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", nativeAdvanceAdImage.getComponentId());
1934
+ } catch (error) {
1935
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdImage \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
1936
+ }
1937
+ try {
1938
+ let adTextComponent = nativeAdvanceAd.createComponent({
1939
+ adId: _adId,
1940
+ componentType: "AdText",
1941
+ style: {
1942
+ textStyle: "title",
1943
+ color: "#000000",
1944
+ fontSize: 18,
1945
+ top: bannerHeight / 4,
1946
+ left: windowWidth / 5 + 20,
1947
+ width: windowWidth / 2,
1948
+ height: bannerHeight / 2
1949
+ }
1950
+ });
1951
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdText, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", adTextComponent.getComponentId());
1952
+ } catch {
1953
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdText \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
1954
+ }
1955
+ try {
1956
+ let nativeAdvanceAdButton = nativeAdvanceAd.createComponent({
1957
+ adId: _adId,
1958
+ componentType: "AdButton",
1959
+ style: {
1960
+ left: windowWidth - windowWidth / 3,
1961
+ top: bannerHeight / 3,
1962
+ opacity: 1
1963
+ }
1964
+ });
1965
+ console.log(
1966
+ "\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdButton, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
1967
+ nativeAdvanceAdButton.getComponentId()
1968
+ );
1969
+ } catch (error) {
1970
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdButton \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
1971
+ }
1972
+ try {
1973
+ let nativeAdvanceAdCloseButton = nativeAdvanceAd.createComponent({
1974
+ adId: _adId,
1975
+ componentType: "AdCloseButton",
1976
+ style: {
1977
+ closeStyle: "topRight"
1978
+ }
1979
+ });
1980
+ console.log(
1981
+ "\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdCloseButton, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
1982
+ nativeAdvanceAdCloseButton.getComponentId()
1983
+ );
1984
+ } catch (error) {
1985
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdCloseButton \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
1986
+ }
1987
+ try {
1988
+ let nativeAdvanceAdLogo = nativeAdvanceAd.createComponent({
1989
+ adId: _adId,
1990
+ componentType: "AdLogo",
1991
+ style: {
1992
+ left: windowWidth - 80,
1993
+ top: bannerHeight - 30
1994
+ }
1995
+ });
1996
+ console.log(
1997
+ "\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdLogo, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
1998
+ nativeAdvanceAdLogo.getComponentId()
1999
+ );
2000
+ } catch (error) {
2001
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdLogo \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
2002
+ }
2003
+ try {
2004
+ let nativeAdvanceAdPrivacy = nativeAdvanceAd.createComponent({
2005
+ adId: _adId,
2006
+ componentType: "AdPrivacy",
2007
+ style: {
2008
+ privacyStyle: "light",
2009
+ fontSize: 12
2010
+ }
2011
+ });
2012
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdPrivacy, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", nativeAdvanceAdPrivacy.getComponentId());
2013
+ } catch (error) {
2014
+ console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdPrivacy \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
2015
+ }
2016
+ nativeAdvanceAd.show({ adId: _adId }).then(() => {
2017
+ console.log("promise \u56DE\u8C03\uFF1A\u5C55\u793A\u6210\u529F");
2018
+ }).catch((err) => {
2019
+ console.log(`promise \u56DE\u8C03\uFF1A\u5C55\u793A\u5931\u8D25 ${JSON.stringify(err)}`);
2020
+ nativeAdvanceAd.destroy();
2021
+ });
2022
+ }
2023
+ }
2024
+ });
2025
+ nativeAdvanceAd.onCreateComponentSucc(function(res) {
2026
+ console.log(`\u521B\u5EFA\u539F\u751F\u5E7F\u544A2.0\u7EC4\u4EF6\u6210\u529F\u56DE\u8C03, code: ${res.code}, msg: ${res.msg},adId: ${res.adId}, \u7EC4\u4EF6ID: ${res.componentId}`);
2027
+ });
2028
+ nativeAdvanceAd.onShow(function(res) {
2029
+ console.log(`\u539F\u751F\u5E7F\u544A2.0\u5C55\u793A\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}`);
2030
+ YCSDK.ins.onShow("NativeBanner" /* NativeBanner */);
2031
+ });
2032
+ nativeAdvanceAd.onError(function(err) {
2033
+ console.log(`\u539F\u751F\u5E7F\u544A2.0\u9519\u8BEF\u56DE\u8C03 : ${JSON.stringify(err)}`);
2034
+ YCSDK.ins.onError("NativeBanner" /* NativeBanner */);
2035
+ });
2036
+ nativeAdvanceAd.onClose((res) => {
2037
+ console.log(`\u539F\u751F\u5E7F\u544A2.0\u5173\u95ED\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}`);
2038
+ YCSDK.ins.onClose("NativeBanner" /* NativeBanner */);
2039
+ nativeAdvanceAd.destroy();
2040
+ });
2041
+ }
1834
2042
  customFunc(methodName, params, callBack) {
1835
2043
  console.log("oppo custom function name:", methodName);
1836
2044
  }