AdManager.ts 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. import AdAgent from "./AdAgent";
  2. import PlatUtils from "./PlatUtils";
  3. import AdAgentNative from "./AdAgentNative";
  4. import AdAgentWechat from "./AdAgentWechat";
  5. import AdAgentOPPO from "./AdAgentOPPO";
  6. import AdAgentVIVO from "./AdAgentVIVO";
  7. import AdAgentBaidu from "./AdAgentBaidu";
  8. import AdAgentDouyin from "./AdAgentDouyin";
  9. import { BannerLocation, LevelStatus, BeForGameOverAdId, SubLocation } from "./YZ_Constant";
  10. import AdAgentQQ from "./AdAgentQQ";
  11. import AdAgentQTT from "./AdAgentQTT";
  12. import { utils } from "./Utils";
  13. import YZ_NativeItem from "./YZ_NativeItem";
  14. import AdAgentXiaoMi from "./AdAgentXiaomi";
  15. import AdAgent4399 from "./AdAgent4399";
  16. import AdAgentIOS from "./AdAgentIOS";
  17. import AdAgentCocosplay from "./AdAgentCocosplay";
  18. import AdAgentUC from "./AdAgentUC";
  19. import AdAgentBili from "./AdAgentBili";
  20. import NativeTryGamesWidget from "./NativeTryGamesWidget";
  21. import AdAgentKwai from "./AdAgentKwai";
  22. import AdAgentBroser from "./AdAgentBroser";
  23. import MoreGamesPanel from "./MoreGamesPanel";
  24. import BeforGameOverRecGamesPanel from "./BeforGameOverRecGamesPanel";
  25. import AdAgentWiFi from "./AdAgentWiFi";
  26. import AdAgentHago from "./AdAgentHago";
  27. import AdAgentHuaWei from "./AdAgentHuaWei";
  28. import AdAgentFaceBook from "./AdAgentFaceBook";
  29. import { CustomAdInfo } from "./CommonConfig";
  30. import YzCustomAdPanel from "./YzCustomAdPanel";
  31. import AdAgentGoogleWeb from "./AdAgentGoogleWeb";
  32. const { ccclass, property } = cc._decorator;
  33. @ccclass
  34. export default class AdManager {
  35. private _curAdAgent: AdAgent = null;
  36. public videoCallBack: Function = null;
  37. public Init() {
  38. if (PlatUtils.IsNativeAndroid) {
  39. this._curAdAgent = new AdAgentNative();
  40. this._curAdAgent.Init();
  41. } else if (PlatUtils.IsWechat) {
  42. this._curAdAgent = new AdAgentWechat();
  43. this._curAdAgent.Init();
  44. } else if (PlatUtils.IsOPPO) {
  45. this._curAdAgent = new AdAgentOPPO();
  46. this._curAdAgent.Init();
  47. } else if (PlatUtils.IsVIVO) {
  48. this._curAdAgent = new AdAgentVIVO();
  49. this._curAdAgent.Init();
  50. } else if (PlatUtils.IsBaidu) {
  51. this._curAdAgent = new AdAgentBaidu();
  52. this._curAdAgent.Init();
  53. } else if (PlatUtils.IsDouyin) {
  54. this._curAdAgent = new AdAgentDouyin();
  55. this._curAdAgent.Init();
  56. } else if (PlatUtils.IsQQ) {
  57. this._curAdAgent = new AdAgentQQ();
  58. this._curAdAgent.Init();
  59. } else if (PlatUtils.IsQTT) {
  60. this._curAdAgent = new AdAgentQTT();
  61. this._curAdAgent.Init();
  62. } else if (PlatUtils.IsXiaoMi) {
  63. this._curAdAgent = new AdAgentXiaoMi();
  64. this._curAdAgent.Init();
  65. } else if (PlatUtils.ISUC) {
  66. this._curAdAgent = new AdAgentUC();
  67. this._curAdAgent.Init();
  68. } else if (PlatUtils.ISCocos) {
  69. this._curAdAgent = new AdAgentCocosplay();
  70. this._curAdAgent.Init();
  71. } else if (PlatUtils.Is4399) {
  72. this._curAdAgent = new AdAgent4399();
  73. this._curAdAgent.Init();
  74. } else if (PlatUtils.IsNativeIOS) {
  75. this._curAdAgent = new AdAgentIOS();
  76. this._curAdAgent.Init();
  77. } else if (PlatUtils.IsBili) {
  78. this._curAdAgent = new AdAgentBili();
  79. this._curAdAgent.Init();
  80. } else if (PlatUtils.IsKwai) {
  81. this._curAdAgent = new AdAgentKwai();
  82. this._curAdAgent.Init();
  83. } else if (PlatUtils.IsWiFi) {
  84. this._curAdAgent = new AdAgentWiFi();
  85. this._curAdAgent.Init();
  86. } else if (PlatUtils.IsHago) {
  87. this._curAdAgent = new AdAgentHago();
  88. this._curAdAgent.Init();
  89. } else if (PlatUtils.IsHuaWei) {
  90. this._curAdAgent = new AdAgentHuaWei();
  91. this._curAdAgent.Init();
  92. } else if (PlatUtils.IsFaceBook) {
  93. this._curAdAgent = new AdAgentFaceBook();
  94. this._curAdAgent.Init();
  95. } else if (PlatUtils.IsTest) {
  96. this._curAdAgent = new AdAgentBroser();
  97. this._curAdAgent.Init();
  98. } else if (PlatUtils.IsGoogleWeb) {
  99. this._curAdAgent = new AdAgentGoogleWeb();
  100. this._curAdAgent.Init();
  101. }
  102. }
  103. public OnUpdate(dt: number) { }
  104. /**
  105. * 显示浮窗广告挂件
  106. * @param params
  107. * ```
  108. * {
  109. * group:string
  110. * left:number
  111. * bottom:number
  112. * scale:number
  113. * parent:cc.Node
  114. * }
  115. * ```
  116. * @returns 生成的组件
  117. */
  118. public showNativeTryGameWidget(params: any = null) {
  119. if (!this.checkShowAdTime()) {
  120. utils.showLog("显示插屏时间未达限制!");
  121. return;
  122. }
  123. if (this._curAdAgent) {
  124. if (!utils.isShowNativeTryGamesWidget() || PlatUtils.IsHuaWei) {
  125. utils.showLog("不能显示原生抖动试玩")
  126. return;
  127. }
  128. this._curAdAgent.showNativeTryGameWidget(params);
  129. }
  130. }
  131. /**
  132. * 隐藏浮动试玩挂件
  133. */
  134. public hideNativeTryGameWidget() {
  135. if (this._curAdAgent) {
  136. this._curAdAgent.hideNativeTryGameWidget();
  137. }
  138. }
  139. /**
  140. * 展示开屏广告,当前只有华为平台生效
  141. */
  142. public showNativeSplashView(callBack: Function = null) {
  143. if (PlatUtils.IsHuaWei) {
  144. if (this._curAdAgent) {
  145. this._curAdAgent.showNativeSplashView(callBack);
  146. }
  147. else {
  148. if (callBack) {
  149. callBack();
  150. }
  151. }
  152. }
  153. else {
  154. if (callBack) {
  155. callBack();
  156. }
  157. }
  158. }
  159. /**
  160. * 显示广告条
  161. * @param location 位置
  162. * @param args 参数,控制广告条的宽度和位置,此参数只对微信平台有效,默认居中贴底显示.
  163. * {
  164. * width: 广告条宽度,屏幕的百分比,取值范围0-1;
  165. * bottom: 广告条距离屏幕底部的高度,单位是像素;
  166. * }
  167. */
  168. public ShowBanner(location: any = BannerLocation.Home, args: any = null) {
  169. if (!this.checkShowAdTime()) {
  170. utils.showLog("显示广告条时间未达限制!");
  171. return;
  172. }
  173. if (this._curAdAgent) {
  174. this._curAdAgent.ShowBanner(location, args);
  175. }
  176. }
  177. public HideBanner(location: BannerLocation) {
  178. if (this._curAdAgent) {
  179. this._curAdAgent.HideBanner(location);
  180. }
  181. }
  182. public ShowInterstitial(localtion: BannerLocation = BannerLocation.Home) {
  183. if (!this.checkShowAdTime()) {
  184. utils.showLog("显示插屏时间未达限制!");
  185. return;
  186. }
  187. if (!this.checkInsertAdTime()) {
  188. utils.showLog("显示插屏时间未达到间隔时间!");
  189. return;
  190. }
  191. if (this._curAdAgent) {
  192. this._curAdAgent.ShowInterstitial(localtion);
  193. }
  194. }
  195. /**
  196. * 播放视频广告
  197. * @param callback Function(ret:boolean,msg:string)
  198. * ret 看完视频返回true, 否则返回false
  199. * msg 播放失败的消息提示
  200. */
  201. public ShowVideo(callback: Function) {
  202. if (this._curAdAgent) {
  203. this.videoCallBack = callback;
  204. this._curAdAgent.ShowVideo(callback);
  205. } else {
  206. if (callback) callback(false, "视频加载失败1!");
  207. }
  208. }
  209. /**
  210. * 显示互动直弹广告
  211. * --目前仅支持趣头条平台
  212. */
  213. public showInteractiveAd() {
  214. if (this._curAdAgent) {
  215. this._curAdAgent.showInteractiveAd();
  216. }
  217. }
  218. /**
  219. * 显示QQ游戏盒子广告
  220. */
  221. public ShowAppBox(isMoreGame?: boolean) {
  222. if (this._curAdAgent) {
  223. this._curAdAgent.ShowAppBox(isMoreGame);
  224. }
  225. }
  226. /**
  227. * 隐藏QQ游戏盒子广告
  228. * --目前仅支持QQ平台--
  229. */
  230. public HideAppBox() {
  231. if (this._curAdAgent) {
  232. this._curAdAgent.HideAppBox();
  233. }
  234. }
  235. /**
  236. * 显示激励插屏
  237. */
  238. public showRewardInsert(): void {
  239. if (this._curAdAgent) {
  240. utils.showLog("显示 RI");
  241. this._curAdAgent.showRewardInsert();
  242. }
  243. }
  244. /**
  245. * 隐藏激励插屏
  246. */
  247. public hideRewardInsert(): void {
  248. if (this._curAdAgent) {
  249. this._curAdAgent.hideRewardInsert();
  250. }
  251. }
  252. /**
  253. * 显示关闭按钮的Banner
  254. * @param location
  255. * @param closeBtn
  256. */
  257. public ShowCloseBtnBanner(location: BannerLocation = BannerLocation.Home, args: any) {
  258. if (!this.checkShowAdTime()) {
  259. utils.showLog("显示广告条时间未达限制!");
  260. return;
  261. }
  262. if (this._curAdAgent) {
  263. this._curAdAgent.ShowCloseBtnBanner(location, args);
  264. }
  265. }
  266. /**
  267. * 显示结算窗口的推荐广告
  268. */
  269. public ShowStatementRecomment(): cc.Node {
  270. if (this._curAdAgent) {
  271. if (PlatUtils.IsOPPO || PlatUtils.IsVIVO) {
  272. return this._curAdAgent.ShowStatementRecomment();
  273. } else if (PlatUtils.IsWechat) {
  274. return utils.showCrossWidget6();
  275. }
  276. }
  277. return null;
  278. }
  279. /**
  280. * 获取原生广告数据
  281. */
  282. public getNativeAdData(args?: any): any {
  283. if (this._curAdAgent) {
  284. utils.showLog("adManager 获取原生广告");
  285. return this._curAdAgent.getNativeAdData(args);
  286. }
  287. return null;
  288. }
  289. /**
  290. * 显示结算页面广告
  291. * @param data 参数
  292. * oppo、微信平台结算广告特殊处理
  293. * 趣头条平台结算广告为互动直弹
  294. * vivo、抖音、qq、xiaomi、baidu平台结算界面广告为插屏
  295. */
  296. public showStatementAds(data?: any): any {
  297. let res: any = { "type": -1, "node": null }
  298. if (!this.checkShowAdTime()) {
  299. utils.showLog("显示结算页面广告时间未达限制!");
  300. return res;
  301. }
  302. if (this._curAdAgent) {
  303. if (PlatUtils.IsWechat || PlatUtils.IsBaidu) {
  304. return this._curAdAgent.showStatementAds(data);
  305. }
  306. }
  307. if (PlatUtils.IsQTT) {
  308. utils.adManager.showInteractiveAd();
  309. } else {
  310. utils.adManager.ShowInterstitial();
  311. }
  312. utils.showLog("非oppo和微信平台正常显示结算广告");
  313. return res;
  314. }
  315. public createNativeAd(params: any = null, yzItem?: YZ_NativeItem) {
  316. if (this._curAdAgent) {
  317. this._curAdAgent.createNativeAd(params, yzItem);
  318. }
  319. }
  320. public hideKyxBanner() {
  321. if (this._curAdAgent) {
  322. this._curAdAgent.hideKyxBanner();
  323. }
  324. }
  325. public showBeforGameOverAd(level: number, levelStatus: LevelStatus, rewardValue: number, closeCallFunc: Function, rewardFunc: Function): void {
  326. if (PlatUtils.IsOPPO || PlatUtils.IsVIVO || PlatUtils.IsDouyin || PlatUtils.IsBaidu || PlatUtils.IsWechat || PlatUtils.IsQQ || PlatUtils.IsKwai || PlatUtils.IsNativeAndroid || PlatUtils.IsNativeIOS || utils._tool_Broswer || PlatUtils.IsWiFi || PlatUtils.IsHuaWei) {
  327. if (utils.ServerConfig && utils.ServerConfig.befor_ad_min_level && utils.ServerConfig.befor_ad_min_level >= level) {
  328. utils.showLog(`${level} >>服务器配置结算前广告在${utils.ServerConfig.befor_ad_min_level}关后才能显示!`);
  329. closeCallFunc && closeCallFunc();
  330. return;
  331. }
  332. utils.showLog("显示结算前广告: #Level= ", level, " #LevelStatys=", levelStatus, " #rewardValue = ", rewardValue);
  333. utils.currentLevel = level;
  334. utils.isSuccess = levelStatus == LevelStatus.GameWin;
  335. utils.rewardCallFunc = rewardFunc;
  336. utils.rewardCloseFunc = closeCallFunc;
  337. utils.rewardValue = rewardValue;
  338. // if (PlatUtils.IsNativeAndroid || CC_DEBUG) {
  339. // if (utils.isSuccess) {
  340. // utils.yzRedBagInfo.progress++;
  341. // }
  342. // if (utils.canShowRedBag() && utils.yzRedBagInfo.progress >= utils.yzRedBagInfo.totalProgress) {
  343. // utils.showLog("当前红包进度已满,显示获得红包窗口!");
  344. // utils.showOpenRedBagPanel({ showType: 2 });
  345. // return;
  346. // }
  347. // }
  348. let adType = utils.adManager.checkShowBeforGameOverAd(level, levelStatus == LevelStatus.GameWin);
  349. switch (adType) {
  350. case BeForGameOverAdId.SharePanel:
  351. utils.recordEnd();
  352. utils.showShareRecordPanel();
  353. break;
  354. case BeForGameOverAdId.GoldBox:
  355. utils.adManager.showRewardBoxPanel();
  356. break;
  357. case BeForGameOverAdId.Turntable:
  358. utils.adManager.showrewardTurnTablePanel();
  359. break;
  360. case BeForGameOverAdId.CreateShortCut:
  361. utils.adManager.showRewardShortCutPanel();
  362. break;
  363. case BeForGameOverAdId.RecGame:
  364. utils.adManager.showRecGamePanel();
  365. break
  366. case BeForGameOverAdId.LuckBox:
  367. let show_level = utils.ServerConfig.reward_luck_box_show_level ? utils.ServerConfig.reward_luck_box_show_level : 0;
  368. if (level > show_level) {
  369. utils.adManager.showRewardLuckBoxPanel();
  370. } else {
  371. utils.showLog("幸运宝箱间隔关卡未达到!");
  372. closeCallFunc && closeCallFunc();
  373. utils.rewardCloseFunc = null;
  374. }
  375. break;
  376. default:
  377. closeCallFunc && closeCallFunc();
  378. utils.rewardCloseFunc = null;
  379. break;
  380. }
  381. } else {
  382. closeCallFunc && closeCallFunc();
  383. utils.rewardCloseFunc = null;
  384. }
  385. }
  386. _lastShowGameOverAdType: BeForGameOverAdId = BeForGameOverAdId.None;
  387. //结算前广告类型数组
  388. beforRewardTypes: BeForGameOverAdId[] = [BeForGameOverAdId.SharePanel, BeForGameOverAdId.GoldBox, BeForGameOverAdId.Turntable, BeForGameOverAdId.CreateShortCut, BeForGameOverAdId.RecGame, BeForGameOverAdId.LuckBox];
  389. //结算前广告显示方法
  390. private getRewardCloseAndShowCallFunc(index): Function {
  391. let result: Function = null;
  392. switch (index) {
  393. case 1:
  394. result = utils.adManager.showShareRecordPanel;
  395. break;
  396. case 2:
  397. result = utils.adManager.showRewardBoxPanel
  398. break;
  399. case 3:
  400. result = utils.adManager.showrewardTurnTablePanel
  401. break;
  402. case 4:
  403. result = utils.adManager.showRewardShortCutPanel
  404. break;
  405. case 5:
  406. result = utils.adManager.showRecGamePanel
  407. break;
  408. case 6:
  409. result = utils.adManager.showRewardLuckBoxPanel
  410. break;
  411. }
  412. return result;
  413. }
  414. /**
  415. * befor_game_over_share_interval 分享弹窗间隔 例如:1、2、3、4、5
  416. * befor_game_over_reward_box_interval 宝箱弹窗间隔 例如:1、2、3、4、5
  417. * befor_game_over_turntable_interval 转盘抽奖间隔 例如:1、2、3、4、5
  418. * befor_game_over_shortcut_interval 添加桌面间隔 例如:1、2、3、4、5
  419. *
  420. * befor_game_over_share_type 分享弹窗类型 例如: all、success、fail
  421. * befor_game_over_reward_box_type 宝箱弹窗类型 例如: all、success、fail
  422. * befor_game_over_turntable_type 抽奖弹窗类型 例如: all、success、fail
  423. * befor_game_over_shortcut_type 添加桌面间类型 例如: all、success、fail
  424. *
  425. * befor_game_over_sync_list 同时展示顺序 例如: 123、321、12、21、32
  426. * befor_game_over_sync_interval 同时展示间隔关卡数 例如:1、2、3、4、5
  427. * befor_game_over_sync_type 同时展示类型 例如: all、success、fail
  428. *
  429. * level 当前关卡 isSuccess是否胜利
  430. * @returns result : 1:分享弹窗,2:宝箱弹窗,3:转盘弹窗 4:快捷桌面添加 5:更多游戏列表 6、幸运宝箱
  431. */
  432. public checkShowBeforGameOverAd(level: number, isSuccess: boolean): BeForGameOverAdId {
  433. if (!this._curAdAgent || !utils.ServerConfig) {
  434. utils.showLog("组件初始化失败!");
  435. return BeForGameOverAdId.None;
  436. }
  437. let befor_game_over_reward_share_interval = utils.ServerConfig.befor_game_over_share_interval;
  438. let befor_game_over_reward_box_interval = utils.ServerConfig.befor_game_over_reward_box_interval;
  439. let befor_game_over_turntable_interval = utils.ServerConfig.befor_game_over_turntable_interval;
  440. let befor_game_over_shortcut_interval = utils.ServerConfig.auto_desktop_interval;
  441. let befor_game_over_rec_game_interval = utils.ServerConfig.befor_game_over_rec_game_interval;
  442. let befor_game_over_luck_box_interval = utils.ServerConfig.befor_game_over_luck_box_interval;
  443. let befor_game_over_reward_share_type = utils.ServerConfig.befor_game_over_share_type;
  444. let befor_game_over_reward_box_type = utils.ServerConfig.befor_game_over_reward_box_type;
  445. let befor_game_over_turntable_type = utils.ServerConfig.befor_game_over_turntable_type;
  446. let befor_game_over_rec_game_type = utils.ServerConfig.befor_game_over_rec_game_type;
  447. let befor_game_over_luck_box_type = utils.ServerConfig.befor_game_over_luck_box_type;
  448. let befor_game_over_shortcut_type = utils.ServerConfig.auto_desktop_type;
  449. let befor_game_over_is_sync = utils.ServerConfig.befor_game_over_sync_list;
  450. let befor_game_over_sync_interval = utils.ServerConfig.befor_game_over_sync_interval;
  451. let befor_game_over_sync_type = utils.ServerConfig.befor_game_over_sync_type;
  452. if (PlatUtils.IsTest) {
  453. // befor_game_over_turntable_type = "all";
  454. // befor_game_over_turntable_interval = 2;
  455. // befor_game_over_is_sync = "32";
  456. // befor_game_over_sync_interval = "1";
  457. // befor_game_over_sync_type = "all";
  458. // befor_game_over_rec_game_type = "all";
  459. // befor_game_over_rec_game_interval = 4;
  460. // befor_game_over_luck_box_type = "all";
  461. // befor_game_over_luck_box_interval = 1;
  462. befor_game_over_reward_box_type = "all";
  463. befor_game_over_reward_box_interval = 1;
  464. }
  465. let result = BeForGameOverAdId.None;
  466. let isShow = false;
  467. if (befor_game_over_is_sync) {
  468. utils.showLog("进入同步显示弹窗判断:", befor_game_over_is_sync, "<<interval=", befor_game_over_sync_interval, "<<<type", befor_game_over_sync_type);
  469. switch (befor_game_over_sync_type) {
  470. case "all":
  471. isShow = true;
  472. break;
  473. case "success":
  474. isShow = isSuccess
  475. break;
  476. case "fail":
  477. isShow = !isSuccess
  478. break;
  479. }
  480. if (isShow && befor_game_over_sync_interval && level % befor_game_over_sync_interval == 0) {
  481. let syncTypes: Array<string> = befor_game_over_is_sync.split("");
  482. for (let i = 0; i < syncTypes.length; i++) {
  483. if (i == 0) {
  484. result = this.beforRewardTypes[parseInt(syncTypes[i]) - 1];
  485. }
  486. let closeFunc = null;
  487. if (i == syncTypes.length - 1) {
  488. closeFunc = utils.rewardCloseFunc;
  489. } else {
  490. closeFunc = this.getRewardCloseAndShowCallFunc(parseInt(syncTypes[i + 1]));
  491. }
  492. switch (syncTypes[i]) {
  493. case "1":
  494. utils.shareRecordPanelCloseFunc = closeFunc;
  495. break;
  496. case "2":
  497. utils.rewardBoxPanelCloseFunc = closeFunc;
  498. break;
  499. case "3":
  500. utils.turnTablePanelCloseFunc = closeFunc;
  501. break;
  502. case "4":
  503. utils.rewardShortCutPanelCloseFunc = closeFunc;
  504. break;
  505. case "5":
  506. utils.rewardRecGamePanelCloseFunc = closeFunc;
  507. break;
  508. case "6":
  509. utils.rewardLuckBoxPanelCloseFunc = closeFunc;
  510. break;
  511. }
  512. }
  513. }
  514. } else {
  515. let showCount = 0;
  516. if (befor_game_over_reward_share_type) {
  517. showCount++;
  518. }
  519. if (befor_game_over_reward_box_type) {
  520. showCount++;
  521. }
  522. if (befor_game_over_turntable_type) {
  523. showCount++;
  524. }
  525. if (befor_game_over_shortcut_type) {
  526. showCount++;
  527. }
  528. if (befor_game_over_luck_box_type) {
  529. showCount++;
  530. }
  531. utils.showLog("显示的类型" + showCount + "种,进行顺序切换判断,上一次显示的类型为:" + this._lastShowGameOverAdType)
  532. isShow = true;
  533. if (befor_game_over_reward_share_interval && level % befor_game_over_reward_share_interval == 0) {
  534. utils.showLog("进入显示分享奖励弹窗判断", befor_game_over_reward_share_type, "<<");
  535. if (showCount > 1) {
  536. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.SharePanel;
  537. }
  538. if (isShow) {
  539. switch (befor_game_over_reward_share_type) {
  540. case "all":
  541. utils.showLog(`间隔${befor_game_over_reward_share_interval}关,显示分享奖励弹窗!`);
  542. result = BeForGameOverAdId.SharePanel;
  543. break;
  544. case "success":
  545. if (isSuccess) {
  546. result = BeForGameOverAdId.SharePanel;
  547. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_reward_share_interval}关,显示分享奖励弹窗!`);
  548. }
  549. break;
  550. case "fail":
  551. if (!isSuccess) {
  552. result = BeForGameOverAdId.SharePanel;
  553. utils.showLog(`游戏失败 >> 间隔${befor_game_over_reward_share_interval}关,显示分享奖励弹窗!`);
  554. }
  555. break;
  556. }
  557. }
  558. }
  559. if (result != BeForGameOverAdId.None) {
  560. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  561. this._lastShowGameOverAdType = result;
  562. return result;
  563. }
  564. if (befor_game_over_reward_box_interval && level % befor_game_over_reward_box_interval == 0) {
  565. utils.showLog("进入显示宝箱判断", befor_game_over_reward_box_type, "<<");
  566. if (showCount > 1) {
  567. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.GoldBox;
  568. }
  569. if (isShow) {
  570. switch (befor_game_over_reward_box_type) {
  571. case "all":
  572. result = BeForGameOverAdId.GoldBox;
  573. utils.showLog(`间隔${befor_game_over_reward_box_interval}关,显示宝箱弹窗!`);
  574. break;
  575. case "success":
  576. if (isSuccess) {
  577. result = BeForGameOverAdId.GoldBox;
  578. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_reward_box_interval}关,显示宝箱弹窗!`);
  579. }
  580. break;
  581. case "fail":
  582. if (!isSuccess) {
  583. result = BeForGameOverAdId.GoldBox;
  584. utils.showLog(`游戏失败 >> 间隔${befor_game_over_reward_box_interval}关,显示宝箱弹窗!`);
  585. }
  586. break;
  587. }
  588. }
  589. }
  590. if (result != BeForGameOverAdId.None) {
  591. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  592. this._lastShowGameOverAdType = result;
  593. return result;
  594. }
  595. if (befor_game_over_turntable_interval && level % befor_game_over_turntable_interval == 0) {
  596. utils.showLog("进入显示抽奖弹窗判断", befor_game_over_turntable_type, "<<");
  597. if (showCount > 1) {
  598. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.Turntable;
  599. }
  600. if (isShow) {
  601. switch (befor_game_over_turntable_type) {
  602. case "all":
  603. result = BeForGameOverAdId.Turntable;
  604. utils.showLog(`间隔${befor_game_over_turntable_interval}关,显示抽奖弹窗!`);
  605. break;
  606. case "success":
  607. if (isSuccess) {
  608. result = BeForGameOverAdId.Turntable;
  609. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_turntable_interval}关,显示抽奖弹窗!`);
  610. }
  611. break;
  612. case "fail":
  613. if (!isSuccess) {
  614. result = BeForGameOverAdId.Turntable;
  615. utils.showLog(`游戏失败 >> 间隔${befor_game_over_turntable_interval}关,显示抽奖弹窗!`);
  616. }
  617. break;
  618. }
  619. }
  620. }
  621. if (result != BeForGameOverAdId.None) {
  622. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  623. this._lastShowGameOverAdType = result;
  624. return result;
  625. }
  626. if (befor_game_over_shortcut_interval && level % befor_game_over_shortcut_interval == 0) {
  627. utils.showLog("进入显示添加桌面弹窗判断", befor_game_over_shortcut_type, "<<");
  628. if (showCount > 1) {
  629. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.CreateShortCut;
  630. }
  631. if (isShow) {
  632. switch (befor_game_over_shortcut_type) {
  633. case "all":
  634. result = BeForGameOverAdId.CreateShortCut;
  635. utils.showLog(`间隔${befor_game_over_shortcut_interval}关,显示添加桌面弹窗!`);
  636. break;
  637. case "success":
  638. if (isSuccess) {
  639. result = BeForGameOverAdId.CreateShortCut;
  640. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_shortcut_interval}关,显示添加桌面弹窗!`);
  641. }
  642. break;
  643. case "fail":
  644. if (!isSuccess) {
  645. result = BeForGameOverAdId.CreateShortCut;
  646. utils.showLog(`游戏失败 >> 间隔${befor_game_over_shortcut_interval}关,显示添加桌面弹窗!`);
  647. }
  648. break;
  649. }
  650. }
  651. } else {
  652. utils.showLog("结算前广告验证完成,不显示结算前广告!");
  653. }
  654. if (result != BeForGameOverAdId.None) {
  655. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  656. this._lastShowGameOverAdType = result;
  657. return result;
  658. }
  659. if (befor_game_over_rec_game_interval && level % befor_game_over_rec_game_interval == 0) {
  660. utils.showLog("进入显示游戏推荐弹窗判断", befor_game_over_rec_game_type, "<<");
  661. if (showCount > 1) {
  662. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.RecGame;
  663. }
  664. if (isShow) {
  665. switch (befor_game_over_rec_game_type) {
  666. case "all":
  667. result = BeForGameOverAdId.RecGame;
  668. utils.showLog(`间隔${befor_game_over_rec_game_interval}关,显示游戏推荐弹窗!`);
  669. break;
  670. case "success":
  671. if (isSuccess) {
  672. result = BeForGameOverAdId.RecGame;
  673. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_rec_game_interval}关,显示游戏推荐弹窗!`);
  674. }
  675. break;
  676. case "fail":
  677. if (!isSuccess) {
  678. result = BeForGameOverAdId.RecGame;
  679. utils.showLog(`游戏失败 >> 间隔${befor_game_over_rec_game_interval}关,显示游戏推荐弹窗!`);
  680. }
  681. break;
  682. }
  683. }
  684. } else {
  685. utils.showLog("结算前广告验证完成,不显示更多游戏广告!");
  686. }
  687. if (result != BeForGameOverAdId.None) {
  688. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  689. this._lastShowGameOverAdType = result;
  690. return result;
  691. }
  692. if (befor_game_over_luck_box_interval && level % befor_game_over_luck_box_interval == 0) {
  693. utils.showLog("进入显示幸运宝箱弹窗判断", befor_game_over_luck_box_type, "<<");
  694. if (showCount > 1) {
  695. isShow = this._lastShowGameOverAdType != BeForGameOverAdId.LuckBox;
  696. }
  697. if (isShow) {
  698. switch (befor_game_over_luck_box_type) {
  699. case "all":
  700. result = BeForGameOverAdId.LuckBox;
  701. utils.showLog(`间隔${befor_game_over_luck_box_interval}关,显示游戏推荐弹窗!`);
  702. break;
  703. case "success":
  704. if (isSuccess) {
  705. result = BeForGameOverAdId.LuckBox;
  706. utils.showLog(`游戏胜利 >> 间隔${befor_game_over_luck_box_interval}关,显示游戏推荐弹窗!`);
  707. }
  708. break;
  709. case "fail":
  710. if (!isSuccess) {
  711. result = BeForGameOverAdId.LuckBox;
  712. utils.showLog(`游戏失败 >> 间隔${befor_game_over_luck_box_interval}关,显示游戏推荐弹窗!`);
  713. }
  714. break;
  715. }
  716. }
  717. } else {
  718. utils.showLog("结算前广告验证完成,不显示幸运宝箱弹窗!");
  719. }
  720. }
  721. utils.showLog("结算前广告验证完成,显示结算前广告类型:", result);
  722. this._lastShowGameOverAdType = result;
  723. return result;
  724. }
  725. /**
  726. * 显示录屏分享窗口
  727. * @param params
  728. */
  729. public showShareRecordPanel(params: any = null) {
  730. if (!utils._isConfigInit) {
  731. utils.showLog("warn:" + "组件配置未初始化!");
  732. return null;
  733. }
  734. if (utils.config.otherconfig.shareRecordPanel) {
  735. let node: cc.Node = cc.instantiate(utils.config.otherconfig.shareRecordPanel);
  736. if (node) {
  737. if (utils.shareRecordPanel && cc.isValid(utils.shareRecordPanel)) {
  738. utils.shareRecordPanel.destroy();
  739. }
  740. utils.shareRecordPanel = node;
  741. utils.shareRecordPanel.zIndex = 9999;
  742. let widget: cc.Widget = node.getComponent(cc.Widget);
  743. if (params) {
  744. if (params.group) {
  745. node.group = params.group;
  746. }
  747. if (params.scale != null) {
  748. node.scale = params.scale;
  749. }
  750. if (params.top != null) {
  751. widget.isAlignTop = true;
  752. widget.isAlignBottom = false;
  753. widget.top = params.top;
  754. } else if (params.bottom != null) {
  755. widget.isAlignTop = false;
  756. widget.isAlignBottom = true;
  757. widget.bottom = params.bottom;
  758. }
  759. if (params.left != null) {
  760. widget.isAlignLeft = true;
  761. widget.isAlignRight = false;
  762. widget.left = params.left;
  763. } else if (params.right != null) {
  764. widget.isAlignLeft = false;
  765. widget.isAlignRight = true;
  766. widget.right = params.right;
  767. }
  768. if (params.parent != null) {
  769. node.parent = params.parent;
  770. } else {
  771. cc.director.getScene().addChild(utils.shareRecordPanel, 1000);
  772. }
  773. } else {
  774. cc.director.getScene().addChild(utils.shareRecordPanel, 1000);
  775. }
  776. widget.updateAlignment();
  777. return node;
  778. }
  779. } else {
  780. utils.showLog("未找到预制体 ShareRecordPanel, 请查看CommonUtils组件上是否赋值!");
  781. }
  782. return null;
  783. }
  784. rewardBoxPanel: cc.Node = null;
  785. /**
  786. * 显示宝箱窗口
  787. * @param params
  788. */
  789. public showRewardBoxPanel(): cc.Node {
  790. if (!utils._isConfigInit) {
  791. utils.showLog("warn:" + "组件配置未初始化!");
  792. return null;
  793. }
  794. if (utils.config.otherconfig.rewardBoxPanel) {
  795. let node: cc.Node = cc.instantiate(utils.config.otherconfig.rewardBoxPanel);
  796. if (node) {
  797. if (this.rewardBoxPanel && cc.isValid(this.rewardBoxPanel)) {
  798. this.rewardBoxPanel.destroy();
  799. }
  800. this.rewardBoxPanel = node;
  801. this.rewardBoxPanel.zIndex = 9999;
  802. cc.director.getScene().addChild(node, 1000);
  803. return node;
  804. }
  805. } else {
  806. utils.showLog("未找到预制体 rewardBoxPanel, 请查看CommonUtils组件上是否赋值!");
  807. }
  808. return null;
  809. }
  810. rewardRecGamePanel: cc.Node = null;
  811. /**
  812. * 显示更多游戏推荐窗口
  813. * @param params
  814. */
  815. public showRecGamePanel(): cc.Node {
  816. if (!utils._isConfigInit) {
  817. utils.showLog("warn:" + "组件配置未初始化!");
  818. return null;
  819. }
  820. if (utils.config.otherconfig.beforGameOverRecGamesPanel && utils.getRecommondGameList()) {
  821. let node: cc.Node = cc.instantiate(utils.config.otherconfig.beforGameOverRecGamesPanel);
  822. if (node) {
  823. if (this.rewardRecGamePanel && cc.isValid(this.rewardRecGamePanel)) {
  824. this.rewardRecGamePanel.destroy();
  825. }
  826. this.rewardRecGamePanel = node;
  827. this.rewardRecGamePanel.zIndex = 9999;
  828. cc.director.getScene().addChild(node, 1000);
  829. let recMoreGame: BeforGameOverRecGamesPanel = this.rewardRecGamePanel.getComponent(BeforGameOverRecGamesPanel);
  830. recMoreGame._location = SubLocation.isBeforGameOverAd;
  831. recMoreGame.init(utils.getRecommondGameList());
  832. recMoreGame.show();
  833. return node;
  834. }
  835. } else {
  836. utils.showLog("未找到预制体 moreGamesPanel, 请查看CommonUtils组件上是否赋值!");
  837. }
  838. return null;
  839. }
  840. rewardTurnTablePanel: cc.Node = null;
  841. /**
  842. * 显示转盘抽奖窗口
  843. * @param params
  844. */
  845. public showrewardTurnTablePanel(): cc.Node {
  846. if (!utils._isConfigInit) {
  847. utils.showLog("warn:" + "组件配置未初始化!");
  848. return null;
  849. }
  850. if (utils.config.otherconfig.rewardTurnTablePanel) {
  851. let node: cc.Node = cc.instantiate(utils.config.otherconfig.rewardTurnTablePanel);
  852. if (node) {
  853. if (this.rewardTurnTablePanel && cc.isValid(this.rewardTurnTablePanel)) {
  854. this.rewardTurnTablePanel.destroy();
  855. }
  856. this.rewardTurnTablePanel = node;
  857. this.rewardTurnTablePanel.zIndex = 9999;
  858. cc.director.getScene().addChild(node, 1000);
  859. return node;
  860. }
  861. } else {
  862. utils.showLog("未找到预制体 rewardTurnTablePanel, 请查看CommonUtils组件上是否赋值!");
  863. }
  864. return null;
  865. }
  866. rewardShortCutPanel: cc.Node = null;
  867. /**
  868. * 显示转盘抽奖窗口
  869. * @param params
  870. */
  871. public showRewardShortCutPanel(): cc.Node {
  872. if (!utils._isConfigInit) {
  873. utils.showLog("warn:" + "组件配置未初始化!");
  874. return null;
  875. }
  876. if (utils.config.otherconfig.rewardShortCutPanel) {
  877. let node: cc.Node = cc.instantiate(utils.config.otherconfig.rewardShortCutPanel);
  878. if (node) {
  879. if (this.rewardShortCutPanel && cc.isValid(this.rewardShortCutPanel)) {
  880. this.rewardShortCutPanel.destroy();
  881. }
  882. this.rewardShortCutPanel = node;
  883. this.rewardShortCutPanel.zIndex = 9999;
  884. cc.director.getScene().addChild(node, 1000);
  885. return node;
  886. }
  887. } else {
  888. utils.showLog("未找到预制体 rewardShortCutPanel, 请查看CommonUtils组件上是否赋值!");
  889. }
  890. return null;
  891. }
  892. _rewardLuckBoxPanel: cc.Node = null;
  893. /**
  894. * 展示幸运宝箱弹窗
  895. * @param params
  896. */
  897. public showRewardLuckBoxPanel(): cc.Node {
  898. if (!utils._isConfigInit) {
  899. utils.showLog("warn:" + "组件配置未初始化!");
  900. return null;
  901. }
  902. if (utils.config.otherconfig.rewardLuckBoxPanel) {
  903. let node: cc.Node = cc.instantiate(utils.config.otherconfig.rewardLuckBoxPanel);
  904. if (node) {
  905. if (this._rewardLuckBoxPanel && cc.isValid(this._rewardLuckBoxPanel)) {
  906. this._rewardLuckBoxPanel.destroy();
  907. }
  908. this._rewardLuckBoxPanel = node;
  909. this._rewardLuckBoxPanel.zIndex = 9999;
  910. cc.director.getScene().addChild(node, 1000);
  911. return node;
  912. }
  913. } else {
  914. utils.showLog("未找到预制体 RewardLuckBoxPanel, 请查看CommonUtils组件上是否赋值!");
  915. }
  916. return null;
  917. }
  918. /**
  919. * 验证广告显示时间是否达到
  920. * @returns true:大于服务器时间 false:小于服务器时间
  921. */
  922. public checkShowAdTime(): boolean {
  923. // if (CC_DEBUG) return true;
  924. if (!utils._isConfigInit) {
  925. utils.showLog("warn:" + "组件配置未初始化!");
  926. return false;
  927. }
  928. let curTime: number = new Date().getTime();
  929. let interval: number = (curTime - utils._gameEntryTime) / 1000;
  930. let showAdTime: number = 0;
  931. if (PlatUtils.IsOPPO) {
  932. showAdTime = 90;
  933. }
  934. if (utils.getConfigByKey("show_ad_time") !== "") {
  935. showAdTime = utils.getConfigByKey("show_ad_time");
  936. }
  937. utils.showLog("验证当前广告显示时间:#showAdTime=", showAdTime, " #interval=", interval);
  938. if (interval >= showAdTime) {
  939. return true;
  940. }
  941. return false;
  942. }
  943. _insertLastShowTime: number = 0;
  944. /**
  945. * 验证是否能够显示插屏
  946. * @returns true 可以显示,false 未达到要求不显示
  947. */
  948. checkInsertAdTime() {
  949. // utils.ServerConfig.insert_ad_interval_time = 5;
  950. if (utils.ServerConfig && utils.ServerConfig.insert_ad_interval_time) {
  951. let curTime: number = new Date().getTime();
  952. let interval: number = (curTime - this._insertLastShowTime) / 1000;
  953. if (interval < utils.ServerConfig.insert_ad_interval_time) {
  954. utils.showLog("验证当前插屏广告显示时间:#showAdTime=", utils.ServerConfig.insert_ad_interval_time, " #interval=", interval);
  955. return false;
  956. }
  957. this._insertLastShowTime = curTime;
  958. }
  959. return true;
  960. }
  961. /**
  962. * 显示积木广告
  963. * @param parme {top,bottom}
  964. */
  965. public showBlockAd(parme?: any) {
  966. if (this._curAdAgent && PlatUtils.IsQQ) {
  967. this._curAdAgent.showBlockAd(parme);
  968. }
  969. }
  970. public hideBlockAd(parme?: any) {
  971. if (this._curAdAgent && PlatUtils.IsQQ) {
  972. this._curAdAgent.hideBlockAd();
  973. }
  974. }
  975. /**
  976. * 显示全屏视频广告
  977. * @param callback
  978. */
  979. public showFullScreenVideo(callback?: Function) {
  980. if (this._curAdAgent) {
  981. // this.videoCallBack = callback;
  982. this._curAdAgent.showFullScreenVideo(callback);
  983. } else {
  984. if (callback) callback(false, "视频加载失败2!");
  985. }
  986. }
  987. /**
  988. * 显示单个原生广告
  989. * @param params
  990. */
  991. public ShowSingleNativeAd(params?: any) {
  992. if (!this.checkShowAdTime()) {
  993. utils.showLog("显示广告条时间未达限制!");
  994. return;
  995. }
  996. if (this._curAdAgent) {
  997. this._curAdAgent.ShowSingleNativeAd && this._curAdAgent.ShowSingleNativeAd(params);
  998. }
  999. }
  1000. /**
  1001. * 隐藏单个原生广告
  1002. * @param params
  1003. */
  1004. public HideSingleNativeAd(params?: any) {
  1005. if (this._curAdAgent) {
  1006. this._curAdAgent.HideSingleNativeAd && this._curAdAgent.HideSingleNativeAd(params);
  1007. }
  1008. }
  1009. /**
  1010. * 显示模版广告
  1011. * @param parmas
  1012. */
  1013. public showCustomAd(params?: any) {
  1014. if (!this.checkShowAdTime()) {
  1015. utils.showLog("显示原生模版广告时间未达限制!");
  1016. return;
  1017. }
  1018. if (this._curAdAgent) {
  1019. this._curAdAgent.showCustomAd && this._curAdAgent.showCustomAd(params);
  1020. }
  1021. }
  1022. /**
  1023. * 隐藏模版广告
  1024. * @param parmas
  1025. */
  1026. public hideCustomAd(params?: any) {
  1027. if (this._curAdAgent) {
  1028. this._curAdAgent.hideCustomAd && this._curAdAgent.hideCustomAd(params);
  1029. }
  1030. }
  1031. _customAdPanel: cc.Node = null;
  1032. /**
  1033. * 显示模版弹窗广告
  1034. * level: 当前关卡数
  1035. * closeCallFunc:Function 关闭后的回调
  1036. */
  1037. public showCustomAdPanel(level: number, closeCallFunc?: Function) {
  1038. utils.showLog("显示模版弹窗广告");
  1039. if (!utils._isConfigInit) {
  1040. utils.showLog("warn:" + "组件配置未初始化!");
  1041. return null;
  1042. }
  1043. let customAdInfo: CustomAdInfo = null;
  1044. if (PlatUtils.IsWechat) {
  1045. customAdInfo = utils.config.wechatconfig.getCustomAdInfoInfo(100);
  1046. if (!customAdInfo) {
  1047. closeCallFunc && closeCallFunc();
  1048. utils.showLog("服务器未配置模版弹窗广告");
  1049. return;
  1050. }
  1051. } else {
  1052. closeCallFunc && closeCallFunc();
  1053. utils.showLog("服务器未配置模版弹窗广告");
  1054. return;
  1055. }
  1056. let custom_panel_show_ad_level = utils.getConfigByKey("custom_panel_show_ad_level");
  1057. if (custom_panel_show_ad_level && level % custom_panel_show_ad_level != 0) {
  1058. closeCallFunc && closeCallFunc();
  1059. utils.showLog("服务器配置间隔" + custom_panel_show_ad_level + "关显示模版弹窗广告!");
  1060. return;
  1061. }
  1062. if (utils.config.otherconfig.yzCustomAdPanel) {
  1063. if (this._curAdAgent) {
  1064. this._curAdAgent.createCustomADBanner();
  1065. }
  1066. let node: cc.Node = cc.instantiate(utils.config.otherconfig.yzCustomAdPanel);
  1067. node.getComponent(YzCustomAdPanel).closeCallFunc = closeCallFunc;
  1068. if (node) {
  1069. if (this._customAdPanel && cc.isValid(this._customAdPanel)) {
  1070. this._customAdPanel.destroy();
  1071. }
  1072. this._customAdPanel = node;
  1073. this._customAdPanel.zIndex = 9999;
  1074. cc.director.getScene().addChild(node, 1000);
  1075. return node;
  1076. }
  1077. } else {
  1078. utils.showLog("未找到预制体 CustomAdPanel, 请查看CommonUtils组件上是否赋值!");
  1079. }
  1080. return null;
  1081. }
  1082. }