heygame.ad.config.js
7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
let runningEnv = (typeof window !== 'undefined' ? window : globalThis)
runningEnv.HeyGameConfig = (function (exports) {
'use strict';
class AdConfig {
constructor() {
this.appName = "CakeMaker";
this.debugMode = true;
this.appId = "";//平台获取的appid
this.heyAppId = 3738; //heygame的appid //todo
this.heyPlatId = 1044; //heygame平台id
this.heySecret = "4a1aeef6a2dc7a7cd88cae3edec47222"; // heygame平台秘钥 //todo
this.versionName = "1.0.0";
this.resVersion = "1.0.0";
this.bannerAdUnitId = [""];
this.interstitialAdUnitId = "";
this.videoAdUnitId = "";
this.nativeAdUnitId = [""];
this.customInsertAdUnitId = [""];//VIVO 原生模板插屏样式 使用纯图ID
this.customBannerAdUnitId = [""];//VIVO原生模板banner,左图右文/左文右图ID
this.drawerGameAdUnitId = "";
this.drawerGameAdTop = 900;
this.bannerGameAdUnitId = "";
this.appBoxUnitId = [""];
this.blockAdUnitId = [""];
this.shareConfig = {};
}
}
class WXAdConfig extends AdConfig {
constructor() {
super();
this.versionName = "1.0.0";
this.bannerAdUnitId = ['261277'];
this.videoAdUnitId = '261289';
}
}
class OPPOAdConfig extends AdConfig {
constructor() {
super();
this.versionName = "1.0.0";
this.heyPlatId = 1011; //heygame平台id
this.bannerAdUnitId = ['531409'];
this.videoAdUnitId = '531415';
this.nativeAdUnitId = ['531414', '531413', '531412', '531411'];
this.drawerGameAdUnitId = '531416';
this.bannerGameAdUnitId = '531417';
}
}
class VIVOAdConfig extends AdConfig {
constructor() {
super();
this.versionName = "1.0.0";
this.heyPlatId = 1026; //heygame平台id
this.bannerAdUnitId = ['9a15a75b1ea445d0a630098be76c22b7'];
this.videoAdUnitId = 'b65c5360ac6244d0ba45f9d0d6f079ee';
this.interstitialAdUnitId = "81550133505b4b989627720a33be5800";
this.nativeAdUnitId = [];
this.customInsertAdUnitId = ["1d9546c3436c49d3b46a9a94300c2dac", "01f6eef7c9ba4045b44444b82ad43d5c", "d055e512a7604e4f83642b858c4988b5"];
this.customBannerAdUnitId = ["0abd76fd68e04b84bffa8dae75534266", 'dd41d7c0063547f88528d430a8063a27'];
this.drawerGameAdUnitId = "4e313a63c33b43379f402cb0038f81bd";
this.bannerGameAdUnitId = "a7b0c17f21dc486792650226d94bc616";
}
}
class TTAdConfig extends AdConfig {
constructor() {
super();
this.shareConfig = { TEMPLATE_ID: "", title: "", desc: "" };
}
}
class QQAdConfig extends AdConfig {
constructor() {
super();
}
}
class MEIZUAdConfig extends AdConfig {
constructor() {
super();
this.heyPlatId = 1058;
this.versionName = '1.0.0';
this.bannerAdUnitId = ['c6W2GnpT'];
this.videoAdUnitId = 'jAqL64tf';
this.nativeAdUnitId = ['wtbvbsOl'];
this.interstitialAdUnitId = '1EntritE';
}
}
class PCAdConfig extends AdConfig {
constructor() {
super();
this.versionName = "1.0.0";
this.bannerAdUnitId = ['289406'];
this.videoAdUnitId = '289414';
this.nativeAdUnitId = ['289409', '289410'];
this.drawerGameAdUnitId = '289411';
this.bannerGameAdUnitId = '289403';
}
}
class HeyGameSDKConfig {
constructor() {
this._instance = null;
this._config = null;
this.initPlatforms();
this.initSDKConfig();
console.log('HeyGameSDKConfig constructor');
}
static get instance() {
if (!HeyGameSDKConfig._instance) {
HeyGameSDKConfig._instance = new HeyGameSDKConfig();
}
return HeyGameSDKConfig._instance;
}
static get AdConfig() {
if (!HeyGameSDKConfig.instance._config) {
HeyGameSDKConfig.instance._config = new AdConfig();
}
return HeyGameSDKConfig.instance._config;
}
init() {
}
initSDKConfig() {
if (HeyGameSDKConfig.onWXMiniGame) {
this._config = new WXAdConfig();
} else if (HeyGameSDKConfig.onOPPOMiniGame) {
this._config = new OPPOAdConfig();
} else if (HeyGameSDKConfig.onVIVOMiniGame) {
this._config = new VIVOAdConfig();
} else if (HeyGameSDKConfig.onTTMiniGame) {
this._config = new TTAdConfig();
} else if (HeyGameSDKConfig.onQQMiniGame) {
this._config = new QQAdConfig();
} else if (HeyGameSDKConfig.onMEIZUMiniGame) {
this._config = new MEIZUAdConfig();
} else if (HeyGameSDKConfig.onHWMiniGame) {
console.error('HeyGameSDKConfig.onHWMiniGame error');
} else {
this._config = new PCAdConfig();
}
}
initPlatforms() {
let u = window.navigator.userAgent;
console.log('initPlatforms--' + JSON.stringify(u));
HeyGameSDKConfig.onPC = true;
// OPPO mini game
if (typeof window.qg !== "undefined" && window.qg.getProvider().toLowerCase().indexOf("oppo") > -1) {
HeyGameSDKConfig.onOPPOMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// VIVO mini game
if (typeof window.qg !== "undefined" && window.qg.getProvider().toLowerCase().indexOf("vivo") > -1) {
HeyGameSDKConfig.onVIVOMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// QQ mini game
if (typeof window.qq !== "undefined") {
HeyGameSDKConfig.onQQMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// tt mini game
if (typeof window.tt !== "undefined") {
HeyGameSDKConfig.onTTMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// meizu mini game
if (typeof window.mz !== "undefined" && window.qg.getProvider().toLowerCase().indexOf("meizu") > -1) {
HeyGameSDKConfig.onMEIZUMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// WeiXin mini game
if (typeof window.wx !== "undefined") {
HeyGameSDKConfig.onWXMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// HuaWei mini game
if (typeof window.hbs !== "undefined") {
HeyGameSDKConfig.onHWMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
// 4399 mini game
if (typeof window.gamebox !== "undefined") {
HeyGameSDKConfig.onSSJJMiniGame = true;
HeyGameSDKConfig.onPC = false;
return;
}
//Android
if (typeof jsb !== "undefined" || typeof window.conch !== "undefined" || window["DBApp"] != null) {
HeyGameSDKConfig.onAndroidAPK = true;
HeyGameSDKConfig.onPC = false;
}
}
}
exports.HeyGameSDKConfig = HeyGameSDKConfig;
return exports;
}({}));