yingchigamesdk-cocos-v3 25.9.2 → 25.9.16
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/assets/resources/Privacy/ad.png.meta +2 -2
- package/assets/resources/Privacy/close.png.meta +2 -2
- package/assets/resources/Privacy/panelBg.png.meta +2 -2
- package/assets/resources/Privacy/policyUI.prefab +1 -1
- package/assets/resources/Privacy/yinsiUI.prefab +1 -2
- package/dist/index.d.ts +1 -4
- package/dist/index.js +404 -35
- package/dist/index.js.map +4 -4
- package/dist/ycsdk/minigame/oppo/OppoGame.d.ts +1 -0
- package/dist/ycsdk/nativegame/harmony/HarmonyGame.d.ts +19 -0
- package/dist/ycsdk/nativegame/harmony/HarmonySdk.d.ts +24 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"__type__": "cc.Prefab",
|
|
4
|
-
"_name": "",
|
|
4
|
+
"_name": "yinsiUI",
|
|
5
5
|
"_objFlags": 0,
|
|
6
6
|
"_native": "",
|
|
7
7
|
"data": {
|
|
@@ -903,7 +903,6 @@
|
|
|
903
903
|
"_type": 0,
|
|
904
904
|
"_inverted": false,
|
|
905
905
|
"_segments": 64,
|
|
906
|
-
"_spriteFrame": null,
|
|
907
906
|
"_alphaThreshold": 0.1,
|
|
908
907
|
"_id": ""
|
|
909
908
|
},
|
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
|
-
|
|
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;
|
|
@@ -1063,6 +1065,16 @@ var DouYinGame = class {
|
|
|
1063
1065
|
return false;
|
|
1064
1066
|
}
|
|
1065
1067
|
customFunc(methodName, params, callBack) {
|
|
1068
|
+
if (methodName == "vibrate") {
|
|
1069
|
+
window["tt"].vibrateShort({
|
|
1070
|
+
success(res) {
|
|
1071
|
+
console.log(`${res}`);
|
|
1072
|
+
},
|
|
1073
|
+
fail(res) {
|
|
1074
|
+
console.log(`vibrateShort\u8C03\u7528\u5931\u8D25`);
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1066
1078
|
}
|
|
1067
1079
|
};
|
|
1068
1080
|
|
|
@@ -1605,6 +1617,10 @@ var OppoGame = class {
|
|
|
1605
1617
|
console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
|
|
1606
1618
|
return;
|
|
1607
1619
|
}
|
|
1620
|
+
if (position == "Native" /* Native */) {
|
|
1621
|
+
this.showNativeBanner();
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1608
1624
|
this.hideBanner();
|
|
1609
1625
|
this.createBannerAd(position);
|
|
1610
1626
|
}
|
|
@@ -1636,7 +1652,12 @@ var OppoGame = class {
|
|
|
1636
1652
|
this.bannerAd.destroy();
|
|
1637
1653
|
this.bannerAd = null;
|
|
1638
1654
|
}
|
|
1639
|
-
|
|
1655
|
+
if (!sdkconfig.nativeBannerId || sdkconfig.nativeBannerId.length <= 0) {
|
|
1656
|
+
YCSDK.ins.onError("Banner" /* Banner */);
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
YCSDK.ins.onLoad("Banner" /* Banner */);
|
|
1660
|
+
this.showNativeBanner();
|
|
1640
1661
|
});
|
|
1641
1662
|
this.bannerAd.onClick((obj) => {
|
|
1642
1663
|
console.log(`\u5F00\u542FBanner\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
|
|
@@ -1702,7 +1723,7 @@ var OppoGame = class {
|
|
|
1702
1723
|
console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
|
|
1703
1724
|
return;
|
|
1704
1725
|
}
|
|
1705
|
-
let { windowHeight, windowWidth, platformVersionCode
|
|
1726
|
+
let { windowHeight, windowWidth, platformVersionCode } = this.qg.getSystemInfoSync();
|
|
1706
1727
|
if (platformVersionCode < 1094) {
|
|
1707
1728
|
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
1729
|
return;
|
|
@@ -1711,13 +1732,24 @@ var OppoGame = class {
|
|
|
1711
1732
|
this.nativeAd.destroy();
|
|
1712
1733
|
this.nativeAd = null;
|
|
1713
1734
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
style
|
|
1735
|
+
let style;
|
|
1736
|
+
if (YCSDK.ins.vertical()) {
|
|
1737
|
+
style = {
|
|
1717
1738
|
top: windowHeight * 0.4,
|
|
1718
1739
|
left: (windowWidth - windowWidth * 0.6) / 2,
|
|
1719
1740
|
width: windowWidth * 0.6
|
|
1720
|
-
}
|
|
1741
|
+
};
|
|
1742
|
+
} else {
|
|
1743
|
+
style = {
|
|
1744
|
+
//广告尺寸按4:3计算
|
|
1745
|
+
top: (windowHeight - windowWidth * 0.6 * 0.75) / 2,
|
|
1746
|
+
left: (windowWidth - windowWidth * 0.6) / 2,
|
|
1747
|
+
width: windowWidth * 0.6
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
this.nativeAd = this.qg.createCustomAd({
|
|
1751
|
+
adUnitId: sdkconfig.ycNativeId,
|
|
1752
|
+
style
|
|
1721
1753
|
});
|
|
1722
1754
|
this.nativeAd.onLoad(() => {
|
|
1723
1755
|
console.log("[\u539F\u751F\u6A21\u677F\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
|
|
@@ -1831,8 +1863,205 @@ var OppoGame = class {
|
|
|
1831
1863
|
videoAd.load();
|
|
1832
1864
|
YCSDK.ins.onLoad("Video" /* Video */);
|
|
1833
1865
|
}
|
|
1866
|
+
showNativeBanner() {
|
|
1867
|
+
if (this.qg.getSystemInfoSync().platformVersionCode < 1144) {
|
|
1868
|
+
console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1144\uFF0C\u6682\u4E0D\u652F\u6301\u539F\u751F2.0\u76F8\u5173API");
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
let { windowHeight, windowWidth } = this.qg.getSystemInfoSync();
|
|
1872
|
+
let style = null;
|
|
1873
|
+
let bannerHeight = null;
|
|
1874
|
+
if (YCSDK.ins.vertical()) {
|
|
1875
|
+
bannerHeight = windowWidth / 5;
|
|
1876
|
+
style = {
|
|
1877
|
+
top: windowHeight - bannerHeight,
|
|
1878
|
+
left: 0,
|
|
1879
|
+
width: windowWidth,
|
|
1880
|
+
height: bannerHeight
|
|
1881
|
+
};
|
|
1882
|
+
} else {
|
|
1883
|
+
bannerHeight = windowHeight / 5;
|
|
1884
|
+
style = {
|
|
1885
|
+
top: windowHeight - bannerHeight,
|
|
1886
|
+
left: (windowWidth - windowHeight) / 2,
|
|
1887
|
+
width: windowHeight,
|
|
1888
|
+
height: bannerHeight
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
let nativeAdvanceAd = this.qg.createNativeAdvanceAd({
|
|
1892
|
+
adUnitId: sdkconfig.ycNativeBannerId,
|
|
1893
|
+
style
|
|
1894
|
+
});
|
|
1895
|
+
nativeAdvanceAd.load().then(() => {
|
|
1896
|
+
console.log("promise \u56DE\u8C03\uFF1A\u52A0\u8F7D\u6210\u529F");
|
|
1897
|
+
}).catch((err) => {
|
|
1898
|
+
console.log(`promise \u56DE\u8C03\uFF1A\u52A0\u8F7D\u5931\u8D25 ${JSON.stringify(err)}`);
|
|
1899
|
+
});
|
|
1900
|
+
nativeAdvanceAd.onLoad(function(res) {
|
|
1901
|
+
console.log(`\u539F\u751F\u5E7F\u544A2.0\u52A0\u8F7D\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}, adList:${JSON.stringify(res.adList)}`);
|
|
1902
|
+
YCSDK.ins.onLoad("NativeBanner" /* NativeBanner */);
|
|
1903
|
+
if (res.code === 0 && res.adList && res.adList.length > 0) {
|
|
1904
|
+
let _adId = res.adList[0].adId;
|
|
1905
|
+
console.log("\u83B7\u53D6\u5E7F\u544Aid: " + _adId);
|
|
1906
|
+
if (_adId) {
|
|
1907
|
+
try {
|
|
1908
|
+
let nativeAdvanceAdRect = nativeAdvanceAd.createComponent({
|
|
1909
|
+
adId: _adId,
|
|
1910
|
+
componentType: "Rect",
|
|
1911
|
+
style: {
|
|
1912
|
+
color: "#FFFFFFFF",
|
|
1913
|
+
borderRadius: 20,
|
|
1914
|
+
borderWidth: 4,
|
|
1915
|
+
borderColor: "#89FFFFFF",
|
|
1916
|
+
opacity: 1,
|
|
1917
|
+
left: 0,
|
|
1918
|
+
top: 0,
|
|
1919
|
+
width: windowWidth,
|
|
1920
|
+
height: bannerHeight
|
|
1921
|
+
}
|
|
1922
|
+
});
|
|
1923
|
+
console.log(
|
|
1924
|
+
"\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 Rect, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
|
|
1925
|
+
nativeAdvanceAdRect.getComponentId()
|
|
1926
|
+
);
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 Rect \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
1929
|
+
}
|
|
1930
|
+
try {
|
|
1931
|
+
let nativeAdvanceAdImage = nativeAdvanceAd.createComponent({
|
|
1932
|
+
adId: _adId,
|
|
1933
|
+
componentType: "AdImage",
|
|
1934
|
+
style: {
|
|
1935
|
+
imageStyle: "icon",
|
|
1936
|
+
width: windowWidth / 5 - 30,
|
|
1937
|
+
height: bannerHeight - 30,
|
|
1938
|
+
borderRadius: 20,
|
|
1939
|
+
left: 15,
|
|
1940
|
+
top: 15
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdImage, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", nativeAdvanceAdImage.getComponentId());
|
|
1944
|
+
} catch (error) {
|
|
1945
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdImage \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
1946
|
+
}
|
|
1947
|
+
try {
|
|
1948
|
+
let adTextComponent = nativeAdvanceAd.createComponent({
|
|
1949
|
+
adId: _adId,
|
|
1950
|
+
componentType: "AdText",
|
|
1951
|
+
style: {
|
|
1952
|
+
textStyle: "title",
|
|
1953
|
+
color: "#000000",
|
|
1954
|
+
fontSize: 18,
|
|
1955
|
+
top: bannerHeight / 4,
|
|
1956
|
+
left: windowWidth / 5 + 20,
|
|
1957
|
+
width: windowWidth / 2,
|
|
1958
|
+
height: bannerHeight / 2
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdText, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", adTextComponent.getComponentId());
|
|
1962
|
+
} catch {
|
|
1963
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdText \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
1964
|
+
}
|
|
1965
|
+
try {
|
|
1966
|
+
let nativeAdvanceAdButton = nativeAdvanceAd.createComponent({
|
|
1967
|
+
adId: _adId,
|
|
1968
|
+
componentType: "AdButton",
|
|
1969
|
+
style: {
|
|
1970
|
+
left: windowWidth - windowWidth / 3,
|
|
1971
|
+
top: bannerHeight / 3,
|
|
1972
|
+
opacity: 1
|
|
1973
|
+
}
|
|
1974
|
+
});
|
|
1975
|
+
console.log(
|
|
1976
|
+
"\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdButton, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
|
|
1977
|
+
nativeAdvanceAdButton.getComponentId()
|
|
1978
|
+
);
|
|
1979
|
+
} catch (error) {
|
|
1980
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdButton \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
1981
|
+
}
|
|
1982
|
+
try {
|
|
1983
|
+
let nativeAdvanceAdCloseButton = nativeAdvanceAd.createComponent({
|
|
1984
|
+
adId: _adId,
|
|
1985
|
+
componentType: "AdCloseButton",
|
|
1986
|
+
style: {
|
|
1987
|
+
closeStyle: "topRight"
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
console.log(
|
|
1991
|
+
"\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdCloseButton, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
|
|
1992
|
+
nativeAdvanceAdCloseButton.getComponentId()
|
|
1993
|
+
);
|
|
1994
|
+
} catch (error) {
|
|
1995
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdCloseButton \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
1996
|
+
}
|
|
1997
|
+
try {
|
|
1998
|
+
let nativeAdvanceAdLogo = nativeAdvanceAd.createComponent({
|
|
1999
|
+
adId: _adId,
|
|
2000
|
+
componentType: "AdLogo",
|
|
2001
|
+
style: {
|
|
2002
|
+
left: windowWidth - 80,
|
|
2003
|
+
top: bannerHeight - 30
|
|
2004
|
+
}
|
|
2005
|
+
});
|
|
2006
|
+
console.log(
|
|
2007
|
+
"\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdLogo, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ",
|
|
2008
|
+
nativeAdvanceAdLogo.getComponentId()
|
|
2009
|
+
);
|
|
2010
|
+
} catch (error) {
|
|
2011
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdLogo \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
2012
|
+
}
|
|
2013
|
+
try {
|
|
2014
|
+
let nativeAdvanceAdPrivacy = nativeAdvanceAd.createComponent({
|
|
2015
|
+
adId: _adId,
|
|
2016
|
+
componentType: "AdPrivacy",
|
|
2017
|
+
style: {
|
|
2018
|
+
privacyStyle: "light",
|
|
2019
|
+
fontSize: 12
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdPrivacy, \u83B7\u53D6\u7EC4\u4EF6ID\uFF1A ", nativeAdvanceAdPrivacy.getComponentId());
|
|
2023
|
+
} catch (error) {
|
|
2024
|
+
console.log("\u5C1D\u8BD5\u521B\u5EFA\u7EC4\u4EF6 AdPrivacy \u5F02\u5E38,\u8BF7\u68C0\u67E5\u53C2\u6570");
|
|
2025
|
+
}
|
|
2026
|
+
nativeAdvanceAd.show({ adId: _adId }).then(() => {
|
|
2027
|
+
console.log("promise \u56DE\u8C03\uFF1A\u5C55\u793A\u6210\u529F");
|
|
2028
|
+
}).catch((err) => {
|
|
2029
|
+
console.log(`promise \u56DE\u8C03\uFF1A\u5C55\u793A\u5931\u8D25 ${JSON.stringify(err)}`);
|
|
2030
|
+
nativeAdvanceAd.destroy();
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
nativeAdvanceAd.onCreateComponentSucc(function(res) {
|
|
2036
|
+
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}`);
|
|
2037
|
+
});
|
|
2038
|
+
nativeAdvanceAd.onShow(function(res) {
|
|
2039
|
+
console.log(`\u539F\u751F\u5E7F\u544A2.0\u5C55\u793A\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}`);
|
|
2040
|
+
YCSDK.ins.onShow("NativeBanner" /* NativeBanner */);
|
|
2041
|
+
});
|
|
2042
|
+
nativeAdvanceAd.onError(function(err) {
|
|
2043
|
+
console.log(`\u539F\u751F\u5E7F\u544A2.0\u9519\u8BEF\u56DE\u8C03 : ${JSON.stringify(err)}`);
|
|
2044
|
+
YCSDK.ins.onError("NativeBanner" /* NativeBanner */);
|
|
2045
|
+
});
|
|
2046
|
+
nativeAdvanceAd.onClose((res) => {
|
|
2047
|
+
console.log(`\u539F\u751F\u5E7F\u544A2.0\u5173\u95ED\u56DE\u8C03, code: ${res.code}, msg: ${res.msg}`);
|
|
2048
|
+
YCSDK.ins.onClose("NativeBanner" /* NativeBanner */);
|
|
2049
|
+
nativeAdvanceAd.destroy();
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
1834
2052
|
customFunc(methodName, params, callBack) {
|
|
1835
2053
|
console.log("oppo custom function name:", methodName);
|
|
2054
|
+
if (methodName == "vibrate") {
|
|
2055
|
+
this.qg.vibrateShort({
|
|
2056
|
+
type: "medium",
|
|
2057
|
+
success: function(res) {
|
|
2058
|
+
},
|
|
2059
|
+
fail: function(res) {
|
|
2060
|
+
},
|
|
2061
|
+
complete: function(res) {
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
1836
2065
|
}
|
|
1837
2066
|
};
|
|
1838
2067
|
|
|
@@ -2628,6 +2857,142 @@ var AndroidGame = class {
|
|
|
2628
2857
|
}
|
|
2629
2858
|
};
|
|
2630
2859
|
|
|
2860
|
+
// assets/script/ycsdk/nativegame/harmony/HarmonySdk.ts
|
|
2861
|
+
var initSdkPhasesCallback;
|
|
2862
|
+
var intersCallback;
|
|
2863
|
+
var videoCallback;
|
|
2864
|
+
var payCallback;
|
|
2865
|
+
var redeemCallback;
|
|
2866
|
+
var TAG = "XSDK-HarmonySdk";
|
|
2867
|
+
var HarmonySdk = class _HarmonySdk {
|
|
2868
|
+
/**
|
|
2869
|
+
* 私有构造方法 不允许在子类和外部实例化对象(new一下)
|
|
2870
|
+
*/
|
|
2871
|
+
constructor() {
|
|
2872
|
+
this.VERSION = "1.0.1";
|
|
2873
|
+
}
|
|
2874
|
+
/** 使用 🎈:用懒加载形式实现单例模式 */
|
|
2875
|
+
// 前面加个static,变成静态方法,可以直接通过类来调用该方法
|
|
2876
|
+
static getInstance() {
|
|
2877
|
+
if (!_HarmonySdk.instance) {
|
|
2878
|
+
_HarmonySdk.instance = new _HarmonySdk();
|
|
2879
|
+
}
|
|
2880
|
+
return _HarmonySdk.instance;
|
|
2881
|
+
}
|
|
2882
|
+
initSDK(params, callback) {
|
|
2883
|
+
console.log(TAG, "initSDK version:" + this.VERSION);
|
|
2884
|
+
if (callback) initSdkPhasesCallback = callback;
|
|
2885
|
+
else initSdkPhasesCallback = null;
|
|
2886
|
+
globalThis.oh.postMessage("initSDK", 0);
|
|
2887
|
+
}
|
|
2888
|
+
getIntersFlag() {
|
|
2889
|
+
return true;
|
|
2890
|
+
}
|
|
2891
|
+
showInters(params, callback) {
|
|
2892
|
+
if (callback) intersCallback = callback;
|
|
2893
|
+
else intersCallback = null;
|
|
2894
|
+
globalThis.oh.postMessage("showInters", 0);
|
|
2895
|
+
}
|
|
2896
|
+
getVideoFlag() {
|
|
2897
|
+
return true;
|
|
2898
|
+
}
|
|
2899
|
+
showVideo(params, callback) {
|
|
2900
|
+
if (callback) videoCallback = callback;
|
|
2901
|
+
else videoCallback = null;
|
|
2902
|
+
globalThis.oh.postMessage("showVideo", "");
|
|
2903
|
+
}
|
|
2904
|
+
pay(params, callback) {
|
|
2905
|
+
if (callback) payCallback = callback;
|
|
2906
|
+
else payCallback = null;
|
|
2907
|
+
globalThis.oh.postMessage("pay", JSON.stringify(params));
|
|
2908
|
+
}
|
|
2909
|
+
copyText(text) {
|
|
2910
|
+
globalThis.oh.postMessage("copyText", text);
|
|
2911
|
+
}
|
|
2912
|
+
openUrl(url) {
|
|
2913
|
+
globalThis.oh.postMessage("openUrl", url);
|
|
2914
|
+
}
|
|
2915
|
+
setRedeemCallback(callback) {
|
|
2916
|
+
if (callback) redeemCallback = callback;
|
|
2917
|
+
else redeemCallback = null;
|
|
2918
|
+
}
|
|
2919
|
+
consumeOrder(orderId) {
|
|
2920
|
+
if (!orderId) return;
|
|
2921
|
+
globalThis.oh.postMessage("consumeOrder", orderId);
|
|
2922
|
+
}
|
|
2923
|
+
vibrate() {
|
|
2924
|
+
globalThis.oh.postMessage("vibrate", 0);
|
|
2925
|
+
}
|
|
2926
|
+
};
|
|
2927
|
+
window["LightHarmonyInitCallback"] = (phases, res) => {
|
|
2928
|
+
console.log(TAG, "\u521D\u59CB\u5316\u56DE\u8C03", phases, JSON.stringify(res));
|
|
2929
|
+
initSdkPhasesCallback && initSdkPhasesCallback(phases, res);
|
|
2930
|
+
};
|
|
2931
|
+
window["LightHarmonyVideoCallback"] = (res) => {
|
|
2932
|
+
console.log(TAG, "\u89C6\u9891\u662F\u5426\u64AD\u653E\u5B8C\u6210?", res == "1");
|
|
2933
|
+
videoCallback && videoCallback(res == "1" ? "videoPlayFinish" : "videoPlayBreak", {});
|
|
2934
|
+
videoCallback = null;
|
|
2935
|
+
};
|
|
2936
|
+
window["LightHarmonyIntersCallBack"] = () => {
|
|
2937
|
+
console.log(TAG, "\u63D2\u5C4F\u5173\u95ED\u56DE\u8C03");
|
|
2938
|
+
intersCallback && intersCallback("intersClose", {});
|
|
2939
|
+
intersCallback = null;
|
|
2940
|
+
};
|
|
2941
|
+
window["LightHarmonyPayCallBack"] = (success, res) => {
|
|
2942
|
+
console.log(TAG, "\u652F\u4ED8\u7ED3\u679C\u56DE\u8C03:" + res);
|
|
2943
|
+
payCallback && payCallback(success == "1" ? "paySuccess" : "payFail", res);
|
|
2944
|
+
payCallback = null;
|
|
2945
|
+
};
|
|
2946
|
+
window["LightHarmonyRedeemCallBack"] = (res) => {
|
|
2947
|
+
console.log(TAG, "\u8865\u5355\u56DE\u8C03:" + res);
|
|
2948
|
+
redeemCallback && redeemCallback(res);
|
|
2949
|
+
};
|
|
2950
|
+
window["LightHarmonyOnResultCallBack"] = (code, res) => {
|
|
2951
|
+
console.log(TAG, "onResult\u56DE\u8C03, code:" + code + ";res:" + res);
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
// assets/script/ycsdk/nativegame/harmony/HarmonyGame.ts
|
|
2955
|
+
var TAG2 = "HarmonyGame";
|
|
2956
|
+
var HarmonyGame = class {
|
|
2957
|
+
init(callBack, adconfig, config) {
|
|
2958
|
+
HarmonySdk.getInstance().initSDK({}, (phases, res) => {
|
|
2959
|
+
console.log(TAG2, "phases:", phases, "res:", JSON.stringify(res));
|
|
2960
|
+
callBack && callBack();
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
login(callBack) {
|
|
2964
|
+
}
|
|
2965
|
+
showPolicy(node, callBack) {
|
|
2966
|
+
}
|
|
2967
|
+
pay(params, callBack) {
|
|
2968
|
+
}
|
|
2969
|
+
showBanner(position) {
|
|
2970
|
+
}
|
|
2971
|
+
hideBanner() {
|
|
2972
|
+
}
|
|
2973
|
+
showInters(type) {
|
|
2974
|
+
HarmonySdk.getInstance().showInters();
|
|
2975
|
+
}
|
|
2976
|
+
hideInters(type) {
|
|
2977
|
+
}
|
|
2978
|
+
showVideo(callBack) {
|
|
2979
|
+
HarmonySdk.getInstance().showVideo({}, (phases, res) => {
|
|
2980
|
+
console.log(TAG2, "showVideo, phases:" + phases + ";res:" + JSON.stringify(res));
|
|
2981
|
+
if (phases == "videoPlayFinish") {
|
|
2982
|
+
callBack && callBack(true);
|
|
2983
|
+
} else {
|
|
2984
|
+
callBack && callBack(false);
|
|
2985
|
+
}
|
|
2986
|
+
});
|
|
2987
|
+
return true;
|
|
2988
|
+
}
|
|
2989
|
+
customFunc(methodName, params, callBack) {
|
|
2990
|
+
if (methodName == "vibrate") {
|
|
2991
|
+
HarmonySdk.getInstance().vibrate();
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
};
|
|
2995
|
+
|
|
2631
2996
|
// assets/script/ycsdk/YCSDK.ts
|
|
2632
2997
|
var YCSDK = class _YCSDK {
|
|
2633
2998
|
constructor() {
|
|
@@ -2649,6 +3014,10 @@ var YCSDK = class _YCSDK {
|
|
|
2649
3014
|
this.platform = new AndroidGame();
|
|
2650
3015
|
return;
|
|
2651
3016
|
}
|
|
3017
|
+
if (platform == sys7.Platform.OPENHARMONY) {
|
|
3018
|
+
this.platform = new HarmonyGame();
|
|
3019
|
+
return;
|
|
3020
|
+
}
|
|
2652
3021
|
if (this.isSupportMiniGame(platform)) {
|
|
2653
3022
|
this.platform = new MiniGame(platform);
|
|
2654
3023
|
return;
|
|
@@ -2680,7 +3049,7 @@ var YCSDK = class _YCSDK {
|
|
|
2680
3049
|
this.platform.init(callBack, adconfig, cf);
|
|
2681
3050
|
}
|
|
2682
3051
|
agreePrivacy() {
|
|
2683
|
-
if (this.isRun(sys7.Platform.ANDROID)) {
|
|
3052
|
+
if (this.isRun(sys7.Platform.ANDROID) || this.isRun(sys7.Platform.OPENHARMONY)) {
|
|
2684
3053
|
return true;
|
|
2685
3054
|
}
|
|
2686
3055
|
return StorageUtils.getStringData(this.privacyKey) == "agree";
|