yingchigamesdk-cocos-v3 25.9.16 → 26.1.26

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
@@ -424,7 +424,7 @@ var AdType = /* @__PURE__ */ ((AdType2) => {
424
424
  })(AdType || {});
425
425
 
426
426
  // assets/script/ycsdk/YCSDK.ts
427
- import { sys as sys7, view as view3 } from "cc";
427
+ import { sys as sys3, view } from "cc";
428
428
 
429
429
  // assets/script/ycsdk/minigame/DebugGame.ts
430
430
  import { instantiate as instantiate2, Node as Node2, Prefab as Prefab2, resources as resources2 } from "cc";
@@ -550,2266 +550,32 @@ var DebugGame = class {
550
550
  }
551
551
  };
552
552
 
553
- // assets/script/ycsdk/minigame/MiniGame.ts
554
- import { instantiate as instantiate4, Node as Node4, Prefab as Prefab4, resources as resources4, sys as sys6 } from "cc";
555
-
556
- // assets/script/ycsdk/AdTactics.ts
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
588
- var AdTactics = class {
589
- constructor() {
590
- this.bannerIndex = 0;
591
- this.bannerLoaded = [];
592
- this.intersIndex = 0;
593
- this.intersLoaded = [];
594
- this.nativeIndex = 0;
595
- this.nativeLoaded = [];
596
- this.videoIndex = 0;
597
- this.videoLoaded = [];
598
- this.nativeBannerIndex = 0;
599
- this.nativeBanerLoaded = [];
600
- }
601
- onLoad(type) {
602
- console.log("on load: ", type);
603
- this.refreshId(type);
604
- switch (type) {
605
- case "Banner" /* Banner */:
606
- this.bannerLoaded = [];
607
- break;
608
- case "NativeBanner" /* NativeBanner */:
609
- this.nativeBanerLoaded = [];
610
- break;
611
- case "Inters" /* Inters */:
612
- this.intersLoaded = [];
613
- break;
614
- case "Native" /* Native */:
615
- this.nativeLoaded = [];
616
- break;
617
- case "Video" /* Video */:
618
- this.videoLoaded = [];
619
- break;
620
- }
621
- }
622
- onError(type, callBack) {
623
- console.log("on error: ", type);
624
- if (YCSDK.ins.isRun(sys3.Platform.OPPO_MINI_GAME)) {
625
- this.reLoadAd(type, callBack);
626
- }
627
- }
628
- onShow(type) {
629
- console.log("on show: ", type);
630
- }
631
- onClick(type) {
632
- console.log("on click: ", type);
633
- }
634
- onClose(type, callBack) {
635
- console.log("on close: ", type);
636
- }
637
- onReward() {
638
- console.log("on reward");
639
- }
640
- reLoadAd(type, callback) {
641
- console.log("reLoadAd: ", type);
642
- switch (type) {
643
- case "Banner" /* Banner */:
644
- this.reshowBanner();
645
- break;
646
- case "NativeBanner" /* NativeBanner */:
647
- this.reshowNativeBanner();
648
- break;
649
- case "Inters" /* Inters */:
650
- this.reshowInterstitial();
651
- break;
652
- case "Native" /* Native */:
653
- this.reshowNative();
654
- break;
655
- case "Video" /* Video */:
656
- this.reshowVideo(callback);
657
- break;
658
- }
659
- }
660
- reshowBanner() {
661
- const length = sdkconfig.bannerId.length;
662
- if (length == 0 || length == 1) {
663
- console.log("re show banner need more than 1 id");
664
- return;
665
- }
666
- if (this.bannerLoaded.includes(sdkconfig.ycBannerId)) {
667
- console.log("reshowBanner1: ", sdkconfig.ycBannerId, " already loaded");
668
- this.bannerLoaded = [];
669
- return;
670
- }
671
- this.bannerLoaded.push(sdkconfig.ycBannerId);
672
- this.refreshId("Banner" /* Banner */);
673
- if (this.bannerLoaded.includes(sdkconfig.ycBannerId)) {
674
- console.log("reshowBanner2: ", sdkconfig.ycBannerId, " already loaded");
675
- this.bannerLoaded = [];
676
- return;
677
- }
678
- YCSDK.ins.showBanner();
679
- }
680
- reshowNativeBanner() {
681
- const length = sdkconfig.nativeBannerId.length;
682
- if (length == 0 || length == 1) {
683
- console.log("re show native banner need more than 1 id");
684
- return;
685
- }
686
- if (this.nativeBanerLoaded.includes(sdkconfig.ycNativeBannerId)) {
687
- console.log("reshow native Banner1: ", sdkconfig.ycNativeBannerId, " already loaded");
688
- this.nativeBanerLoaded = [];
689
- return;
690
- }
691
- this.nativeBanerLoaded.push(sdkconfig.ycNativeBannerId);
692
- this.refreshId("Banner" /* Banner */);
693
- if (this.nativeBanerLoaded.includes(sdkconfig.ycNativeBannerId)) {
694
- console.log("reshow native Banner2: ", sdkconfig.ycNativeBannerId, " already loaded");
695
- this.nativeBanerLoaded = [];
696
- return;
697
- }
698
- YCSDK.ins.showBanner("Native" /* Native */);
699
- }
700
- reshowNative() {
701
- const length = sdkconfig.nativeId.length;
702
- if (length == 0 || length == 1) {
703
- console.log("re show native need more than 1 id");
704
- return;
705
- }
706
- if (this.nativeLoaded.includes(sdkconfig.ycNativeId)) {
707
- console.log("reshowNative1: ", sdkconfig.ycNativeId, " already loaded");
708
- this.nativeLoaded = [];
709
- return;
710
- }
711
- this.nativeLoaded.push(sdkconfig.ycNativeId);
712
- this.refreshId("Native" /* Native */);
713
- if (this.nativeLoaded.includes(sdkconfig.ycNativeId)) {
714
- console.log("reshowNative2: ", sdkconfig.ycNativeId, " already loaded");
715
- this.nativeLoaded = [];
716
- return;
717
- }
718
- YCSDK.ins.showInters("Native" /* Native */);
719
- }
720
- reshowInterstitial() {
721
- const length = sdkconfig.intersId.length;
722
- if (length == 0 || length == 1) {
723
- console.log("re show inters need more than 1 id");
724
- return;
725
- }
726
- if (this.intersLoaded.includes(sdkconfig.ycIntersId)) {
727
- console.log("reshowInterstitial1: ", sdkconfig.ycIntersId, " already loaded");
728
- this.intersLoaded = [];
729
- return;
730
- }
731
- this.intersLoaded.push(sdkconfig.ycIntersId);
732
- this.refreshId("Inters" /* Inters */);
733
- if (this.intersLoaded.includes(sdkconfig.ycIntersId)) {
734
- console.log("reshowInterstitial2: ", sdkconfig.ycIntersId, " already loaded");
735
- this.intersLoaded = [];
736
- return;
737
- }
738
- YCSDK.ins.showInters("Initial" /* Initial */);
739
- }
740
- reshowVideo(callback) {
741
- const length = sdkconfig.videoId.length;
742
- if (length == 0 || length == 1) {
743
- console.log("re show video need more than 1 id");
744
- callback && callback(false);
745
- return;
746
- }
747
- if (this.videoLoaded.includes(sdkconfig.ycVideoId)) {
748
- console.log("reshowVideo1: ", sdkconfig.ycVideoId, " already loaded");
749
- callback && callback(false);
750
- this.videoLoaded = [];
751
- return;
752
- }
753
- this.videoLoaded.push(sdkconfig.ycVideoId);
754
- this.refreshId("Video" /* Video */);
755
- if (this.videoLoaded.includes(sdkconfig.ycVideoId)) {
756
- console.log("reshowVideo2: ", sdkconfig.ycVideoId, " already loaded");
757
- callback && callback(false);
758
- this.videoLoaded = [];
759
- return;
760
- }
761
- YCSDK.ins.showVideo(callback);
762
- }
763
- refreshAll() {
764
- const keys = Object.keys(AdType);
765
- for (const type of keys) {
766
- this.refreshId(type);
767
- }
768
- console.log("refreshAll");
769
- }
770
- checkBannerId() {
771
- var id = sdkconfig.bannerId;
772
- if (!id) {
773
- console.log("bannerId is not config");
774
- return;
775
- }
776
- if (!Array.isArray(id)) {
777
- console.log("bannerId is only one");
778
- sdkconfig.ycBannerId = id;
779
- return;
780
- }
781
- if (id.length == 1) {
782
- if (!id[0]) {
783
- console.log("id[0] config is empty string");
784
- return;
785
- }
786
- sdkconfig.ycBannerId = id[0];
787
- return;
788
- }
789
- if (id.length == 0) {
790
- console.log("bannerId config is empty");
791
- return;
792
- }
793
- sdkconfig.ycBannerId = id[this.bannerIndex];
794
- this.bannerIndex += 1;
795
- if (this.bannerIndex >= id.length) {
796
- this.bannerIndex = 0;
797
- }
798
- }
799
- checkNativeBannerId() {
800
- var id = sdkconfig.nativeBannerId;
801
- if (!id) {
802
- console.log("native banner id is not config");
803
- return;
804
- }
805
- if (!Array.isArray(id)) {
806
- console.log("native banner id is only one");
807
- sdkconfig.ycNativeBannerId = id;
808
- return;
809
- }
810
- if (id.length == 1) {
811
- if (!id[0]) {
812
- console.log("id[0] config is empty string");
813
- return;
814
- }
815
- sdkconfig.ycNativeBannerId = id[0];
816
- return;
817
- }
818
- if (id.length == 0) {
819
- console.log("native banner id config is empty");
820
- return;
821
- }
822
- sdkconfig.ycNativeBannerId = id[this.nativeBannerIndex];
823
- this.nativeBannerIndex += 1;
824
- if (this.nativeBannerIndex >= id.length) {
825
- this.nativeBannerIndex = 0;
826
- }
827
- }
828
- checkIntersId() {
829
- var id = sdkconfig.intersId;
830
- if (!id) {
831
- console.log("intersId is not config");
832
- return;
833
- }
834
- if (!Array.isArray(id)) {
835
- console.log("intersId is only one");
836
- sdkconfig.ycIntersId = id;
837
- return;
838
- }
839
- if (id.length == 1) {
840
- if (!id[0]) {
841
- console.log("id[0] config is empty string");
842
- return;
843
- }
844
- sdkconfig.ycIntersId = id[0];
845
- return;
846
- }
847
- if (id.length == 0) {
848
- console.log("intersId config is empty");
849
- return;
850
- }
851
- sdkconfig.ycIntersId = id[this.intersIndex];
852
- this.intersIndex += 1;
853
- if (this.intersIndex >= id.length) {
854
- this.intersIndex = 0;
855
- }
856
- }
857
- checkNativeId() {
858
- var id = sdkconfig.nativeId;
859
- if (!id) {
860
- console.log("nativeId is not config");
861
- return;
862
- }
863
- if (!Array.isArray(id)) {
864
- console.log("nativeId is only one");
865
- sdkconfig.ycNativeId = id;
866
- return;
867
- }
868
- if (id.length == 1) {
869
- if (!id[0]) {
870
- console.log("id[0] config is empty string");
871
- return;
872
- }
873
- sdkconfig.ycNativeId = id[0];
874
- return;
875
- }
876
- if (id.length == 0) {
877
- console.log("nativeId config is empty");
878
- return;
879
- }
880
- sdkconfig.ycNativeId = id[this.nativeIndex];
881
- this.nativeIndex += 1;
882
- if (this.nativeIndex >= id.length) {
883
- this.nativeIndex = 0;
884
- }
885
- }
886
- checkVideoId() {
887
- var id = sdkconfig.videoId;
888
- if (!id) {
889
- console.log("videoId is not config");
890
- return;
891
- }
892
- if (!Array.isArray(id)) {
893
- console.log("videoId is only one");
894
- sdkconfig.ycVideoId = id;
895
- return;
896
- }
897
- if (id.length == 1) {
898
- console.log("videoId length is 1");
899
- if (!id[0]) {
900
- console.log("id[0] config is empty string");
901
- return;
902
- }
903
- sdkconfig.ycVideoId = id[0];
904
- return;
905
- }
906
- if (id.length == 0) {
907
- console.log("videoId config is empty");
908
- return;
909
- }
910
- sdkconfig.ycVideoId = id[this.videoIndex];
911
- this.videoIndex += 1;
912
- if (this.videoIndex >= id.length) {
913
- this.videoIndex = 0;
914
- }
915
- }
916
- refreshId(type) {
917
- console.log("refresh id, type: ", type);
918
- switch (type) {
919
- case "Banner" /* Banner */:
920
- this.checkBannerId();
921
- break;
922
- case "NativeBanner" /* NativeBanner */:
923
- this.checkNativeBannerId();
924
- break;
925
- case "Inters" /* Inters */:
926
- this.checkIntersId();
927
- break;
928
- case "Native" /* Native */:
929
- this.checkNativeId();
930
- break;
931
- case "Video" /* Video */:
932
- this.checkVideoId();
933
- break;
934
- }
935
- }
936
- random(max) {
937
- max = Math.floor(max);
938
- return Math.floor(Math.random() * max);
939
- }
940
- };
941
-
942
- // assets/script/ycsdk/minigame/douyin/DouYinGame.ts
943
- var DouYinGame = class {
944
- constructor() {
945
- this.bannerAd = null;
946
- this.videoAd = null;
947
- this.callBack = null;
948
- }
949
- init() {
950
- this.initViedoAd(false);
951
- }
952
- login(callBack) {
953
- }
954
- pay(params, callBack) {
955
- }
956
- showBanner(position) {
957
- if (!sdkconfig.open) {
958
- console.log("\u5E7F\u544A\u672A\u5F00\u542F");
959
- return;
960
- }
961
- this.hideBanner();
962
- this.bannerAd = window["tt"].createBannerAd({
963
- adUnitId: sdkconfig.ycBannerId
964
- });
965
- this.bannerAd.onLoad(() => {
966
- YCSDK.ins.onLoad("Banner" /* Banner */);
967
- this.bannerAd.show().then(() => {
968
- YCSDK.ins.onShow("Banner" /* Banner */);
969
- console.log("\u5E7F\u544A\u663E\u793A\u6210\u529F");
970
- }).catch((err) => {
971
- YCSDK.ins.onError("Banner" /* Banner */);
972
- console.log("\u5E7F\u544A\u7EC4\u4EF6\u51FA\u73B0\u95EE\u9898", err);
973
- });
974
- });
975
- this.bannerAd.onError(({ errorCode, errMsg }) => {
976
- YCSDK.ins.onError("Banner" /* Banner */);
977
- console.log(errorCode, errMsg);
978
- });
979
- }
980
- hideBanner() {
981
- if (this.bannerAd) {
982
- this.bannerAd.hide();
983
- this.bannerAd.destroy();
984
- this.bannerAd = null;
985
- }
986
- }
987
- showInters(type) {
988
- const interstitialAd = window["tt"].createInterstitialAd({
989
- adUnitId: sdkconfig.ycIntersId
990
- });
991
- interstitialAd.onLoad(() => {
992
- YCSDK.ins.onLoad("Inters" /* Inters */);
993
- console.log("interstitialAd load");
994
- });
995
- interstitialAd.onError(({ errCode, errMsg }) => {
996
- YCSDK.ins.onError("Inters" /* Inters */);
997
- console.log("\u76D1\u542C\u5230\u9519\u8BEF", errCode, errMsg);
998
- });
999
- interstitialAd.load().then(() => {
1000
- interstitialAd.show().then(() => {
1001
- YCSDK.ins.onShow("Inters" /* Inters */);
1002
- console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u6210\u529F");
1003
- });
1004
- }).catch((err) => {
1005
- YCSDK.ins.onError("Inters" /* Inters */);
1006
- console.log(err);
1007
- });
1008
- }
1009
- hideInters(type) {
1010
- }
1011
- initViedoAd(show) {
1012
- this.videoAd = window["tt"].createRewardedVideoAd({
1013
- adUnitId: sdkconfig.ycVideoId
1014
- });
1015
- this.videoAd.onLoad(() => {
1016
- YCSDK.ins.onLoad("Video" /* Video */);
1017
- console.log("\u5E7F\u544A\u52A0\u8F7D\u5B8C\u6210");
1018
- });
1019
- this.videoAd.onError((errMsg) => {
1020
- YCSDK.ins.onError("Video" /* Video */);
1021
- console.log("\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", errMsg);
1022
- });
1023
- this.videoAd.onClose((res) => {
1024
- if (res && res.isEnded || res === void 0) {
1025
- console.log("\u5E7F\u544A\u64AD\u653E\u5B8C\u6210");
1026
- this.callBack && this.callBack(true);
1027
- } else {
1028
- console.log("\u5E7F\u544A\u64AD\u653E\u672A\u5B8C\u6210");
1029
- this.callBack && this.callBack(false);
1030
- }
1031
- });
1032
- if (show) {
1033
- this.videoAd.load().then(() => {
1034
- this.videoAd.show().then(() => {
1035
- YCSDK.ins.onShow("Video" /* Video */);
1036
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u6210\u529F");
1037
- }).catch((err) => {
1038
- YCSDK.ins.onError("Video" /* Video */);
1039
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", err);
1040
- });
1041
- });
1042
- } else {
1043
- this.videoAd.load();
1044
- }
1045
- }
1046
- showVideo(callBack) {
1047
- this.callBack = callBack;
1048
- if (!sdkconfig.ycVideoId) {
1049
- console.log("\u8BF7\u914D\u7F6E\u6FC0\u52B1\u89C6\u9891\u5E7F\u544AID");
1050
- callBack && callBack(false);
1051
- YCSDK.ins.onError("Video" /* Video */);
1052
- return false;
1053
- }
1054
- if (this.videoAd) {
1055
- this.videoAd.show().then(() => {
1056
- YCSDK.ins.onShow("Video" /* Video */);
1057
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u6210\u529F");
1058
- }).catch((err) => {
1059
- YCSDK.ins.onError("Video" /* Video */);
1060
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", err);
1061
- });
1062
- return true;
1063
- }
1064
- this.initViedoAd(true);
1065
- return false;
1066
- }
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
- }
1078
- }
1079
- };
1080
-
1081
- // assets/script/ycsdk/minigame/HttpRequest.ts
1082
- var HttpRequest = class _HttpRequest {
1083
- static {
1084
- this.AUTHORIZATION = "Authorization";
1085
- }
1086
- static {
1087
- this.CONTENT_TYPE = "Content-Type";
1088
- }
1089
- static {
1090
- this.Accept = "Accept";
1091
- }
1092
- static get() {
1093
- if (!_HttpRequest.instance) {
1094
- _HttpRequest.instance = new _HttpRequest();
1095
- }
1096
- return _HttpRequest.instance;
1097
- }
1098
- requestPostx3w(url, data, callback, head) {
1099
- console.log("HttpRequest url:", url);
1100
- console.log("HttpRequest data:", JSON.stringify(data));
1101
- this.httpRequest = new XMLHttpRequest();
1102
- this.httpRequest.onreadystatechange = function() {
1103
- console.log("HttpRequest", "onreadystatechange:", this.readyState, this.status);
1104
- if (this.readyState == 4 && this.status == 200) {
1105
- let res = JSON.parse(this.responseText);
1106
- console.log("HttpRequest", "response:", JSON.stringify(res));
1107
- if (res.status == 200) {
1108
- callback(true, res.data);
1109
- } else {
1110
- callback(false, res);
1111
- }
1112
- }
1113
- };
1114
- this.httpRequest.timeout = 5e3;
1115
- this.httpRequest.ontimeout = () => {
1116
- console.log("HttpRequest:", "request time out", url);
1117
- callback(false);
1118
- };
1119
- this.httpRequest.onerror = function(e) {
1120
- console.log("HttpRequest", url, " request error", JSON.stringify(e));
1121
- callback(false);
1122
- };
1123
- this.httpRequest.open("POST", url, true);
1124
- this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1125
- if (head) {
1126
- this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1127
- }
1128
- this.httpRequest.send(data);
1129
- }
1130
- requestGetx3w(url, data, callback, head) {
1131
- console.log("HttpRequest url:", url);
1132
- console.log("HttpRequest data:", JSON.stringify(data));
1133
- this.httpRequest = new XMLHttpRequest();
1134
- this.httpRequest.onreadystatechange = function() {
1135
- if (this.readyState == 4 && this.status == 200) {
1136
- let response = this.responseText.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2');
1137
- let res = JSON.parse(response);
1138
- console.log("HttpRequest", "response:", JSON.stringify(res));
1139
- if (res.status == 200) {
1140
- callback(true, res.data);
1141
- } else {
1142
- callback(false, res);
1143
- }
1144
- }
1145
- };
1146
- this.httpRequest.timeout = 5e3;
1147
- this.httpRequest.ontimeout = () => {
1148
- console.log("HttpRequest:", "request time out", url);
1149
- callback(false);
1150
- };
1151
- this.httpRequest.onerror = function(e) {
1152
- console.log("HttpRequest", url, " request error", JSON.stringify(e));
1153
- callback(false);
1154
- };
1155
- this.httpRequest.open("GET", url, true);
1156
- this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1157
- if (head) {
1158
- this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1159
- }
1160
- this.httpRequest.send(data);
1161
- }
1162
- requestPostjson(url, data, callback, head) {
1163
- console.log("HttpRequest url:", url);
1164
- this.httpRequest = new XMLHttpRequest();
1165
- this.httpRequest.onreadystatechange = function() {
1166
- if (this.readyState == 4 && this.status == 200) {
1167
- let res = JSON.parse(this.responseText);
1168
- console.log("HttpRequest", "response:", JSON.stringify(res));
1169
- if (res.code == 0) {
1170
- callback(true, res.data.config);
1171
- } else {
1172
- callback(false, res);
1173
- }
1174
- }
1175
- };
1176
- this.httpRequest.timeout = 3e3;
1177
- this.httpRequest.ontimeout = () => {
1178
- console.log("HttpRequest:", "request time out", url);
1179
- callback(false);
1180
- };
1181
- this.httpRequest.onerror = function(e) {
1182
- console.log("HttpRequest", url, " request error", JSON.stringify(e));
1183
- callback(false);
1184
- };
1185
- this.httpRequest.open("POST", url, true);
1186
- this.httpRequest.setRequestHeader(_HttpRequest.Accept, "application/json" /* APPLICATION_JSON */);
1187
- this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/json" /* APPLICATION_JSON */);
1188
- this.httpRequest.send(JSON.stringify(data));
1189
- }
1190
- };
1191
-
1192
- // assets/script/ycsdk/minigame/huawei/HuaWeiGame.ts
1193
- import { assetManager, instantiate as instantiate3, Label, Node as Node3, Prefab as Prefab3, resources as resources3, Sprite, SpriteFrame, Texture2D } from "cc";
1194
- var HuaWeiGame = class {
1195
- constructor() {
1196
- this.qg = window["qg"];
1197
- }
1198
- hideInters(type) {
1199
- }
1200
- customFunc(methodName, params, callBack) {
1201
- }
1202
- init(callBack) {
1203
- callBack && callBack();
1204
- this.loadVideo(this.callback);
1205
- }
1206
- login(callBack) {
1207
- this.qg.gameLoginWithReal({
1208
- forceLogin: 1,
1209
- appid: sdkconfig.appId,
1210
- success: function(data) {
1211
- callBack && callBack(true);
1212
- console.log(" game login with real success:" + JSON.stringify(data));
1213
- },
1214
- fail: function(data, code) {
1215
- console.log("game login with real fail:" + data + ", code:" + code);
1216
- if (code == 7004 || code == 2012) {
1217
- console.log("\u73A9\u5BB6\u53D6\u6D88\u767B\u5F55\uFF0C\u8FD4\u56DE\u6E38\u620F\u754C\u9762\u8BA9\u73A9\u5BB6\u91CD\u65B0\u767B\u5F55\u3002");
1218
- callBack && callBack(false, 7004);
1219
- }
1220
- if (code == 7021) {
1221
- callBack && callBack(false, 7021);
1222
- console.log("\u73A9\u5BB6\u53D6\u6D88\u5B9E\u540D\u8BA4\u8BC1\uFF0C\u7981\u6B62\u8FDB\u5165\u6E38\u620F");
1223
- }
1224
- }
1225
- });
1226
- }
1227
- pay(params, callBack) {
1228
- }
1229
- createPurchaseIntent(params, callBack) {
1230
- }
1231
- doCheck(content, sign, publicKey) {
1232
- if (!sign || !publicKey) {
1233
- return false;
1234
- }
1235
- }
1236
- consumeOwnedPurchase() {
1237
- }
1238
- showBanner(position) {
1239
- if (!sdkconfig.ycBannerId) {
1240
- console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1241
- return;
1242
- }
1243
- this.hideBanner();
1244
- if (this.bannerAd) {
1245
- this.bannerAd.destroy();
1246
- this.bannerAd = null;
1247
- }
1248
- var sysInfo = this.qg.getSystemInfoSync();
1249
- var bannerTop = sysInfo.safeArea.height;
1250
- this.bannerAd = this.qg.createBannerAd({
1251
- adUnitId: sdkconfig.ycBannerId,
1252
- adIntervals: 35,
1253
- //刷新时间
1254
- style: {
1255
- top: bannerTop - 20,
1256
- left: 0,
1257
- height: 57,
1258
- width: 360
1259
- }
1260
- });
1261
- this.bannerAd.onError((err) => {
1262
- console.log("huawei banner error: ", JSON.stringify(err));
1263
- if (this.bannerAd) {
1264
- this.bannerAd.destroy();
1265
- this.bannerAd = null;
1266
- }
1267
- YCSDK.ins.onError("Banner" /* Banner */);
1268
- });
1269
- this.bannerAd.onLoad(() => {
1270
- console.log("huawei banner on load");
1271
- YCSDK.ins.onLoad("Banner" /* Banner */);
1272
- YCSDK.ins.onShow("Banner" /* Banner */);
1273
- });
1274
- this.bannerAd.onClose(() => {
1275
- console.log("huawei banner on close");
1276
- if (this.bannerAd) {
1277
- this.bannerAd.destroy();
1278
- this.bannerAd = null;
1279
- }
1280
- YCSDK.ins.onClose("Banner" /* Banner */);
1281
- });
1282
- setTimeout(() => {
1283
- this.bannerAd.show();
1284
- }, 1e3);
1285
- }
1286
- hideBanner() {
1287
- if (!this.bannerAd) {
1288
- console.log("huawei banner ad is hide");
1289
- return;
1290
- }
1291
- this.bannerAd.hide();
1292
- }
1293
- showInters(type = "Initial" /* Initial */) {
1294
- if (!type) {
1295
- let odds = YCSDK.ins.random(100);
1296
- if (odds >= 50 && sdkconfig.intersId.length >= 1) {
1297
- this.showIntersVideo();
1298
- } else if (sdkconfig.nativeId.length >= 1) {
1299
- this.showNative();
1300
- } else {
1301
- this.showIntersVideo();
1302
- }
1303
- return;
1304
- }
1305
- switch (type) {
1306
- case "Initial" /* Initial */:
1307
- case "Video" /* Video */:
1308
- this.showIntersVideo();
1309
- break;
1310
- case "Native" /* Native */:
1311
- this.showNative();
1312
- break;
1313
- }
1314
- }
1315
- showNative() {
1316
- if (!sdkconfig.ycNativeId) {
1317
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1318
- return;
1319
- }
1320
- let nativeAd = this.qg.createNativeAd({
1321
- adUnitId: sdkconfig.ycNativeId,
1322
- success: (code) => {
1323
- console.log("loadNativeAd success: ", code);
1324
- },
1325
- fail: (data, code) => {
1326
- console.log("loadNativeAd fail: " + data + "," + code);
1327
- nativeAd.destroy();
1328
- }
1329
- });
1330
- nativeAd.offLoad();
1331
- nativeAd.onLoad((data) => {
1332
- YCSDK.ins.onLoad("Native" /* Native */);
1333
- let ad = data.adList[0];
1334
- this.renderNative(ad, nativeAd);
1335
- });
1336
- nativeAd.offError();
1337
- nativeAd.onError((e) => {
1338
- console.error("load ad error:" + JSON.stringify(e));
1339
- nativeAd.destroy();
1340
- YCSDK.ins.onError("Native" /* Native */);
1341
- });
1342
- nativeAd.load();
1343
- }
1344
- // appName: 百度极速版
1345
- // developerName: 百度在线网络技术(北京)有限公司
1346
- // versionName: 6.55.0.10
1347
- // privacyUrl: https://h5hosting-drcn.dbankcdn.cn/cch5/PPS/ssp-privacy-url/index.html?src=https%3A%2F%2Fs.bdstatic.com%2Fcommon%2Fagreement%2Fprivacy_new_lite.html
1348
- // permissionUrl: https://appgallery.huawei.com/open/permission?packageName=com.baidu.searchbox.lite&mediaPackageName=com.tl.lxndwzxyx.huawei
1349
- // appDetailUrl: https://appgallery.huawei.com/#/app_simple/C100029965
1350
- // imgUrlList: https://contentcenter-drcn.dbankcdn.cn/img/pub_17/PPS_realtimeimage_100_1/e1/v3/A667xiJZQ7SMM7cmqhmMXw/0Vm6YJiyTH-IloGzbCUO5w.png/__source__.jpg
1351
- // adId: 51790be2-d2c2-48ca-9695-1a55bed81905
1352
- // creativeType: 103
1353
- renderNative(adItem, nativeAd) {
1354
- resources3.load("Privacy/bg", Prefab3, (err, prefab) => {
1355
- if (err) {
1356
- console.error("\u52A0\u8F7DPrefab\u5931\u8D25:", err);
1357
- YCSDK.ins.onError("Native" /* Native */);
1358
- return;
1359
- }
1360
- const node = instantiate3(prefab);
1361
- const native = node.getChildByName("native");
1362
- const close = native.getChildByName("close");
1363
- const title = native.getChildByName("title").getComponent(Label);
1364
- title.string = adItem.appName;
1365
- const source = native.getChildByName("source").getComponent(Label);
1366
- source.string = adItem.source;
1367
- const company = native.getChildByName("company").getComponent(Label);
1368
- company.string = adItem.developerName;
1369
- const pic = native.getChildByName("pic");
1370
- const info = native.getChildByName("info");
1371
- const version = info.getChildByName("verison");
1372
- version.on(Node3.EventType.TOUCH_END, () => {
1373
- console.log("change version");
1374
- version.getComponent(Label).string = adItem.versionName;
1375
- });
1376
- const description = info.getChildByName("description");
1377
- description.on(Node3.EventType.TOUCH_END, () => {
1378
- console.log("open description");
1379
- this.qg.openDeeplink({ uri: adItem.appDetailUrl });
1380
- });
1381
- const privacy = info.getChildByName("privacy");
1382
- privacy.on(Node3.EventType.TOUCH_END, () => {
1383
- console.log("open privacy");
1384
- this.qg.openDeeplink({ uri: adItem.privacyUrl });
1385
- });
1386
- const permission = info.getChildByName("permission");
1387
- permission.on(Node3.EventType.TOUCH_END, () => {
1388
- console.log("open permission");
1389
- this.qg.openDeeplink({ uri: adItem.permissionUrl });
1390
- });
1391
- pic.on(Node3.EventType.TOUCH_END, () => {
1392
- console.log("native click");
1393
- YCSDK.ins.onClick("Native" /* Native */);
1394
- nativeAd.reportAdClick({ adId: adItem.adId });
1395
- });
1396
- close.on(Node3.EventType.TOUCH_END, () => {
1397
- console.log("close native");
1398
- nativeAd.destroy();
1399
- node.destroy();
1400
- YCSDK.ins.getGameNode().removeChild(node);
1401
- nativeAd.hideDownloadButton({
1402
- adId: adItem.adId,
1403
- success: (code) => {
1404
- console.log("hideDownloadButton: success");
1405
- },
1406
- fail: (data, code) => {
1407
- console.log(" hideDownloadButton fail: " + data + "," + code);
1408
- }
1409
- });
1410
- YCSDK.ins.onClose("Native" /* Native */);
1411
- });
1412
- assetManager.loadRemote(adItem.imgUrlList[0], (err2, image) => {
1413
- if (err2) {
1414
- console.error("\u52A0\u8F7D\u8FDC\u7A0B\u56FE\u7247\u5931\u8D25:", err2);
1415
- YCSDK.ins.onError("Native" /* Native */);
1416
- return;
1417
- }
1418
- const texture = new Texture2D();
1419
- texture.image = image;
1420
- let spriteFrame = new SpriteFrame();
1421
- spriteFrame.texture = texture;
1422
- pic.getComponent(Sprite).spriteFrame = spriteFrame;
1423
- YCSDK.ins.getGameNode().addChild(node);
1424
- YCSDK.ins.onShow("Native" /* Native */);
1425
- this.showNativeDownload(adItem, nativeAd, node);
1426
- nativeAd.reportAdShow({ adId: adItem.adId });
1427
- });
1428
- });
1429
- }
1430
- showNativeDownload(adItem, nativeAd, node) {
1431
- const { screenWidth, screenHeight } = this.qg.getSystemInfoSync();
1432
- console.log(screenWidth);
1433
- console.log(screenHeight);
1434
- nativeAd.showDownloadButton({
1435
- adId: adItem.adId,
1436
- style: {
1437
- left: screenWidth / 2 - screenWidth / 4,
1438
- top: screenHeight * 0.65,
1439
- heightType: "normal",
1440
- width: screenWidth / 2,
1441
- fixedWidth: true,
1442
- textSize: 50,
1443
- horizontalPadding: 50,
1444
- cornerRadius: 22,
1445
- normalTextColor: "#FFFFFF",
1446
- normalBackground: "#5291FF",
1447
- pressedColor: "#0A59F7",
1448
- normalStroke: 5,
1449
- normalStrokeCorlor: "#FF000000",
1450
- processingTextColor: "#5291FF",
1451
- processingBackground: "#0F000000",
1452
- processingColor: "#000000",
1453
- processingStroke: 10,
1454
- processingStrokeCorlor: "#0A59F7",
1455
- installingTextColor: "#000000",
1456
- installingBackground: "#FFFFFF",
1457
- installingStroke: 15,
1458
- installingStrokeCorlor: "#5291FF"
1459
- },
1460
- success: (code) => {
1461
- console.log("showDownloadButton: success");
1462
- },
1463
- fail: (data, code) => {
1464
- console.log("showDownloadButton fail: " + data + "," + code);
1465
- }
1466
- });
1467
- }
1468
- showIntersVideo() {
1469
- if (!sdkconfig.ycIntersId) {
1470
- console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
1471
- return;
1472
- }
1473
- let interstitialAd = this.qg.createInterstitialAd({
1474
- adUnitId: sdkconfig.ycIntersId
1475
- });
1476
- interstitialAd.onLoad(function(data) {
1477
- YCSDK.ins.onLoad("Inters" /* Inters */);
1478
- console.log("huawei inters onLoad data " + JSON.stringify(data));
1479
- interstitialAd.show();
1480
- YCSDK.ins.onShow("Inters" /* Inters */);
1481
- });
1482
- interstitialAd.onError((err) => {
1483
- interstitialAd.destroy();
1484
- console.log("huawei inters on error: ", JSON.stringify(err));
1485
- YCSDK.ins.onError("Inters" /* Inters */);
1486
- });
1487
- interstitialAd.onClose(() => {
1488
- console.log("huawei interstitialAd closed");
1489
- interstitialAd.destroy();
1490
- YCSDK.ins.onClose("Inters" /* Inters */);
1491
- });
1492
- interstitialAd.load();
1493
- }
1494
- showVideo(callBack) {
1495
- this.callback = callBack;
1496
- let lastCallTime = 0;
1497
- let nowCallTime = (/* @__PURE__ */ new Date()).getTime();
1498
- if (lastCallTime != 0 && nowCallTime - lastCallTime < 400) {
1499
- console.log("show video time too many");
1500
- return;
1501
- }
1502
- lastCallTime = nowCallTime;
1503
- if (this.rewardedVideoAd && this.callback) {
1504
- this.show();
1505
- return;
1506
- }
1507
- this.loadVideo(true);
1508
- return false;
1509
- }
1510
- loadVideo(show) {
1511
- if (!sdkconfig.ycVideoId) {
1512
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1513
- this.callback && this.callback(false);
1514
- return;
1515
- }
1516
- this.rewardedVideoAd = this.qg.createRewardedVideoAd({
1517
- adUnitId: sdkconfig.ycVideoId,
1518
- success: (code) => {
1519
- console.log("loadVideoAd createRewardedVideoAd success" + code);
1520
- },
1521
- fail: (data, code) => {
1522
- console.log("loadVideoAd createRewardedVideoAd fail: " + data + "," + code);
1523
- }
1524
- });
1525
- this.rewardedVideoAd.onLoad(() => {
1526
- console.log("loadVideoAd: ad loaded.");
1527
- YCSDK.ins.onLoad("Video" /* Video */);
1528
- if (show) {
1529
- this.show();
1530
- }
1531
- });
1532
- this.rewardedVideoAd.onError((e) => {
1533
- console.error("load ad error:" + JSON.stringify(e));
1534
- this.callback && this.callback(false);
1535
- YCSDK.ins.onError("Video" /* Video */, this.callback);
1536
- });
1537
- this.rewardedVideoAd.onClose((res) => {
1538
- console.log("ad onClose: " + res.isEnded);
1539
- YCSDK.ins.onClose("Video" /* Video */);
1540
- if (res && res.isEnded || res === void 0) {
1541
- console.log("\u64AD\u653E\u6FC0\u52B1\u89C6\u9891\u7ED3\u675F\uFF0C\u7ED9\u4E88\u5956\u52B1");
1542
- this.callback && this.callback(true);
1543
- YCSDK.ins.onReward();
1544
- } else {
1545
- this.callback && this.callback(false);
1546
- console.log("\u64AD\u653E\u6CA1\u7ED3\u675F\uFF0C\u4E0D\u7ED9\u4E88\u5956\u52B1");
1547
- }
1548
- this.rewardedVideoAd.load();
1549
- });
1550
- this.rewardedVideoAd.load();
1551
- }
1552
- show() {
1553
- if (this.rewardedVideoAd) {
1554
- this.rewardedVideoAd.show();
1555
- YCSDK.ins.onShow("Video" /* Video */);
1556
- }
1557
- }
1558
- };
1559
-
1560
- // assets/script/ycsdk/minigame/oppo/OppoGame.ts
1561
- var OppoGame = class {
1562
- constructor() {
1563
- this.qg = window["qg"];
1564
- this.count = 0;
1565
- console.log("current channel is oppo");
1566
- }
1567
- init(callback, adconfig, config) {
1568
- if (sdkconfig.subornUserTest) {
1569
- sdkconfig.subornUser = true;
1570
- this.configVideo(adconfig);
1571
- this.configNative(config);
1572
- callback && callback();
1573
- return;
1574
- }
1575
- let info = this.qg.getEnterOptionsSync();
1576
- console.log("oppo init: ", info);
1577
- if (info) {
1578
- let type = info.type;
1579
- let query = info.query;
1580
- let referrerInfo = info.referrerInfo;
1581
- if (query && query.key1 && query.key2) {
1582
- sdkconfig.subornUser = true;
1583
- this.configVideo(adconfig);
1584
- this.configNative(config);
1585
- }
1586
- }
1587
- callback && callback();
1588
- }
1589
- configNative(config) {
1590
- if (!config.switch) {
1591
- return;
1592
- }
1593
- if (config.loop > 0) {
1594
- setInterval(() => {
1595
- this.showInters(config.type == 0 ? "Initial" /* Initial */ : "Native" /* Native */);
1596
- }, config.loop * 1e3);
1597
- }
1598
- }
1599
- configVideo(adconfig) {
1600
- if (!adconfig.switch) {
1601
- return;
1602
- }
1603
- if (adconfig.delay > 0) {
1604
- setTimeout(() => {
1605
- this.loadVideoAdNoCallBack(adconfig.count);
1606
- }, adconfig.delay * 1e3);
1607
- return;
1608
- }
1609
- this.loadVideoAdNoCallBack(adconfig.count);
1610
- }
1611
- login(callBack) {
1612
- }
1613
- pay(params, callBack) {
1614
- }
1615
- showBanner(position = "Bottom" /* Bottom */) {
1616
- if (!sdkconfig.ycBannerId) {
1617
- console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1618
- return;
1619
- }
1620
- if (position == "Native" /* Native */) {
1621
- this.showNativeBanner();
1622
- return;
1623
- }
1624
- this.hideBanner();
1625
- this.createBannerAd(position);
1626
- }
1627
- createBannerAd(position) {
1628
- if (this.bannerAd) {
1629
- this.bannerAd.destroy();
1630
- this.bannerAd = null;
1631
- }
1632
- this.bannerAd = this.qg.createBannerAd({ adUnitId: sdkconfig.ycBannerId });
1633
- this.bannerAd.onResize((obj) => {
1634
- console.log("banner \u5BBD\u5EA6\uFF1A" + obj.width + ", banner \u9AD8\u5EA6\uFF1A" + obj.height);
1635
- });
1636
- this.bannerAd.onLoad(() => {
1637
- console.log("[Banner\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1638
- YCSDK.ins.onLoad("Banner" /* Banner */);
1639
- YCSDK.ins.onShow("Banner" /* Banner */);
1640
- });
1641
- this.bannerAd.onHide(() => {
1642
- console.log("banner\u5E7F\u544A\u9690\u85CF");
1643
- YCSDK.ins.onClose("Banner" /* Banner */);
1644
- if (this.bannerAd) {
1645
- this.bannerAd.destroy();
1646
- this.bannerAd = null;
1647
- }
1648
- });
1649
- this.bannerAd.onError((err) => {
1650
- console.log("banner\u9519\u8BEF\u76D1\u542C: ", JSON.stringify(err));
1651
- if (this.bannerAd) {
1652
- this.bannerAd.destroy();
1653
- this.bannerAd = null;
1654
- }
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();
1661
- });
1662
- this.bannerAd.onClick((obj) => {
1663
- console.log(`\u5F00\u542FBanner\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
1664
- });
1665
- this.bannerAd.show();
1666
- }
1667
- hideBanner() {
1668
- console.log("oppo hide banner");
1669
- if (this.bannerAd) {
1670
- this.bannerAd.hide();
1671
- }
1672
- }
1673
- showInters(type = "Initial" /* Initial */) {
1674
- if (!type) {
1675
- this.showInitialType();
1676
- return;
1677
- }
1678
- switch (type) {
1679
- case "Initial" /* Initial */:
1680
- this.showInitialType();
1681
- break;
1682
- case "Native" /* Native */:
1683
- this.showNativeType();
1684
- break;
1685
- case "Video" /* Video */:
1686
- this.showVideo(() => {
1687
- console.log("oppo video ad show success");
1688
- });
1689
- break;
1690
- }
1691
- }
1692
- showInitialType() {
1693
- if (!sdkconfig.ycIntersId) {
1694
- console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
1695
- return;
1696
- }
1697
- if (this.qg.getSystemInfoSync().platformVersionCode < 1061) {
1698
- console.log("\u5FEB\u5E94\u7528\u5E73\u53F0\u7248\u672C\u53F7\u4F4E\u4E8E1061,\u6682\u4E0D\u652F\u6301\u63D2\u5C4F\u5E7F\u544A\u76F8\u5173 API");
1699
- return;
1700
- }
1701
- var interstitialAd = this.qg.createInterstitialAd({
1702
- adUnitId: sdkconfig.ycIntersId
1703
- });
1704
- interstitialAd.onLoad(function() {
1705
- console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1706
- YCSDK.ins.onLoad("Inters" /* Inters */);
1707
- interstitialAd.show();
1708
- });
1709
- interstitialAd.onClose(function() {
1710
- console.log("\u63D2\u5C4F\u5E7F\u544A\u5173\u95ED");
1711
- YCSDK.ins.onClose("Inters" /* Inters */);
1712
- });
1713
- interstitialAd.onError(function(err) {
1714
- console.log("\u63D2\u5C4F\u5E7F\u544A\u51FA\u9519: ", err);
1715
- interstitialAd.destroy();
1716
- interstitialAd = null;
1717
- YCSDK.ins.onError("Inters" /* Inters */);
1718
- });
1719
- interstitialAd.load();
1720
- }
1721
- showNativeType() {
1722
- if (!sdkconfig.ycNativeId) {
1723
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1724
- return;
1725
- }
1726
- let { windowHeight, windowWidth, platformVersionCode } = this.qg.getSystemInfoSync();
1727
- if (platformVersionCode < 1094) {
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");
1729
- return;
1730
- }
1731
- if (this.nativeAd) {
1732
- this.nativeAd.destroy();
1733
- this.nativeAd = null;
1734
- }
1735
- let style;
1736
- if (YCSDK.ins.vertical()) {
1737
- style = {
1738
- top: windowHeight * 0.4,
1739
- left: (windowWidth - windowWidth * 0.6) / 2,
1740
- width: windowWidth * 0.6
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
1753
- });
1754
- this.nativeAd.onLoad(() => {
1755
- console.log("[\u539F\u751F\u6A21\u677F\u5E7F\u544A] \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
1756
- YCSDK.ins.onLoad("Native" /* Native */);
1757
- });
1758
- this.nativeAd.onClick((obj) => {
1759
- console.log(`\u539F\u751F\u6A21\u677F\u5E7F\u544A\u70B9\u51FB\u56DE\u8C03: code: ${obj.code},msg: '${obj.msg}'`);
1760
- YCSDK.ins.onClick("Native" /* Native */);
1761
- });
1762
- this.nativeAd.onHide(() => {
1763
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u9690\u85CF");
1764
- if (this.nativeAd) {
1765
- this.nativeAd.destroy();
1766
- this.nativeAd = null;
1767
- }
1768
- YCSDK.ins.onClose("Native" /* Native */);
1769
- });
1770
- this.nativeAd.onError((err) => {
1771
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u9519\u8BEF\u76D1\u542C\uFF1A", JSON.stringify(err));
1772
- if (this.nativeAd) {
1773
- this.nativeAd.destroy();
1774
- this.nativeAd = null;
1775
- }
1776
- YCSDK.ins.onError("Native" /* Native */);
1777
- });
1778
- this.nativeAd.show().then(() => {
1779
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544Apromise \u56DE\u8C03\uFF1A\u5C55\u793A\u6210\u529F");
1780
- YCSDK.ins.onShow("Native" /* Native */);
1781
- }).catch((err) => {
1782
- console.log(`\u539F\u751F\u6A21\u677F\u5E7F\u544Apromise \u56DE\u8C03\uFF1A\u5C55\u793A\u5931\u8D25 ${JSON.stringify(err)}`);
1783
- });
1784
- }
1785
- hideInters(type) {
1786
- if (type = "Native" /* Native */) {
1787
- if (!!this.nativeAd) {
1788
- this.nativeAd.hide();
1789
- }
1790
- }
1791
- }
1792
- showVideo(callBack) {
1793
- console.log("oppo video ad start show");
1794
- this.loadVideoAd(callBack);
1795
- return false;
1796
- }
1797
- loadVideoAd(videoCallBack) {
1798
- if (!sdkconfig.ycVideoId) {
1799
- console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1800
- videoCallBack && videoCallBack(false);
1801
- return;
1802
- }
1803
- let videoAd = this.qg.createRewardedVideoAd({
1804
- adUnitId: sdkconfig.ycVideoId
1805
- });
1806
- videoAd.onLoad(() => {
1807
- console.log("oppo video load success");
1808
- YCSDK.ins.onLoad("Video" /* Video */);
1809
- videoAd.show();
1810
- YCSDK.ins.onShow("Video" /* Video */);
1811
- });
1812
- videoAd.onError((err) => {
1813
- console.log("onError:" + JSON.stringify(err));
1814
- videoAd.destroy();
1815
- YCSDK.ins.onError("Video" /* Video */, videoCallBack);
1816
- });
1817
- videoAd.onClick(function(obj) {
1818
- console.log(`on click: code: ${obj.code}, msg: '${obj.msg}'`);
1819
- YCSDK.ins.onClick("Video" /* Video */);
1820
- });
1821
- videoAd.onClose((res) => {
1822
- YCSDK.ins.onClose("Video" /* Video */);
1823
- console.log("==> oppoRewardVideoAd onClose", res);
1824
- if (res == void 0) {
1825
- videoCallBack && videoCallBack(true);
1826
- YCSDK.ins.onReward();
1827
- } else {
1828
- if (res.isEnded) {
1829
- videoCallBack && videoCallBack(true);
1830
- YCSDK.ins.onReward();
1831
- } else {
1832
- console.log("\u5E7F\u544A\u6CA1\u770B\u5B8C");
1833
- YCSDK.ins.onClose("Video" /* Video */);
1834
- videoCallBack && videoCallBack(false);
1835
- }
1836
- }
1837
- });
1838
- videoAd.load();
1839
- }
1840
- loadVideoAdNoCallBack(adcount = 3) {
1841
- if (!sdkconfig.ycVideoId) {
1842
- console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
1843
- return;
1844
- }
1845
- let videoAd = this.qg.createRewardedVideoAd({
1846
- adUnitId: sdkconfig.ycVideoId
1847
- });
1848
- videoAd.onLoad(() => {
1849
- console.log("oppo video load success");
1850
- videoAd.show();
1851
- });
1852
- videoAd.onError((err) => {
1853
- console.log("onError:" + JSON.stringify(err));
1854
- YCSDK.ins.onError("Video" /* Video */);
1855
- });
1856
- videoAd.onClose((res) => {
1857
- this.count++;
1858
- if (this.count >= adcount) {
1859
- return;
1860
- }
1861
- this.loadVideoAdNoCallBack(adcount);
1862
- });
1863
- videoAd.load();
1864
- YCSDK.ins.onLoad("Video" /* Video */);
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
- }
2052
- customFunc(methodName, params, callBack) {
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
- }
2065
- }
2066
- };
2067
-
2068
- // assets/script/ycsdk/minigame/vivo/VivoGame.ts
2069
- import { view as view2 } from "cc";
2070
- var VivoGame = class {
2071
- constructor() {
2072
- this.qg = window["qg"];
2073
- this.bannerShowing = false;
2074
- }
2075
- init() {
2076
- this.platformVersionCode = this.qg.getSystemInfoSync().platformVersionCode;
2077
- console.log("vivo platformVersionCode: ", this.platformVersionCode);
2078
- }
2079
- login(callBack) {
2080
- }
2081
- pay(params, callBack) {
2082
- }
2083
- showBanner(position) {
2084
- if (this.platformVersionCode < 1031) {
2085
- console.log("platformVersionCode below 1031, can't show banner");
2086
- return;
2087
- }
2088
- if (!sdkconfig.ycBannerId) {
2089
- console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2090
- return;
2091
- }
2092
- if (this.bannerShowing) {
2093
- console.log("banner\u5E7F\u544A\u5C55\u793A\u4E2D");
2094
- return;
2095
- }
2096
- this.hideBanner();
2097
- this.bannerShowing = true;
2098
- this.bannerAd = this.qg.createBannerAd({
2099
- posId: sdkconfig.ycBannerId,
2100
- adIntervals: 35,
2101
- style: {}
2102
- });
2103
- this.bannerAd.onLoad(() => {
2104
- console.log("banner load");
2105
- this.bannerShowing = true;
2106
- YCSDK.ins.onLoad("Banner" /* Banner */);
2107
- });
2108
- this.bannerAd.onClose(() => {
2109
- console.log("banner close");
2110
- this.bannerShowing = false;
2111
- YCSDK.ins.onClose("Banner" /* Banner */);
2112
- });
2113
- this.bannerAd.onError((err) => {
2114
- console.log("banner\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25:", err);
2115
- this.bannerShowing = false;
2116
- YCSDK.ins.onError("Banner" /* Banner */);
2117
- });
2118
- this.bannerAd.show().then(() => {
2119
- console.log("banner\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
2120
- YCSDK.ins.onShow("Banner" /* Banner */);
2121
- this.bannerShowing = true;
2122
- }).catch((err) => {
2123
- this.bannerShowing = false;
2124
- console.log("banner\u5E7F\u544A\u5C55\u793A\u5931\u8D25:", JSON.stringify(err));
2125
- YCSDK.ins.onError("Banner" /* Banner */);
2126
- });
2127
- }
2128
- hideBanner() {
2129
- this.bannerShowing = false;
2130
- if (this.bannerAd) {
2131
- this.bannerAd.hide();
2132
- this.bannerAd.destroy();
2133
- this.bannerAd = null;
2134
- }
2135
- }
2136
- showInters(type) {
2137
- switch (type) {
2138
- case "Native" /* Native */:
2139
- this.showNative();
2140
- break;
2141
- case "Initial" /* Initial */:
2142
- case "Video" /* Video */:
2143
- this.showInitial();
2144
- break;
2145
- }
2146
- }
2147
- showInitial() {
2148
- if (this.platformVersionCode < 1031) {
2149
- console.log("platformVersionCode below 1031, can't show interstitialAd");
2150
- return;
2151
- }
2152
- if (!sdkconfig.ycIntersId) {
2153
- console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
2154
- return;
2155
- }
2156
- let interstitialAd = this.qg.createInterstitialAd({
2157
- posId: sdkconfig.ycIntersId
2158
- });
2159
- interstitialAd.onError((err) => {
2160
- console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
2161
- YCSDK.ins.onError("Inters" /* Inters */);
2162
- });
2163
- interstitialAd.onLoad(() => {
2164
- console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2165
- YCSDK.ins.onLoad("Inters" /* Inters */);
2166
- });
2167
- interstitialAd.onClose(() => {
2168
- console.log("\u63D2\u5C4F\u5E7F\u544A\u5173\u95ED");
2169
- YCSDK.ins.onClose("Inters" /* Inters */);
2170
- });
2171
- interstitialAd.show().then(() => {
2172
- console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
2173
- YCSDK.ins.onShow("Inters" /* Inters */);
2174
- }).catch((err) => {
2175
- console.log("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
2176
- YCSDK.ins.onError("Inters" /* Inters */);
2177
- });
2178
- }
2179
- hideNative() {
2180
- if (this.customAd) {
2181
- this.customAd.hide();
2182
- this.customAd.destroy();
2183
- this.customAd = null;
2184
- }
2185
- }
2186
- showNative() {
2187
- if (this.platformVersionCode < 1091) {
2188
- console.log("platformVersionCode below 1091, can't show custom ad");
2189
- return;
2190
- }
2191
- if (!sdkconfig.ycNativeId) {
2192
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2193
- return;
2194
- }
2195
- if (this.customAd && this.customAd.isShow()) {
2196
- console.log("native ad is show ing");
2197
- this.hideNative();
2198
- }
2199
- this.customAd = this.qg.createCustomAd({
2200
- posId: sdkconfig.ycNativeId,
2201
- style: {
2202
- width: view2.getVisibleSize().width,
2203
- gravity: "center"
2204
- }
2205
- });
2206
- this.customAd.onClose(() => {
2207
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95EDclose");
2208
- YCSDK.ins.onClose("Native" /* Native */);
2209
- });
2210
- this.customAd.onHide(() => {
2211
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95EDhide");
2212
- YCSDK.ins.onClose("Native" /* Native */);
2213
- });
2214
- this.customAd.onLoad(() => {
2215
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2216
- YCSDK.ins.onLoad("Native" /* Native */);
2217
- });
2218
- this.customAd.onError((err) => {
2219
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
2220
- YCSDK.ins.onError("Native" /* Native */);
2221
- });
2222
- this.customAd.show().then(() => {
2223
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
2224
- YCSDK.ins.onShow("Native" /* Native */);
2225
- }).catch((err) => {
2226
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
2227
- YCSDK.ins.onError("Native" /* Native */);
2228
- });
2229
- }
2230
- hideInters(type) {
2231
- this.hideNative();
2232
- }
2233
- showVideo(callBack) {
2234
- this.callback = callBack;
2235
- if (this.rewardedAd) {
2236
- this.rewardedAd.load();
2237
- } else {
2238
- this.loadVideo();
2239
- }
2240
- return false;
2241
- }
2242
- loadVideo() {
2243
- if (this.platformVersionCode < 1041) {
2244
- console.log("platformVersionCode below 1041, can't show video ad");
2245
- return;
2246
- }
2247
- if (!sdkconfig.ycVideoId) {
2248
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2249
- return;
2250
- }
2251
- this.rewardedAd = this.qg.createRewardedVideoAd({
2252
- posId: sdkconfig.ycVideoId
2253
- });
2254
- this.rewardedAd.onLoad((res) => {
2255
- if (res == "localAdVideo") {
2256
- console.log("\u6FC0\u52B1\u89C6\u9891 \u515C\u5E95\u5E7F\u544A-onload\u89E6\u53D1 ", res);
2257
- } else {
2258
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u52A0\u8F7D\u5B8C\u6210-onload\u89E6\u53D1 ", res);
2259
- }
2260
- YCSDK.ins.onLoad("Video" /* Video */);
2261
- this.rewardedAd.show().then(() => {
2262
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5B8C\u6210");
2263
- YCSDK.ins.onShow("Video" /* Video */);
2264
- }).catch((err) => {
2265
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u5C55\u793A\u5931\u8D25", JSON.stringify(err));
2266
- this.callback && this.callback(false);
2267
- this.showNative();
2268
- YCSDK.ins.onError("Video" /* Video */);
2269
- });
2270
- });
2271
- this.rewardedAd.onError((err) => {
2272
- console.log("\u6FC0\u52B1\u89C6\u9891\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25: ", JSON.stringify(err));
2273
- this.callback && this.callback(false);
2274
- YCSDK.ins.onError("Video" /* Video */);
2275
- });
2276
- this.rewardedAd.onClose((res) => {
2277
- console.log("\u6FC0\u52B1\u89C6\u9891\u5173\u95ED");
2278
- YCSDK.ins.onClose("Video" /* Video */);
2279
- if (res && res.isEnded) {
2280
- console.log("\u6B63\u5E38\u64AD\u653E\u7ED3\u675F\uFF0C\u53EF\u4EE5\u4E0B\u53D1\u6E38\u620F\u5956\u52B1");
2281
- this.callback && this.callback(true);
2282
- YCSDK.ins.onReward();
2283
- } else {
2284
- YCSDK.ins.onClose("Video" /* Video */);
2285
- console.log("\u64AD\u653E\u4E2D\u9014\u9000\u51FA\uFF0C\u4E0D\u4E0B\u53D1\u6E38\u620F\u5956\u52B1");
2286
- }
2287
- });
2288
- }
2289
- customFunc(methodName, params, callBack) {
2290
- }
2291
- };
2292
-
2293
- // assets/script/ycsdk/minigame/xiaomi/XiaoMiGame.ts
2294
- var XiaoMiGame = class {
2295
- constructor() {
2296
- this.qg = window["qg"];
2297
- this.bannerShowing = false;
2298
- }
2299
- init() {
2300
- this.platformVersionCode = this.qg.getSystemInfoSync().platformVersionCode;
2301
- }
2302
- login(callBack) {
2303
- }
2304
- pay(params, callBack) {
2305
- console.log("mi pay not support");
2306
- }
2307
- showBanner(position) {
2308
- if (!sdkconfig.ycBannerId) {
2309
- console.log("banner\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2310
- return;
2311
- }
2312
- let timeTag = Date.now();
2313
- if (timeTag - this.lastBanner < 30 * 1e3) {
2314
- console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---banner");
2315
- return;
2316
- }
2317
- if (this.bannerShowing) {
2318
- console.log("banner already showing");
2319
- return;
2320
- }
2321
- this.hideBanner();
2322
- this.bannerShowing = true;
2323
- this.bannerAd = this.qg.createBannerAd({
2324
- adUnitId: sdkconfig.ycBannerId,
2325
- adIntervals: 35
2326
- // style: {
2327
- // left: 0,
2328
- // top: 0,
2329
- // width: 1080
2330
- // }
2331
- });
2332
- this.bannerAd.onLoad(() => {
2333
- console.log("mi banner on load");
2334
- this.bannerShowing = true;
2335
- YCSDK.ins.onLoad("Banner" /* Banner */);
2336
- YCSDK.ins.onShow("Banner" /* Banner */);
2337
- });
2338
- this.bannerAd.onError((err) => {
2339
- console.log("mi banner error: ", err);
2340
- this.bannerShowing = false;
2341
- YCSDK.ins.onError("Banner" /* Banner */);
2342
- });
2343
- this.bannerAd.onClose(() => {
2344
- console.log("mi banner on close");
2345
- this.bannerShowing = false;
2346
- this.lastBanner = Date.now();
2347
- YCSDK.ins.onClose("Banner" /* Banner */);
2348
- });
2349
- this.bannerAd.show();
2350
- console.log("mi banner load");
2351
- }
2352
- hideBanner() {
2353
- this.bannerShowing = false;
2354
- if (this.bannerAd) {
2355
- this.bannerAd.hide();
2356
- this.bannerAd.destroy();
2357
- this.bannerAd = null;
2358
- }
2359
- }
2360
- showInters(type) {
2361
- switch (type) {
2362
- case "Initial" /* Initial */:
2363
- case "Video" /* Video */:
2364
- this.showInitial();
2365
- break;
2366
- case "Native" /* Native */:
2367
- this.showNative();
2368
- break;
2369
- }
2370
- }
2371
- showNative() {
2372
- if (this.platformVersionCode < 1110) {
2373
- console.log("platformVersionCode below 1110, current code: ", this.platformVersionCode);
2374
- return;
2375
- }
2376
- if (!sdkconfig.ycNativeId) {
2377
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2378
- return;
2379
- }
2380
- let timeTag = Date.now();
2381
- if (timeTag - this.lastNative < 30 * 1e3) {
2382
- console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---native");
2383
- return;
2384
- }
2385
- this.hideInters("Native" /* Native */);
2386
- this.customAd = this.qg.createCustomAd({
2387
- adUnitId: sdkconfig.ycNativeId,
2388
- style: {
2389
- left: 0,
2390
- top: 300,
2391
- width: 1080
2392
- }
2393
- });
2394
- this.customAd.onLoad(() => {
2395
- console.log("mi native on load");
2396
- YCSDK.ins.onLoad("Native" /* Native */);
2397
- });
2398
- this.customAd.onClose(() => {
2399
- console.log("mi native on close");
2400
- YCSDK.ins.onClose("Native" /* Native */);
2401
- this.lastNative = Date.now();
2402
- });
2403
- this.customAd.onShow(() => {
2404
- console.log("mi native show");
2405
- YCSDK.ins.onShow("Native" /* Native */);
2406
- });
2407
- this.customAd.onError((err) => {
2408
- console.log("mi native error: ", err);
2409
- YCSDK.ins.onError("Native" /* Native */);
2410
- });
2411
- this.customAd.show();
2412
- }
2413
- showInitial() {
2414
- if (!sdkconfig.ycIntersId) {
2415
- console.log("\u63D2\u5C4F\u5E7F\u544Aid\u672A\u914D\u7F6E");
2416
- return;
2417
- }
2418
- let timeTag = Date.now();
2419
- if (timeTag - this.lastInters < 30 * 1e3) {
2420
- console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---inters");
2421
- return;
2422
- }
2423
- let interstitialAd = this.qg.createInterstitialAd({
2424
- adUnitId: sdkconfig.ycIntersId
2425
- });
2426
- interstitialAd.onLoad(() => {
2427
- console.log("mi\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2428
- YCSDK.ins.onLoad("Inters" /* Inters */);
2429
- interstitialAd.show();
2430
- YCSDK.ins.onShow("Inters" /* Inters */);
2431
- });
2432
- interstitialAd.onClose(() => {
2433
- console.log("mi innters on close");
2434
- YCSDK.ins.onClose("Inters" /* Inters */);
2435
- this.lastInters = Date.now();
2436
- });
2437
- interstitialAd.onError((err) => {
2438
- console.log("mi inters error: ", err);
2439
- YCSDK.ins.onError("Inters" /* Inters */);
2440
- interstitialAd.destroy();
2441
- });
2442
- }
2443
- hideInters(type) {
2444
- if (this.customAd && type == "Native" /* Native */) {
2445
- this.customAd.hide();
2446
- this.customAd.destroy();
2447
- this.customAd = null;
2448
- }
2449
- }
2450
- showVideo(callBack) {
2451
- this.callback = callBack;
2452
- let timeTag = Date.now();
2453
- if (timeTag - this.lastReward < 30 * 1e3) {
2454
- console.log("30\u79D2\u5185\u4E0D\u5F97\u518D\u6B21\u5C55\u793A---video");
2455
- this.callback && this.callback(false);
2456
- return;
2457
- }
2458
- this.loadVideo(true);
2459
- return false;
2460
- }
2461
- loadVideo(show) {
2462
- if (!sdkconfig.ycVideoId) {
2463
- console.log("\u89C6\u9891\u5E7F\u544A\u53C2\u6570\u6CA1\u6709\u914D\u7F6E");
2464
- this.callback && this.callback(false);
2465
- this.callback = null;
2466
- return;
2467
- }
2468
- if (this.rewardedVideoAd) {
2469
- this.rewardedVideoAd = this.qg.createRewardedVideoAd({
2470
- adUnitId: sdkconfig.ycVideoId
2471
- });
2472
- console.log("reload video, ad id: ", sdkconfig.ycVideoId);
2473
- this.rewardedVideoAd.load();
2474
- return;
2475
- }
2476
- this.rewardedVideoAd = this.qg.createRewardedVideoAd({
2477
- adUnitId: sdkconfig.ycVideoId
2478
- });
2479
- console.log("create video, ad id: ", sdkconfig.ycVideoId);
2480
- this.rewardedVideoAd.onLoad(() => {
2481
- console.log("mi video on load");
2482
- YCSDK.ins.onLoad("Video" /* Video */);
2483
- if (show) {
2484
- setTimeout(() => {
2485
- this.rewardedVideoAd.show();
2486
- YCSDK.ins.onShow("Video" /* Video */);
2487
- }, 100);
2488
- }
2489
- });
2490
- this.rewardedVideoAd.onClose((isEnded) => {
2491
- console.log("mi video on close: ", isEnded);
2492
- this.lastReward = Date.now();
2493
- YCSDK.ins.onClose("Video" /* Video */);
2494
- if (isEnded.isEnded) {
2495
- YCSDK.ins.onReward();
2496
- this.callback && this.callback(isEnded.isEnded);
2497
- } else {
2498
- YCSDK.ins.onClose("Video" /* Video */);
2499
- }
2500
- });
2501
- this.rewardedVideoAd.onError((err) => {
2502
- console.log("mi video error: ", err);
2503
- YCSDK.ins.onError("Video" /* Video */);
2504
- });
2505
- this.rewardedVideoAd.load();
2506
- }
2507
- customFunc(methodName, params, callBack) {
2508
- console.log("custom function name:", methodName);
2509
- }
2510
- };
2511
-
2512
- // assets/script/ycsdk/minigame/wechat/WeChatGame.ts
2513
- var WeChatGame = class {
2514
- constructor() {
2515
- this.wx = window["wx"];
2516
- }
2517
- init(callBack) {
2518
- callBack && callBack();
2519
- }
2520
- login(callBack) {
2521
- }
2522
- pay(params, callBack) {
2523
- }
2524
- showBanner(position) {
2525
- if (this.bannerAd) {
2526
- this.bannerAd.destroy();
2527
- this.bannerAd = null;
2528
- }
2529
- const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2530
- this.bannerAd = this.wx.createBannerAd({
2531
- adUnitId: sdkconfig.ycBannerId,
2532
- style: {
2533
- left: 0,
2534
- top: 0,
2535
- width: screenWidth
2536
- }
2537
- });
2538
- this.bannerAd.onResize((size) => {
2539
- this.bannerAd.style.top = screenHeight - size.height;
2540
- });
2541
- this.bannerAd.onLoad(() => {
2542
- console.log("banner \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2543
- YCSDK.ins.onLoad("Banner" /* Banner */);
2544
- YCSDK.ins.onShow("Banner" /* Banner */);
2545
- });
2546
- this.bannerAd.onError((err) => {
2547
- console.log("banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25:", err);
2548
- YCSDK.ins.onError("Banner" /* Banner */);
2549
- this.showNativeBanner();
2550
- });
2551
- this.bannerAd.show();
2552
- }
2553
- showNativeBanner() {
2554
- const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2555
- const customAd = this.wx.createCustomAd({
2556
- adUnitId: sdkconfig.ycNativeId,
2557
- style: {
2558
- left: (screenWidth - 360) / 2,
2559
- top: screenHeight - 106,
2560
- width: 360,
2561
- height: 106
2562
- }
2563
- });
2564
- customAd.onResize((res) => {
2565
- console.log("on resize:", res);
2566
- customAd.style.top = screenHeight - res.height;
2567
- customAd.style.left = (screenWidth - res.width) / 2;
2568
- });
2569
- customAd.onLoad(() => {
2570
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2571
- YCSDK.ins.onLoad("Native" /* Native */);
2572
- });
2573
- customAd.onError((err) => {
2574
- console.log("\u539F\u751F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25", err);
2575
- YCSDK.ins.onError("Native" /* Native */);
2576
- });
2577
- customAd.onClose(() => {
2578
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u5173\u95ED");
2579
- YCSDK.ins.onClose("Native" /* Native */);
2580
- });
2581
- customAd.show().then(() => {
2582
- console.log("\u539F\u751F\u6A21\u677F\u5E7F\u544A\u663E\u793A");
2583
- YCSDK.ins.onShow("Native" /* Native */);
2584
- });
2585
- }
2586
- hideBanner() {
2587
- if (this.bannerAd) {
2588
- this.bannerAd.hide();
2589
- this.bannerAd.destroy();
2590
- this.bannerAd = null;
2591
- }
2592
- }
2593
- showInters(type) {
2594
- let interstitialAd = this.wx.createInterstitialAd({ adUnitId: sdkconfig.ycIntersId });
2595
- interstitialAd.onLoad(() => {
2596
- console.log("\u63D2\u5C4F \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2597
- YCSDK.ins.onLoad("Inters" /* Inters */);
2598
- YCSDK.ins.onShow("Inters" /* Inters */);
2599
- });
2600
- interstitialAd.onError((err) => {
2601
- console.log("\u63D2\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err);
2602
- YCSDK.ins.onError("Inters" /* Inters */);
2603
- });
2604
- interstitialAd.onClose((res) => {
2605
- console.log("\u63D2\u5C4F \u5E7F\u544A\u5173\u95ED");
2606
- YCSDK.ins.onClose("Inters" /* Inters */);
2607
- });
2608
- interstitialAd.show().catch((err) => {
2609
- console.error("\u63D2\u5C4F\u5E7F\u544A\u5C55\u793A\u5931\u8D25\uFF1A", err);
2610
- YCSDK.ins.onError("Inters" /* Inters */);
2611
- });
2612
- }
2613
- hideInters(type) {
2614
- }
2615
- showVideo(callBack) {
2616
- let rewardedVideoAd = this.wx.createRewardedVideoAd({ adUnitId: sdkconfig.ycVideoId });
2617
- rewardedVideoAd.onLoad(() => {
2618
- console.log("\u6FC0\u52B1\u89C6\u9891 \u5E7F\u544A\u52A0\u8F7D\u6210\u529F");
2619
- YCSDK.ins.onLoad("Video" /* Video */);
2620
- });
2621
- rewardedVideoAd.onError((err) => {
2622
- console.log("\u6FC0\u52B1\u89C6\u9891 \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err);
2623
- YCSDK.ins.onError("Video" /* Video */, callBack);
2624
- });
2625
- rewardedVideoAd.onClose((res) => {
2626
- YCSDK.ins.onClose("Video" /* Video */);
2627
- if (res && res.isEnded || res === void 0) {
2628
- YCSDK.ins.onReward();
2629
- callBack && callBack(true);
2630
- } else {
2631
- callBack && callBack(false);
2632
- }
2633
- });
2634
- rewardedVideoAd.show().catch((err) => {
2635
- rewardedVideoAd.load().then(() => {
2636
- rewardedVideoAd.show();
2637
- YCSDK.ins.onShow("Video" /* Video */);
2638
- });
2639
- });
2640
- return false;
2641
- }
2642
- customFunc(methodName, params, callBack) {
2643
- const { screenWidth, screenHeight } = this.wx.getSystemInfoSync();
2644
- let CustomAd = this.wx.createCustomAd({
2645
- adUnitId: sdkconfig.ycBigPicId,
2646
- style: {
2647
- left: 0,
2648
- top: (screenHeight - screenWidth) / 2,
2649
- width: screenWidth
2650
- }
2651
- });
2652
- CustomAd.onResize((res) => {
2653
- console.log("on resize:", res);
2654
- CustomAd.style.top = screenHeight - res.height;
2655
- CustomAd.style.left = (screenWidth - res.width) / 2;
2656
- });
2657
- CustomAd.onError((err) => {
2658
- console.error("\u77E9\u9635\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25\uFF1A", err.errMsg);
2659
- });
2660
- CustomAd.show();
2661
- }
2662
- };
2663
-
2664
- // assets/script/ycsdk/minigame/MiniGame.ts
2665
- var MiniGame = class {
2666
- constructor(platform) {
2667
- this.privacyKey = "PRIVACY";
2668
- this.channelFactory(platform);
2669
- }
2670
- channelFactory(platform) {
2671
- console.log("switch platform:", platform);
2672
- switch (platform) {
2673
- case sys6.Platform.HUAWEI_QUICK_GAME:
2674
- this.channel = new HuaWeiGame();
2675
- break;
2676
- case sys6.Platform.XIAOMI_QUICK_GAME:
2677
- this.channel = new XiaoMiGame();
2678
- break;
2679
- case sys6.Platform.OPPO_MINI_GAME:
2680
- this.channel = new OppoGame();
2681
- break;
2682
- case sys6.Platform.VIVO_MINI_GAME:
2683
- this.channel = new VivoGame();
2684
- break;
2685
- case sys6.Platform.BYTEDANCE_MINI_GAME:
2686
- this.channel = new DouYinGame();
2687
- break;
2688
- case sys6.Platform.WECHAT_GAME:
2689
- this.channel = new WeChatGame();
2690
- break;
2691
- default:
2692
- break;
2693
- }
2694
- }
2695
- jsonToKeyValue(json) {
2696
- return Object.entries(json).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
2697
- }
2698
- init(callBack, adconfig, config) {
2699
- if (!adconfig) adconfig = { switch: false, count: 0, delay: 0 };
2700
- if (!config) config = { switch: false, type: 0, loop: 0 };
2701
- if (!YCSDK.ins.isRun(sys6.Platform.OPPO_MINI_GAME)) {
2702
- this.setAdStateListener();
2703
- this.channel.init(callBack, adconfig, config);
2704
- return;
2705
- }
2706
- const url = "https://iaa.rhino-times.com/api/game/query-match-config";
2707
- const data = { pkgName: sdkconfig.pkgName, version: sdkconfig.version };
2708
- const sign = Md5.hashStr(this.jsonToKeyValue(data));
2709
- data["sign"] = sign;
2710
- HttpRequest.get().requestPostjson(url, data, (success, result) => {
2711
- if (!success || !result) {
2712
- this.setAdStateListener();
2713
- this.channel.init(callBack, adconfig, config);
2714
- return;
2715
- }
2716
- const res = result.oexts;
2717
- sdkconfig.open = result.open;
2718
- sdkconfig.ratio = res.ratio;
2719
- sdkconfig.subornUserTest = res.subornUserTest;
2720
- if (res.subornVideoConfig) {
2721
- adconfig = res.subornVideoConfig;
2722
- }
2723
- if (res.subornNativeConfig) {
2724
- config = res.subornNativeConfig;
2725
- }
2726
- this.setAdStateListener();
2727
- this.channel.init(callBack, adconfig, config);
2728
- });
2729
- }
2730
- setAdStateListener() {
2731
- const st = new AdTactics();
2732
- st.refreshAll();
2733
- YCSDK.ins.setAdStateListener(st);
2734
- }
2735
- showPolicy(node, callBack) {
2736
- let agree = StorageUtils.getStringData(this.privacyKey);
2737
- console.log(agree);
2738
- if (agree == "agree") {
2739
- console.log("user agree privacy, not show");
2740
- callBack.userAgree && callBack.userAgree();
2741
- return;
2742
- }
2743
- if (!node) {
2744
- console.log("node is null");
2745
- callBack.nodeError && callBack.nodeError();
2746
- return;
2747
- }
2748
- resources4.load("Privacy/policyUI", Prefab4, (err, prefab) => {
2749
- if (err) {
2750
- console.error("\u52A0\u8F7D\u9690\u79C1\u653F\u7B56Prefab\u5931\u8D25:", err);
2751
- return;
2752
- }
2753
- const yinsiUI = instantiate4(prefab);
2754
- const content = yinsiUI.getChildByName("panel").getChildByName("content");
2755
- if (!content.getComponent(PrivacyEvent)) {
2756
- content.addComponent(PrivacyEvent);
2757
- }
2758
- const agree2 = yinsiUI.getChildByName("panel").getChildByName("agree");
2759
- agree2.on(Node4.EventType.TOUCH_END, () => {
2760
- callBack.onAgree && callBack.onAgree();
2761
- StorageUtils.setStringData(this.privacyKey, "agree");
2762
- yinsiUI.active = false;
2763
- }, this);
2764
- const disagree = yinsiUI.getChildByName("panel").getChildByName("disagree");
2765
- disagree.on(Node4.EventType.TOUCH_END, () => {
2766
- callBack.onDisAgree && callBack.onDisAgree();
2767
- yinsiUI.getChildByName("panel").getChildByName("tip").active = true;
2768
- }, this);
2769
- YCSDK.ins.getGameNode().addChild(yinsiUI);
2770
- });
2771
- }
2772
- login(callBack) {
2773
- this.channel.login(callBack);
2774
- }
2775
- pay(params, callBack) {
2776
- this.channel.pay(params, callBack);
2777
- }
2778
- showBanner(position) {
2779
- if (!sdkconfig.open) {
2780
- console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2781
- return;
2782
- }
2783
- this.channel.showBanner(position);
2784
- }
2785
- hideBanner() {
2786
- this.channel.hideBanner();
2787
- }
2788
- showInters(type) {
2789
- if (!sdkconfig.open) {
2790
- console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2791
- return;
2792
- }
2793
- this.channel.showInters(type);
2794
- }
2795
- hideInters(type = "Native" /* Native */) {
2796
- this.channel.hideInters(type);
2797
- }
2798
- showVideo(callBack) {
2799
- if (!sdkconfig.open) {
2800
- console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2801
- callBack && callBack(true);
2802
- return false;
2803
- }
2804
- return this.channel.showVideo(callBack);
2805
- }
2806
- customFunc(methodName, params, callBack) {
2807
- if (!sdkconfig.open) {
2808
- console.log("\u5E7F\u544A\u672A\u5F00\u542F");
2809
- return;
2810
- }
2811
- this.channel.customFunc(methodName, params, callBack);
2812
- }
553
+ // assets/script/ycsdk/SDKConfig.ts
554
+ var sdkconfig = {
555
+ open: true,
556
+ subornUser: false,
557
+ subornUserTest: false,
558
+ version: "1536",
559
+ pkgName: "",
560
+ appId: "",
561
+ bannerId: [],
562
+ intersId: [],
563
+ videoId: [],
564
+ nativeId: [],
565
+ nativeBannerId: [],
566
+ extension: [],
567
+ ratio: {
568
+ inters: 50,
569
+ native: 50,
570
+ video: 0
571
+ },
572
+ ycBannerId: "",
573
+ ycNativeId: "",
574
+ ycVideoId: "",
575
+ ycIntersId: "",
576
+ ycBigPicId: "",
577
+ ycNativeBannerId: "",
578
+ customFunc: {}
2813
579
  };
2814
580
 
2815
581
  // assets/script/ycsdk/nativegame/anroid/AndroidGame.ts
@@ -2993,11 +759,48 @@ var HarmonyGame = class {
2993
759
  }
2994
760
  };
2995
761
 
762
+ // assets/script/ycsdk/nativegame/ios/IOSGame.ts
763
+ var IOSGame = class {
764
+ init(callBack, adconfig, config) {
765
+ }
766
+ showPolicy(node, callBack) {
767
+ }
768
+ login(callBack) {
769
+ }
770
+ pay(params, callBack) {
771
+ }
772
+ showBanner(position) {
773
+ }
774
+ hideBanner() {
775
+ }
776
+ showInters(type) {
777
+ jsb.bridge.sendToNative("showInters");
778
+ }
779
+ hideInters(type) {
780
+ }
781
+ showVideo(callBack) {
782
+ jsb.bridge.onNative = (arg0, arg1) => {
783
+ if (arg0 == "close") {
784
+ if (arg1 == "finished") {
785
+ callBack(true);
786
+ } else {
787
+ callBack(false);
788
+ }
789
+ }
790
+ return;
791
+ };
792
+ jsb.bridge.sendToNative("showVideo");
793
+ return true;
794
+ }
795
+ customFunc(methodName, params, callBack) {
796
+ }
797
+ };
798
+
2996
799
  // assets/script/ycsdk/YCSDK.ts
2997
800
  var YCSDK = class _YCSDK {
2998
801
  constructor() {
2999
802
  this.states = [];
3000
- this.suportPlatfrom = [sys7.Platform.HUAWEI_QUICK_GAME, sys7.Platform.XIAOMI_QUICK_GAME, sys7.Platform.OPPO_MINI_GAME, sys7.Platform.VIVO_MINI_GAME, sys7.Platform.BYTEDANCE_MINI_GAME, sys7.Platform.WECHAT_GAME];
803
+ this.suportPlatfrom = [sys3.Platform.HUAWEI_QUICK_GAME, sys3.Platform.XIAOMI_QUICK_GAME, sys3.Platform.OPPO_MINI_GAME, sys3.Platform.VIVO_MINI_GAME, sys3.Platform.BYTEDANCE_MINI_GAME, sys3.Platform.WECHAT_GAME];
3001
804
  this.privacyKey = "PRIVACY";
3002
805
  this.createPlatform();
3003
806
  }
@@ -3008,19 +811,21 @@ var YCSDK = class _YCSDK {
3008
811
  return _YCSDK.instance;
3009
812
  }
3010
813
  createPlatform() {
3011
- let platform = sys7.platform;
814
+ let platform = sys3.platform;
3012
815
  console.log("current platform:", platform);
3013
- if (platform == sys7.Platform.ANDROID) {
816
+ if (platform == sys3.Platform.ANDROID) {
3014
817
  this.platform = new AndroidGame();
3015
818
  return;
3016
819
  }
3017
- if (platform == sys7.Platform.OPENHARMONY) {
820
+ if (platform == sys3.Platform.OPENHARMONY) {
3018
821
  this.platform = new HarmonyGame();
3019
822
  return;
3020
823
  }
3021
- if (this.isSupportMiniGame(platform)) {
3022
- this.platform = new MiniGame(platform);
3023
- return;
824
+ if (platform == sys3.Platform.MACOS || sys3.Platform.IOS) {
825
+ if (this.isSupportMiniGame(platform)) {
826
+ this.platform = new IOSGame();
827
+ return;
828
+ }
3024
829
  }
3025
830
  console.log("ycsdk\u6682\u4E0D\u652F\u6301\u8BE5\u5C0F\u6E38\u620F\u5E73\u53F0,\u4EE5\u8C03\u8BD5\u6A21\u5F0F\u8FD0\u884C");
3026
831
  this.platform = new DebugGame();
@@ -3029,7 +834,7 @@ var YCSDK = class _YCSDK {
3029
834
  return this.suportPlatfrom.includes(platform);
3030
835
  }
3031
836
  isRun(platform) {
3032
- return sys7.platform == platform;
837
+ return sys3.platform == platform;
3033
838
  }
3034
839
  init(config, callBack, adconfig, cf) {
3035
840
  console.log("ycsdk init");
@@ -3049,7 +854,7 @@ var YCSDK = class _YCSDK {
3049
854
  this.platform.init(callBack, adconfig, cf);
3050
855
  }
3051
856
  agreePrivacy() {
3052
- if (this.isRun(sys7.Platform.ANDROID) || this.isRun(sys7.Platform.OPENHARMONY)) {
857
+ if (this.isRun(sys3.Platform.ANDROID) || this.isRun(sys3.Platform.OPENHARMONY)) {
3053
858
  return true;
3054
859
  }
3055
860
  return StorageUtils.getStringData(this.privacyKey) == "agree";
@@ -3103,7 +908,7 @@ var YCSDK = class _YCSDK {
3103
908
  this.states.push(state);
3104
909
  }
3105
910
  vertical() {
3106
- let winSize = view3.getDesignResolutionSize();
911
+ let winSize = view.getDesignResolutionSize();
3107
912
  console.log("vertical:", winSize.height > winSize.width);
3108
913
  return winSize.height > winSize.width;
3109
914
  }
@@ -3162,6 +967,117 @@ var YCSDK = class _YCSDK {
3162
967
  });
3163
968
  }
3164
969
  };
970
+
971
+ // assets/script/ycsdk/minigame/HttpRequest.ts
972
+ var HttpRequest = class _HttpRequest {
973
+ static {
974
+ this.AUTHORIZATION = "Authorization";
975
+ }
976
+ static {
977
+ this.CONTENT_TYPE = "Content-Type";
978
+ }
979
+ static {
980
+ this.Accept = "Accept";
981
+ }
982
+ static get() {
983
+ if (!_HttpRequest.instance) {
984
+ _HttpRequest.instance = new _HttpRequest();
985
+ }
986
+ return _HttpRequest.instance;
987
+ }
988
+ requestPostx3w(url, data, callback, head) {
989
+ console.log("HttpRequest url:", url);
990
+ console.log("HttpRequest data:", JSON.stringify(data));
991
+ this.httpRequest = new XMLHttpRequest();
992
+ this.httpRequest.onreadystatechange = function() {
993
+ console.log("HttpRequest", "onreadystatechange:", this.readyState, this.status);
994
+ if (this.readyState == 4 && this.status == 200) {
995
+ let res = JSON.parse(this.responseText);
996
+ console.log("HttpRequest", "response:", JSON.stringify(res));
997
+ if (res.status == 200) {
998
+ callback(true, res.data);
999
+ } else {
1000
+ callback(false, res);
1001
+ }
1002
+ }
1003
+ };
1004
+ this.httpRequest.timeout = 5e3;
1005
+ this.httpRequest.ontimeout = () => {
1006
+ console.log("HttpRequest:", "request time out", url);
1007
+ callback(false);
1008
+ };
1009
+ this.httpRequest.onerror = function(e) {
1010
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1011
+ callback(false);
1012
+ };
1013
+ this.httpRequest.open("POST", url, true);
1014
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1015
+ if (head) {
1016
+ this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1017
+ }
1018
+ this.httpRequest.send(data);
1019
+ }
1020
+ requestGetx3w(url, data, callback, head) {
1021
+ console.log("HttpRequest url:", url);
1022
+ console.log("HttpRequest data:", JSON.stringify(data));
1023
+ this.httpRequest = new XMLHttpRequest();
1024
+ this.httpRequest.onreadystatechange = function() {
1025
+ if (this.readyState == 4 && this.status == 200) {
1026
+ let response = this.responseText.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2');
1027
+ let res = JSON.parse(response);
1028
+ console.log("HttpRequest", "response:", JSON.stringify(res));
1029
+ if (res.status == 200) {
1030
+ callback(true, res.data);
1031
+ } else {
1032
+ callback(false, res);
1033
+ }
1034
+ }
1035
+ };
1036
+ this.httpRequest.timeout = 5e3;
1037
+ this.httpRequest.ontimeout = () => {
1038
+ console.log("HttpRequest:", "request time out", url);
1039
+ callback(false);
1040
+ };
1041
+ this.httpRequest.onerror = function(e) {
1042
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1043
+ callback(false);
1044
+ };
1045
+ this.httpRequest.open("GET", url, true);
1046
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/x-www-form-urlencoded" /* APPLICATION_X_WWW_FORM_URLENCODED */);
1047
+ if (head) {
1048
+ this.httpRequest.setRequestHeader(_HttpRequest.AUTHORIZATION, head);
1049
+ }
1050
+ this.httpRequest.send(data);
1051
+ }
1052
+ requestPostjson(url, data, callback, head) {
1053
+ console.log("HttpRequest url:", url);
1054
+ this.httpRequest = new XMLHttpRequest();
1055
+ this.httpRequest.onreadystatechange = function() {
1056
+ if (this.readyState == 4 && this.status == 200) {
1057
+ let res = JSON.parse(this.responseText);
1058
+ console.log("HttpRequest", "response:", JSON.stringify(res));
1059
+ if (res.code == 0) {
1060
+ callback(true, res.data.config);
1061
+ } else {
1062
+ callback(false, res);
1063
+ }
1064
+ }
1065
+ };
1066
+ this.httpRequest.timeout = 3e3;
1067
+ this.httpRequest.ontimeout = () => {
1068
+ console.log("HttpRequest:", "request time out", url);
1069
+ callback(false);
1070
+ };
1071
+ this.httpRequest.onerror = function(e) {
1072
+ console.log("HttpRequest", url, " request error", JSON.stringify(e));
1073
+ callback(false);
1074
+ };
1075
+ this.httpRequest.open("POST", url, true);
1076
+ this.httpRequest.setRequestHeader(_HttpRequest.Accept, "application/json" /* APPLICATION_JSON */);
1077
+ this.httpRequest.setRequestHeader(_HttpRequest.CONTENT_TYPE, "application/json" /* APPLICATION_JSON */);
1078
+ this.httpRequest.send(JSON.stringify(data));
1079
+ }
1080
+ };
3165
1081
  export {
3166
1082
  AdType,
3167
1083
  BannerType,