AdM.ts 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. import GameM, { VIDEO_TYPE } from "./GameM";
  8. import UiM, { PANEL_NAME } from "./UiM";
  9. import Main from "../Main";
  10. import Turntable from "../ui/Turntable";
  11. import InvestItem from "../prefabs/InvestItem";
  12. import Gift from "../ui/Gift";
  13. import HttpM from "./HttpM";
  14. import EffectNode from "../ui/EffectNode";
  15. import WxMgr from "./WxMgr";
  16. import Daily from "../ui/Daily";
  17. import { thirdVideoTS } from "./topon/AnyThinkAdsMgr/thirdVideoTS";
  18. import TreasureItem from "../prefabs/TreasureItem";
  19. import LogUtil from "../utils/LogUtil";
  20. import SwitchM from "./SwitchM";
  21. import InvestData from "../datas/InvestData";
  22. import TreasureData from "../datas/TreasureData";
  23. import CashOutData from "../datas/CashOutData";
  24. import { HTTP_TYPE } from "../datas/CommonData";
  25. import UsualCaidanData from "../datas/UsualCaidanData";
  26. import { MateData } from "../datas/MateData";
  27. import ClubData from "../datas/ClubData";
  28. import UIMng, { PanelType } from "../uiFrames/UIMng";
  29. import FightResultPanel from "../ui/FightResultPanel";
  30. import WealthPanel from "../ui/WealthPanel";
  31. import RichPanel from "../ui/RichPanel";
  32. import RichPropPanel from "../ui/RichPropPanel";
  33. import DownloadApkData from "../datas/DownloadApkData";
  34. import DailyCashData from "../datas/DailyCashData";
  35. import MoreGamePopNode from "../ui/MoreGamePopNode";
  36. import MoreGameData from "../datas/MoreGameData";
  37. import { TuCaoData } from "../datas/TuCaoData";
  38. /** 广告类 */
  39. const { ccclass, property } = cc._decorator;
  40. @ccclass
  41. export default class AdM {
  42. private static instance: AdM = null
  43. static get Instance(): AdM {
  44. if (!this.instance) {
  45. this.instance = new AdM()
  46. }
  47. return this.instance
  48. }
  49. static videoType: VIDEO_TYPE
  50. //是否在登录之后上报邀请人id,用于上报裂变拉入的统计
  51. static sendReport: boolean = false
  52. // update (dt) {}
  53. watchVideo(videoType) {
  54. if (!GameM.commonData.toponLoaded) {
  55. EffectNode.instance.PlayTip('广告加载中,请稍后再试')
  56. return
  57. }
  58. if (!UiM.Instance.hallNode.getComponent(Main).checkCanVideo(false)) {
  59. return false
  60. }
  61. if (GameM.commonData.isWatchVideo) {
  62. return
  63. }
  64. AdM.videoType = videoType
  65. console.log("-->WatchVideo:", AdM.videoType)
  66. GameM.commonData.hasShowDisconnect = true
  67. //调用穿山甲广告接口
  68. if (GameM.commonData.isVideoTest) {
  69. //测试
  70. AdM.onVideoWatchEnd()
  71. }
  72. else {
  73. if (GameM.commonData.showFull) {
  74. if (GameM.commonData.useTopOn) {
  75. thirdVideoTS.getInstance().showInter(1)
  76. }
  77. return
  78. }
  79. GameM.commonData.isWatchVideo = true
  80. let pop = 1;
  81. if (videoType == VIDEO_TYPE.hangUp) {
  82. pop = 2
  83. }
  84. if (cc.sys.platform != cc.sys.WECHAT_GAME) {
  85. if (cc.sys.os == cc.sys.OS_ANDROID) {
  86. if (GameM.commonData.useTopOn) {
  87. thirdVideoTS.getInstance().showAd();
  88. }
  89. else {
  90. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "showVideo", "()V");
  91. }
  92. }
  93. else if (cc.sys.os == cc.sys.OS_IOS) {
  94. if (GameM.commonData.useTopOn) {
  95. thirdVideoTS.getInstance().showAd();
  96. }
  97. else {
  98. jsb.reflection.callStaticMethod("GameConfig", "showVideo:", "");
  99. }
  100. }
  101. }
  102. else {
  103. WxMgr.getInstance().showRewardAd(pop)
  104. }
  105. }
  106. switch (AdM.videoType) {
  107. case VIDEO_TYPE.turnTable:
  108. AdM.onSendEvent('video_init_4', '看视频参加转盘', 'video_init')
  109. break
  110. case VIDEO_TYPE.invest:
  111. AdM.onSendEvent('video_init_10', '看视频参加投资', 'video_init')
  112. break
  113. case VIDEO_TYPE.investSpeed:
  114. AdM.onSendEvent('video_init_11', '看视频投资加速', 'video_init')
  115. break
  116. case VIDEO_TYPE.offLineDouble:
  117. AdM.onSendEvent('video_init_2', '离线奖励双倍领取视频', 'video_init')
  118. break
  119. case VIDEO_TYPE.newCarAward:
  120. AdM.onSendEvent('video_init_3', '合成新车拉起视频', 'video_init')
  121. break
  122. case VIDEO_TYPE.userLvUpAd:
  123. break;
  124. case VIDEO_TYPE.buyCarMainBtn:
  125. AdM.onSendEvent('video_init_1', '主界面看视频获得金币', 'video_init')
  126. break;
  127. case VIDEO_TYPE.carLvUp:
  128. AdM.onSendEvent('video_init_12', '看视频武将升级', 'video_init')
  129. break;
  130. case VIDEO_TYPE.freshOpenRed:
  131. AdM.onSendEvent('video_init_9', '看视频获得车位红包奖励', 'video_init')
  132. break;
  133. case VIDEO_TYPE.goVideo:
  134. break;
  135. case VIDEO_TYPE.join:
  136. AdM.onSendEvent('video_init_13', '看视频现金夺宝概率提升', 'video_init')
  137. break
  138. case VIDEO_TYPE.getTicket:
  139. AdM.onSendEvent('video_init_6', '看视频参加现金夺宝', 'video_init')
  140. break;
  141. case VIDEO_TYPE.gift_Prop:
  142. case VIDEO_TYPE.gift_redMoney:
  143. case VIDEO_TYPE.gift_gold:
  144. case VIDEO_TYPE.gift_box:
  145. AdM.onSendEvent('video_init_7', '看视频获得热气球奖励', 'video_init')
  146. break;
  147. case VIDEO_TYPE.clearCoolTime:
  148. AdM.onSendEvent('video_init_14', '看视频清除罢工', 'video_init')
  149. break;
  150. case VIDEO_TYPE.adRbProgressAd:
  151. AdM.onSendEvent('video_init_19', '看视频增加提现进度拉起', 'video_init')
  152. break;
  153. }
  154. return true
  155. }
  156. static setUserID() {
  157. // console.log('vvvvvv setUserID ')
  158. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  159. return
  160. }
  161. if (cc.sys.os == cc.sys.OS_ANDROID) {
  162. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "setUserID", "(Ljava/lang/String;)V", GameM.commonData.uin);
  163. }
  164. else if (cc.sys.os == cc.sys.OS_IOS) {
  165. jsb.reflection.callStaticMethod("GameConfig", "setUserID:", GameM.commonData.uin);
  166. }
  167. }
  168. static onWatchEnd(placementId = '', adunit_format = '', network_type = '', network_placement_id = '',
  169. network_firm_id, adsource_id, adsource_index, adsource_price,
  170. adsource_isheaderbidding, publisher_revenue, precision, ecpm_level) {
  171. this.onVideoWatchEnd(placementId, adunit_format, network_type, network_placement_id,
  172. network_firm_id, adsource_id, adsource_index, adsource_price,
  173. adsource_isheaderbidding, publisher_revenue, precision, ecpm_level)
  174. }
  175. /** 获取包名 */
  176. static getPackageName() {
  177. let packName = ''
  178. if (cc.sys.os == cc.sys.OS_ANDROID) {
  179. packName = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "getPackageName", "()Ljava/lang/String;");
  180. }
  181. else if (cc.sys.os == cc.sys.OS_IOS) {
  182. packName = jsb.reflection.callStaticMethod("CsjAdReward", "getPackageName", "", GameM.commonData.uin);
  183. }
  184. return packName
  185. }
  186. static getWxAppId() {
  187. let appid = GameM.commonData.appid
  188. // let appid = 'wx1c85edd1010da534'
  189. let unicodeStr = ''
  190. if (cc.sys.os == cc.sys.OS_ANDROID) {
  191. unicodeStr = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "getWXAppId", "()Ljava/lang/String;");
  192. }
  193. else if (cc.sys.os == cc.sys.OS_IOS) {
  194. unicodeStr = jsb.reflection.callStaticMethod("GameConfig", "getWXAppId:", GameM.commonData.uin);
  195. }
  196. if (unicodeStr.indexOf(';') != -1) {
  197. let unicodeArr = unicodeStr.split(';')
  198. appid = unicodeArr[0]
  199. let configVersionCode = unicodeArr[1]
  200. if (configVersionCode != "") {
  201. GameM.commonData.version = configVersionCode
  202. }
  203. }
  204. else {
  205. appid = unicodeStr
  206. }
  207. if (appid != "" && appid != null && appid != undefined) {
  208. GameM.commonData.appid = appid
  209. }
  210. console.log('getWxAppId ', ' unicodeStr = ' + unicodeStr + ' GameM.commonData.version = ' + GameM.commonData.version + ' GameM.commonData.appid = ' + GameM.commonData.appid)
  211. this.getAdvertisingChannel()
  212. GameM.globalStorage.init()
  213. AdM.checkPermission()
  214. }
  215. //获取邀请人uin
  216. static getInviteCode(sendReport: boolean = false) {
  217. LogUtil.logV("getInviteCode", "start")
  218. this.sendReport = sendReport
  219. if (cc.sys.os == cc.sys.OS_ANDROID) {
  220. LogUtil.logV("getInviteCode", "android start")
  221. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "getInviteCode", "()V");
  222. }
  223. // else if (cc.sys.os == cc.sys.OS_IOS) {
  224. // this.onSetInviteCode("")
  225. // }else{
  226. // this.onSetInviteCode("")
  227. // }
  228. }
  229. static onSetInviteCode(codeStr: string) {
  230. // GameM.ClubData.inviteUin ="" // "6dfdb39c7fc34c7c83b9e3673edd42e5"
  231. LogUtil.logV("onSetInviteCode", "start")
  232. if (codeStr != null && codeStr != undefined && codeStr != "") {
  233. let jsonObj = JSON.parse(codeStr)
  234. if (jsonObj.inviteuin) {
  235. GameM.ClubData.inviteUin = jsonObj.inviteuin
  236. }
  237. } else {
  238. GameM.ClubData.inviteUin = ""
  239. }
  240. if (GameM.ClubData.inviteUin != "") {
  241. if (this.sendReport) {
  242. this.sendReport = false
  243. let data =
  244. {
  245. "appId": GameM.commonData.appid,
  246. "uin": GameM.commonData.tmp_uin,
  247. "inviteUin": GameM.ClubData.inviteUin
  248. }
  249. GameM.httpM.httpGetComRsa('inviteInstalled', 'POST', JSON.stringify(data), (response) => {
  250. LogUtil.logV("onSetInviteCode: url", "inviteInstalled")
  251. LogUtil.logV("onSetInviteCode:errcode ", response.errcode)
  252. LogUtil.logV("onSetInviteCode:errmsg", response.errmsg)
  253. })
  254. this.openInstallReportRegister()
  255. // GameM.httpM.sendDatas(HTTP_TYPE.inviteInstalled,
  256. // data);
  257. return
  258. } else {
  259. let aa =
  260. {
  261. "inviteUin": GameM.ClubData.inviteUin
  262. }
  263. LogUtil.logV("getAccountInfo inviteUin", aa.inviteUin)
  264. LogUtil.logV("getAccountInfo uin", GameM.commonData.uin)
  265. GameM.httpM.sendDatas(HTTP_TYPE.bindRelation, aa)
  266. }
  267. } else {
  268. LogUtil.logV("onSetInviteCode", "inviteUin == null")
  269. }
  270. }
  271. //获得邀请码之后直接上报openinstall
  272. static openInstallReportRegister() {
  273. LogUtil.logV("getInviteCode", "start")
  274. if (cc.sys.os == cc.sys.OS_ANDROID) {
  275. LogUtil.logV("getInviteCode", "android start")
  276. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "openInstallReportRegister", "()V");
  277. }
  278. // else if (cc.sys.os == cc.sys.OS_IOS) {
  279. // this.onSetInviteCode("")
  280. // }else{
  281. // this.onSetInviteCode("")
  282. // }
  283. }
  284. /** 获取投放渠道 和 广告位信息*/
  285. static getAdvertisingChannel() {
  286. let str = ''
  287. if (cc.sys.os == cc.sys.OS_ANDROID) {
  288. str = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "getAdvertisingChannel", "()Ljava/lang/String;");
  289. }
  290. else if (cc.sys.os == cc.sys.OS_IOS) {
  291. str = jsb.reflection.callStaticMethod("GameConfig", "getAdvertisingChannel:", GameM.commonData.uin);
  292. }
  293. let arr = str.split(',')
  294. let channel = arr[0]
  295. GameM.commonData.toponId = arr[1]
  296. GameM.commonData.toponKey = arr[2]
  297. GameM.commonData.rewardPlaceId = arr[3]
  298. GameM.commonData.interPlaceId = arr[4]
  299. GameM.commonData.nativePlaceId = arr[5]
  300. GameM.commonData.fullInterPlaceId = arr[6]
  301. GameM.commonData.bannerPlaceId = arr[7]
  302. GameM.commonData.advertisingChannel = parseInt(channel)
  303. if (GameM.commonData.useTopOn) {
  304. thirdVideoTS.getInstance().init();
  305. }
  306. }
  307. static onWatchCancleEnd() {
  308. EffectNode.instance.PlayTip('观看完视频才能领取奖励')
  309. GameM.commonData.isWatchVideo = false
  310. switch (AdM.videoType) {
  311. case VIDEO_TYPE.hangUp:
  312. UiM.Instance.hallNode.getComponent(Main).onHandUpAdFail();
  313. break;
  314. case VIDEO_TYPE.freshGet:
  315. UiM.Instance.redPackageNode.onDoubleGetVideoFail();
  316. break;
  317. case VIDEO_TYPE.turnTable:
  318. UiM.Instance.turntableNode.getComponent(Turntable).onTurnTableVideoFail()
  319. break;
  320. case VIDEO_TYPE.buyCarMainBtn:
  321. UiM.Instance.hallNode.getComponent(Main).onBuyCarAdFail()
  322. break;
  323. case VIDEO_TYPE.dailyGet:
  324. UiM.Instance.dailyNode.getComponent(Daily).onVideoFail()
  325. break;
  326. case VIDEO_TYPE.adRbProgressAd:
  327. TuCaoData.Ins.UpdateVideoProgressFial();
  328. break;
  329. default:
  330. AdM.destroyNative()
  331. break
  332. }
  333. }
  334. static onWatchFailEnd() {
  335. EffectNode.instance.PlayTip('加载视频中,请稍后再试')
  336. GameM.commonData.isWatchVideo = false
  337. switch (AdM.videoType) {
  338. case VIDEO_TYPE.hangUp:
  339. UiM.Instance.hallNode.getComponent(Main).onHandUpAdFail();
  340. break;
  341. case VIDEO_TYPE.freshGet:
  342. UiM.Instance.redPackageNode.onDoubleGetVideoFail();
  343. break;
  344. case VIDEO_TYPE.turnTable:
  345. UiM.Instance.turntableNode.getComponent(Turntable).onTurnTableVideoFail()
  346. break;
  347. case VIDEO_TYPE.buyCarMainBtn:
  348. UiM.Instance.hallNode.getComponent(Main).onBuyCarAdFail()
  349. //买车失败之后因为banner显示问题会挡住买车按钮
  350. if (thirdVideoTS.getInstance().getIsBannerShow()) {
  351. AdM.destroyBanner()
  352. }
  353. break;
  354. case VIDEO_TYPE.dailyGet:
  355. UiM.Instance.dailyNode.getComponent(Daily).onVideoFail()
  356. break;
  357. case VIDEO_TYPE.adRbProgressAd:
  358. TuCaoData.Ins.UpdateVideoProgressFial();
  359. break;
  360. default:
  361. AdM.destroyNative()
  362. break
  363. }
  364. }
  365. static WxLogin() {
  366. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  367. WxMgr.getInstance().gameLogin();
  368. }
  369. else {
  370. if (cc.sys.os == cc.sys.OS_ANDROID) {
  371. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "WxAuth", "()V");
  372. }
  373. else if (cc.sys.os == cc.sys.OS_IOS) {
  374. jsb.reflection.callStaticMethod("GameConfig", "WxAuth:", "");
  375. }
  376. }
  377. }
  378. static onGetAccessCode(code) {
  379. GameM.commonData.wxCode = code
  380. AdM.deleteApks()
  381. HttpM.Instance.wxlogin()
  382. }
  383. /** 发送事件
  384. * @param eventID 事件ID
  385. * @param des 事件描述
  386. * @param taEventID 数数属性事件, ''不向数数发送事件
  387. */
  388. static onSendEvent(eventID: string, des: string, taEventID: string = '') {
  389. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  390. return
  391. }
  392. //买车次数只记录前200次
  393. if (taEventID == 'buy') {
  394. let id = Number(eventID.split('_')[1])
  395. if (id > 200) {
  396. return
  397. }
  398. }
  399. if (taEventID == 'shop_buy_car') {
  400. return
  401. }
  402. //合成操作不发埋点
  403. if (eventID.indexOf('operate') != -1) {
  404. return
  405. }
  406. //友盟埋点
  407. if (cc.sys.os == cc.sys.OS_ANDROID) {
  408. //类型 taEventID = ''计数,其他为多属性
  409. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "sendEvent", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", taEventID, eventID, des);
  410. }
  411. else if (cc.sys.os == cc.sys.OS_IOS) {
  412. jsb.reflection.callStaticMethod("GameConfig", "sendEvent:des:", eventID, des);
  413. }
  414. //数数埋点
  415. if (taEventID != '') {
  416. this.setTAEvent(taEventID, eventID, des)
  417. }
  418. //星云埋点
  419. if (eventID != "firstLoadIn" && eventID != 'loadStart') {
  420. GameM.commonData.sendCp(eventID, des)
  421. }
  422. }
  423. static sendUmeng(eventID: string, des: string) {
  424. //友盟埋点
  425. if (cc.sys.os == cc.sys.OS_ANDROID) {
  426. //类型 taEventID = ''计数,其他为多属性
  427. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "sendEvent", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "", eventID, des);
  428. }
  429. else if (cc.sys.os == cc.sys.OS_IOS) {
  430. jsb.reflection.callStaticMethod("GameConfig", "sendEvent:des:", eventID, des);
  431. }
  432. }
  433. /**UROI事件
  434. * @param eventID 事件随机ID
  435. * @param adID 不同广告生成的唯一id
  436. * @param adPlacementID 唯一广告位id
  437. * @param adOperate 广告事件
  438. * "ad_request",
  439. "ad_fill",
  440. "ad_show",
  441. "ad_click";
  442. * @param adType 广告类型
  443. "splash";
  444. "flow";
  445. "rewarded";
  446. "interstitial";
  447. "banner";
  448. "other";
  449. * @param adAdn 广告平台来源
  450. "facebook",
  451. "admob",
  452. "gdt",
  453. "bytedance_pangle",
  454. "baidu",
  455. "tanx",
  456. "other";
  457. * @param adPrice 计费价格
  458. * */
  459. static sendUROIEvent(eventID, adID, adPlacementID, adOperate, adType, adAdn, adPrice) {
  460. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  461. return
  462. }
  463. if (cc.sys.os == cc.sys.OS_ANDROID) {
  464. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "sendUROIEvent",
  465. "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
  466. eventID, adID, adPlacementID, adOperate, adType, adAdn, adPrice);
  467. }
  468. else if (cc.sys.os == cc.sys.OS_IOS) {
  469. }
  470. }
  471. /** 巨量 查看内容
  472. */
  473. static onViewContent() {
  474. if (cc.sys.os == cc.sys.OS_ANDROID) {
  475. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "viewContent", "()V");
  476. }
  477. else if (cc.sys.os == cc.sys.OS_IOS) {
  478. }
  479. }
  480. /** 快手监测事件
  481. * @param type 0 次留 1 七留 2 汽车最大等级 3 观看激励视频 4 注册事件 5 完件事件
  482. */
  483. static onKSEvent(type, lv = 0) {
  484. if (cc.sys.os == cc.sys.OS_ANDROID) {
  485. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "onKSEvent", "(II)V", type, lv);
  486. }
  487. else if (cc.sys.os == cc.sys.OS_IOS) {
  488. }
  489. }
  490. static setClipboard(str) {
  491. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  492. WxMgr.getInstance().clipboardData(str)
  493. return
  494. }
  495. if (cc.sys.os == cc.sys.OS_ANDROID) {
  496. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "setClipboard", "(Ljava/lang/String;)V", str);
  497. }
  498. else if (cc.sys.os == cc.sys.OS_IOS) {
  499. jsb.reflection.callStaticMethod("GameConfig", "setClipboard:", str);
  500. }
  501. EffectNode.instance.PlayTip('复制成功')
  502. }
  503. static sharePic() {
  504. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  505. return
  506. }
  507. if (cc.sys.os == cc.sys.OS_ANDROID) {
  508. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "sharePic", "()V");
  509. }
  510. else if (cc.sys.os == cc.sys.OS_IOS) {
  511. jsb.reflection.callStaticMethod("GameConfig", "sharePic:", "");
  512. }
  513. }
  514. //裂变分享链接
  515. static shareClubInstallUrl(url: string, title: string, describe: string, imgUrl: string) {
  516. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  517. return
  518. }
  519. if (cc.sys.os == cc.sys.OS_ANDROID) {
  520. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "shareInviteUrl",
  521. "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", url, title, describe, imgUrl);
  522. }
  523. else if (cc.sys.os == cc.sys.OS_IOS) {
  524. //to do
  525. // jsb.reflection.callStaticMethod("GameConfig", "sharePic:", "");
  526. }
  527. }
  528. /** 界面增减 popNum 1 加 -1 减 */
  529. static popChange(popNum: number) {
  530. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  531. return
  532. }
  533. if (cc.sys.os == cc.sys.OS_ANDROID) {
  534. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "popChange", "(I)V", popNum);
  535. }
  536. else if (cc.sys.os == cc.sys.OS_IOS) {
  537. }
  538. }
  539. static closePanelFromHome() {
  540. UiM.Instance.closePanelFromHome()
  541. }
  542. /** 返回显示弹窗 */
  543. static openDailyPanel() {
  544. UiM.Instance.hallNode.getComponent(Main).showDialyPanel()
  545. }
  546. /**广告播放结束
  547. * @param placementId 广告位id
  548. */
  549. public static onVideoWatchEnd(placementId = '', adunit_format = '', network_type = '', network_placement_id = '',
  550. network_firm_id = '', adsource_id = '', adsource_index = '', adsource_price = '',
  551. adsource_isheaderbidding = '', publisher_revenue = '', precision = '', ecpm_level = '') {
  552. // console.log('onVideoWatchEnd')
  553. UiM.Instance.hallNode.getComponent(Main).startVideoCoolDown()
  554. GameM.commonData.updateVideoTimes(placementId, adunit_format, network_type, network_placement_id,
  555. network_firm_id, adsource_id, adsource_index, adsource_price,
  556. adsource_isheaderbidding, publisher_revenue, precision, ecpm_level)
  557. AdM.onSendEvent('videoEnd', '所有视频结束统计')
  558. UsualCaidanData.Instance.addUsualProgress(1)
  559. if (GameM.commonData.gameAdd <= 7200) {
  560. AdM.onViewContent()
  561. AdM.onKSEvent(5)
  562. }
  563. AdM.videoReward()
  564. GameM.commonData.isWatchVideo = false
  565. GameM.commonData.hasTouch = true
  566. this.videoType = -1
  567. }
  568. static videoReward() {
  569. switch (AdM.videoType) {
  570. case VIDEO_TYPE.buyCar:
  571. UiM.Instance.hallNode.getComponent(Main).onVideoBuyCarEnd()
  572. // AdM.onSendEvent('videoEnd1', '商店买车拉起视频成功')
  573. break
  574. case VIDEO_TYPE.turnTable:
  575. UiM.Instance.turntableNode.getComponent(Turntable).onTurnTableVideoEnd()
  576. AdM.onSendEvent('video_end_4', '看视频参加转盘结束', 'video_end')
  577. break
  578. case VIDEO_TYPE.invest:
  579. InvestData.Instance.investItem.getComponent(InvestItem).onInvestVideoEnd()
  580. AdM.onSendEvent('video_end_10', '看视频参加投资结束', 'video_end')
  581. AdM.setTAEventUser(1, 'invest_videoTimes', 1)
  582. break
  583. case VIDEO_TYPE.investSpeed:
  584. InvestData.Instance.investItem.getComponent(InvestItem).onInvestVideoSpeedEnd()
  585. AdM.onSendEvent('video_end_10', '看视频投资加速结束', 'video_end')
  586. AdM.setTAEventUser(1, 'invest_videoTimes', 1)
  587. break
  588. case VIDEO_TYPE.offLineDouble:
  589. UiM.Instance.giftNode.getComponent(Gift).onOfflineWatchEnd()
  590. AdM.onSendEvent('video_end_2', '离线奖励双倍领取视频结束', 'video_end')
  591. break
  592. case VIDEO_TYPE.newCarAward:
  593. UiM.Instance.giftNode.getComponent(Gift).onGetCarDoubleWatchEnd()
  594. AdM.onSendEvent('video_end_3', '合成新车拉起视频结束', 'video_end')
  595. break
  596. case VIDEO_TYPE.gift_box:
  597. UiM.Instance.giftNode.getComponent(Gift).onGiftBoxWatchEnd()
  598. AdM.onSendEvent('video_end_7', '看视频获得热气球奖励结束', 'video_end')
  599. break
  600. case VIDEO_TYPE.gift_redMoney:
  601. UiM.Instance.giftNode.getComponent(Gift).onGiftRedMoneyAdEnd();
  602. AdM.onSendEvent('video_end_7', '看视频获得热气球奖励结束', 'video_end')
  603. break;
  604. case VIDEO_TYPE.userLvUpAd:
  605. UiM.Instance.rewardNode.BtnAdUserLvUpEnd();
  606. break;
  607. case VIDEO_TYPE.buyCarMainBtn:
  608. UiM.Instance.hallNode.getComponent(Main).onBuyCarAdEnd()
  609. AdM.onSendEvent('video_end_1', '主界面看视频获得金币结束', 'video_end')
  610. AdM.setTAEventUser(1, 'buyMain_videoTimes', 1)
  611. break;
  612. case VIDEO_TYPE.shopBuyCarBtn:
  613. UiM.Instance.hallNode.getComponent(Main).onShopBuyCarAdEnd()
  614. break;
  615. case VIDEO_TYPE.carLvUp:
  616. UiM.Instance.hallNode.getComponent(Main).carLvUpVideoEnd()
  617. AdM.onSendEvent('video_end_12', '看视频武将升级结束', 'video_end')
  618. break;
  619. // case VIDEO_TYPE.taskRwardAd:
  620. // UiM.Instance.rewardNode.BtnAdTaskEnd();
  621. // break;
  622. // case VIDEO_TYPE.hangUp:
  623. // UiM.Instance.hallNode.getComponent(Main).onHangUpAdEnd();
  624. // AdM.onSendEvent('videoEnd11', '自动拉起视频播放成功')
  625. // break;
  626. case VIDEO_TYPE.freshGet:
  627. UiM.Instance.redPackageNode.onDoubleGetVideoEnd();
  628. break;
  629. case VIDEO_TYPE.freshOpenRed:
  630. UiM.Instance.redPackageNode.onOpenVideoEnd();
  631. AdM.onSendEvent('video_end_9', '看视频获得车位红包奖励结束', 'video_end')
  632. break;
  633. case VIDEO_TYPE.dailyGet:
  634. UiM.Instance.dailyNode.getComponent(Daily).onVideoEnd()
  635. break
  636. case VIDEO_TYPE.dailyCash:
  637. UiM.Instance.redPackageNode.onDailyCashVideoEnd()
  638. break
  639. case VIDEO_TYPE.gift_gold:
  640. UiM.Instance.giftNode.getComponent(Gift).onGiftGoldADEnd()
  641. AdM.onSendEvent('video_end_7', '看视频获得热气球奖励结束', 'video_end')
  642. break
  643. case VIDEO_TYPE.getTicket:
  644. UiM.Instance.giftNode.getComponent(Gift).onGetTicketAdEnd()
  645. AdM.onSendEvent('video_end_6', '看视频参加现金夺宝结束', 'video_end')
  646. break
  647. case VIDEO_TYPE.join:
  648. if (TreasureData.Instance.curTreasureItem) {
  649. TreasureData.Instance.curTreasureItem.getComponent(TreasureItem).onDrawAdEnd()
  650. }
  651. AdM.onSendEvent('video_end_13', '看视频现金夺宝概率提升结束', 'video_end')
  652. break
  653. case VIDEO_TYPE.gift_Prop:
  654. LogUtil.logV("VIDEO_TYPE.gift_Prop", "")
  655. UiM.Instance.giftNode.getComponent(Gift).onPropADEnd()
  656. AdM.onSendEvent('video_end_7', '看视频获得热气球奖励结束', 'video_end')
  657. break
  658. case VIDEO_TYPE.fight2Double:
  659. LogUtil.logV("VIDEO_TYPE.fight2Double", "");
  660. (UIMng.Ins.GetPanel(PanelType.FightResultPanel) as FightResultPanel).AdDoubleEnd();
  661. break
  662. case VIDEO_TYPE.richFightAd:
  663. //LogUtil.logV("VIDEO_TYPE.fight2Double", "");
  664. (UIMng.Ins.GetPanel(PanelType.FightResultPanel) as FightResultPanel).AdRichEnd();
  665. AdM.onSendEvent(`video_end_16`, `取经战斗-全部奖励视频拉起成功`, 'video_end');
  666. break
  667. case VIDEO_TYPE.richCtrlAd:
  668. //LogUtil.logV("VIDEO_TYPE.fight2Double", "");
  669. (UIMng.Ins.GetPanel(PanelType.RichPropPanel) as RichPropPanel).AdRichCtrlEnd();
  670. AdM.onSendEvent(`video_end_17`, `取经免费获得遥控卡视频拉起成功`, 'video_end');
  671. break
  672. case VIDEO_TYPE.richGetDiceAd:
  673. (UIMng.Ins.GetPanel(PanelType.RichPropPanel) as RichPropPanel).DiceAdEnd();
  674. break;
  675. case VIDEO_TYPE.clearShield:
  676. (UIMng.Ins.GetPanel(PanelType.WealthPanel) as WealthPanel).AdEndClearShield();
  677. break
  678. case VIDEO_TYPE.clearCoolTime:
  679. LogUtil.logV("VIDEO_TYPE.clearCoolTime", "");
  680. UiM.Instance.giftNode.getComponent(Gift).clearCoolTime()
  681. AdM.onSendEvent('video_end_14', '看视频清除罢工成', 'video_end')
  682. break
  683. case VIDEO_TYPE.adRbProgressAd:
  684. AdM.onSendEvent('video_end_19', '看视频增加提现进度拉起成功', 'video_end')
  685. break
  686. }
  687. }
  688. /**
  689. * 显示类型
  690. * @param type 1 账号设置
  691. * 2 空投宝箱
  692. * 3 商店
  693. * 4 挂机收益
  694. * 5 投资
  695. * 6 转盘
  696. * 7 加速
  697. * 8 任务
  698. * 9 获得新车奖励弹窗
  699. * 10 账号升级弹窗
  700. * 11 金币获得弹窗
  701. * 12 升级汽车询问弹窗
  702. * 13 登陆豪礼
  703. * 14:小秘书
  704. * 15:免费领取手机
  705. * 16:提现
  706. * 17:现金夺宝
  707. * 18:汽车等级奖励
  708. * 19:每日提现(明日再来和关闭按钮)
  709. */
  710. static createInter(type) {
  711. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  712. return
  713. }
  714. if (GameM.commonData.maxCarLevel <= 7) {
  715. return
  716. }
  717. if ((CashOutData.Instance.cashStatus.length + DailyCashData.Instance.dailyCashStatus.length) <= 0) {
  718. return
  719. }
  720. if (GameM.commonData.popInterArr.indexOf(type.toString()) == -1) {
  721. return
  722. }
  723. if (!GameM.commonData.adShowConfig) {
  724. return
  725. }
  726. if (Math.random() <= GameM.commonData.adShowConfig.insert_probability) {
  727. if (cc.sys.os == cc.sys.OS_ANDROID) {
  728. if (GameM.commonData.useTopOn) {
  729. thirdVideoTS.getInstance().showInter(0);
  730. }
  731. else {
  732. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "createInter", "()V");
  733. }
  734. }
  735. else if (cc.sys.os == cc.sys.OS_IOS) {
  736. if (GameM.commonData.useTopOn) {
  737. thirdVideoTS.getInstance().showInter(0);
  738. }
  739. else {
  740. jsb.reflection.callStaticMethod("GameConfig", "createInter:", "");
  741. }
  742. }
  743. }
  744. else {
  745. if (MoreGameData.Instance.interProperTotal <= 0) {
  746. return
  747. }
  748. if (Math.random() <= GameM.commonData.globalCfg.popMoreGame) {
  749. UiM.Instance.onPanel(PANEL_NAME.MoreGamePopNode, false, () => {
  750. let data = MoreGameData.Instance.getRandomInter()
  751. UiM.Instance.moreGamePopNode.getComponent(MoreGamePopNode).init(data)
  752. })
  753. }
  754. }
  755. }
  756. /** 显示banner */
  757. static showBanner() {
  758. LogUtil.logV('showBanner ', 'showBanner aa')
  759. if (SwitchM.forceMakeMoney) {
  760. LogUtil.logV('showBanner ', 'showBanner bb')
  761. if (GameM.commonData.useTopOn) {
  762. if (GameM.commonData.adShowConfig && GameM.commonData.adShowConfig.is_show_banner == 1) {
  763. LogUtil.logV('showBanner ', 'showBanner')
  764. thirdVideoTS.getInstance().showBanner()
  765. }
  766. }
  767. }
  768. }
  769. /** 销毁banner */
  770. static destroyBanner() {
  771. if (SwitchM.forceMakeMoney) {
  772. if (GameM.commonData.useTopOn) {
  773. thirdVideoTS.getInstance().destroyBanner()
  774. }
  775. }
  776. }
  777. /** 显示信息流 */
  778. static showNative(type = 0) {
  779. if (GameM.commonData.useTopOn) {
  780. thirdVideoTS.getInstance().showNative(type)
  781. }
  782. }
  783. /** 销毁信息流 */
  784. static destroyNative() {
  785. if (GameM.commonData.useTopOn) {
  786. if (thirdVideoTS.getInstance().getIsNativeShow()) {
  787. thirdVideoTS.getInstance().destroyNative()
  788. }
  789. }
  790. }
  791. static showTip(tip) {
  792. EffectNode.instance.PlayTip(tip)
  793. }
  794. static setTAEventRegister() {
  795. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  796. return
  797. }
  798. if (cc.sys.os == cc.sys.OS_ANDROID) {
  799. let talent = MateData.Ins.GetMateInfo()
  800. let commonStr = GameM.commonData.buyTimeTotal + ';' + GameM.commonData.nickname + ';' + GameM.commonData.appVersion + ';' + GameM.commonData.videoTimes + ';'
  801. + GameM.commonData.redMoney + ';' + GameM.commonData.gold + ';' + GameM.commonData.maxCarLevel + ';' + GameM.commonData.loginDays + ';' + talent
  802. + GameM.commonData.roleData.turntableTotal + ';' + GameM.commonData.roleData.shopTotal + ';' + GameM.commonData.roleData.investTotal + ';'
  803. + GameM.commonData.roleData.treasureTotal + ';' + GameM.commonData.roleData.airshipTotal
  804. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "setTAEventRegister", "(Ljava/lang/String;)V",
  805. commonStr);
  806. }
  807. else if (cc.sys.os == cc.sys.OS_IOS) {
  808. let json = {
  809. role_name: GameM.commonData.nickname,
  810. TotalPayMoney: GameM.commonData.redMoney,
  811. level: GameM.commonData.roleData.lv,
  812. ad_number: GameM.commonData.videoTimes,
  813. highest_car_level: GameM.commonData.maxCarLevel,
  814. withdraw_amount: GameM.commonData.cashTotalNum
  815. }
  816. jsb.reflection.callStaticMethod("ThinkingEvent", "setTAEventRegister:", JSON.stringify(json));
  817. }
  818. }
  819. /**
  820. * 设置人物属性
  821. * @param type 0 set 1 add
  822. * @param property 属性名
  823. * @param value 数值
  824. */
  825. static setTAEventUser(type, property, value) {
  826. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  827. return
  828. }
  829. if (cc.sys.os == cc.sys.OS_ANDROID) {
  830. let talent = MateData.Ins.GetMateInfo()
  831. let commonStr = GameM.commonData.buyTimeTotal + ';' + GameM.commonData.nickname + ';' + GameM.commonData.appVersion + ';' + GameM.commonData.videoTimes + ';'
  832. + GameM.commonData.redMoney + ';' + GameM.commonData.gold + ';' + GameM.commonData.maxCarLevel + ';' + GameM.commonData.loginDays + ';' + talent
  833. + GameM.commonData.roleData.turntableTotal + ';' + GameM.commonData.roleData.shopTotal + ';' + GameM.commonData.roleData.investTotal + ';'
  834. + GameM.commonData.roleData.treasureTotal + ';' + GameM.commonData.roleData.airshipTotal
  835. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "setTAEventUser", "(Ljava/lang/String;ILjava/lang/String;F)V",
  836. commonStr, type, property, value);
  837. }
  838. else if (cc.sys.os == cc.sys.OS_IOS) {
  839. let json = {
  840. role_name: GameM.commonData.nickname,
  841. TotalPayMoney: GameM.commonData.redMoney,
  842. level: GameM.commonData.roleData.lv,
  843. ad_number: GameM.commonData.videoTimes,
  844. highest_car_level: GameM.commonData.maxCarLevel,
  845. withdraw_amount: GameM.commonData.cashTotalNum,
  846. type: type,
  847. property: property,
  848. value: value
  849. }
  850. jsb.reflection.callStaticMethod("ThinkingEvent", "setTAEventUser:", JSON.stringify(json));
  851. }
  852. }
  853. static setTAEvent(taEventID, eventID, des) {
  854. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  855. return
  856. }
  857. if (cc.sys.os == cc.sys.OS_ANDROID) {
  858. let talent = MateData.Ins.GetMateInfo()
  859. let commonStr = GameM.commonData.buyTimeTotal + ';' + GameM.commonData.nickname + ';' + GameM.commonData.appVersion + ';' + GameM.commonData.videoTimes + ';'
  860. + GameM.commonData.redMoney + ';' + GameM.commonData.gold + ';' + GameM.commonData.maxCarLevel + ';' + GameM.commonData.loginDays + ';' + talent
  861. + GameM.commonData.roleData.turntableTotal + ';' + GameM.commonData.roleData.shopTotal + ';' + GameM.commonData.roleData.investTotal + ';'
  862. + GameM.commonData.roleData.treasureTotal + ';' + GameM.commonData.roleData.airshipTotal
  863. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "setTAEvent", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
  864. commonStr, taEventID, eventID, des);
  865. }
  866. else if (cc.sys.os == cc.sys.OS_IOS) {
  867. let json = {
  868. role_name: GameM.commonData.nickname,
  869. TotalPayMoney: GameM.commonData.redMoney,
  870. level: GameM.commonData.roleData.lv,
  871. ad_number: GameM.commonData.videoTimes,
  872. highest_car_level: GameM.commonData.maxCarLevel,
  873. withdraw_amount: GameM.commonData.cashTotalNum,
  874. taEventID: taEventID,
  875. eventID: eventID,
  876. des: des
  877. }
  878. jsb.reflection.callStaticMethod("ThinkingEvent", "setTAEvent:", JSON.stringify(json));
  879. }
  880. }
  881. static updateMachine(info) {
  882. if (cc.sys.os == cc.sys.OS_ANDROID) {
  883. GameM.commonData.updateMachine(info)
  884. }
  885. else if (cc.sys.os == cc.sys.OS_IOS) {
  886. GameM.commonData.updateMachine(info)
  887. }
  888. }
  889. /**判断是否可以显示开屏广告
  890. * @param state 1 可以 0 不可以
  891. * */
  892. static canShowSplash(state) {
  893. if (cc.sys.os == cc.sys.OS_ANDROID) {
  894. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "canShowSplash", "(I)V", state);
  895. }
  896. else if (cc.sys.os == cc.sys.OS_IOS) {
  897. jsb.reflection.callStaticMethod("GameConfig", "canShowSplash:", state);
  898. }
  899. }
  900. static showSplash() {
  901. AdM.onSendEvent('slashAd', '开屏', 'slashAd')
  902. if (cc.sys.os == cc.sys.OS_ANDROID) {
  903. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "showSplash", "()V");
  904. }
  905. else if (cc.sys.os == cc.sys.OS_IOS) {
  906. jsb.reflection.callStaticMethod("GameConfig", "showSplash:", "");
  907. }
  908. }
  909. /** 检查获取手机权限 */
  910. static checkPermission() {
  911. if (cc.sys.os == cc.sys.OS_ANDROID) {
  912. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "checkPermission", "()V");
  913. }
  914. else if (cc.sys.os == cc.sys.OS_IOS) {
  915. jsb.reflection.callStaticMethod("GameConfig", "checkPermission:", "");
  916. }
  917. }
  918. /** 安装apk
  919. * @param localPath 本地路径
  920. */
  921. static installApk(localPath) {
  922. if (cc.sys.os == cc.sys.OS_ANDROID) {
  923. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "installApk", "(Ljava/lang/String;)V", localPath);
  924. }
  925. else if (cc.sys.os == cc.sys.OS_IOS) {
  926. jsb.reflection.callStaticMethod("GameConfig", "installApk:", "");
  927. }
  928. }
  929. /** 判断是否已经安装
  930. * @param packageName 包名
  931. */
  932. static canStartGame(packageName, start: boolean): boolean {
  933. let isExist = false
  934. if (cc.sys.os == cc.sys.OS_ANDROID) {
  935. isExist = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "isStartGame", "(Ljava/lang/String;Z)Z", packageName, start);
  936. return isExist
  937. }
  938. else if (cc.sys.os == cc.sys.OS_IOS) {
  939. jsb.reflection.callStaticMethod("GameConfig", "installApk:", "");
  940. }
  941. return isExist
  942. }
  943. static updateActivateLog(sessionDuration) {
  944. LogUtil.logV('test>>> updateActivateLog ', sessionDuration)
  945. GameM.commonData.updateActivateLog(sessionDuration)
  946. }
  947. static getApkFileInfo(path: string): string {
  948. LogUtil.logV('getApkFileInfo', "")
  949. let str = ""
  950. // path = "/storage/emulated/0/Android/data/com.aries.hyxy.mz/cache/com_qq_e_download/apk/com.gtxj.gdttf.apk"
  951. if (cc.sys.os == cc.sys.OS_ANDROID) {
  952. str = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "getApkIcon", "(Ljava/lang/String;)Ljava/lang/String;", path);
  953. LogUtil.logV("getApkFileInfo ", str)
  954. }
  955. return str
  956. }
  957. static saveLocalDownloadAPkFiles(allPath: string) {
  958. LogUtil.logV('saveLocalDownloadAPkFiles allPath ', allPath)
  959. DownloadApkData.Instance.setInDownloadApkFiles(allPath)
  960. }
  961. static checkPathApk() {
  962. LogUtil.logV('checkPathApk', "")
  963. if (cc.sys.os == cc.sys.OS_ANDROID) {
  964. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "checkPathApk", "()V");
  965. }
  966. }
  967. static freshApkState() {
  968. DownloadApkData.Instance.freshInstallApk()
  969. }
  970. static deleteApks() {
  971. LogUtil.logV('deleteApks', "")
  972. if (cc.sys.os == cc.sys.OS_ANDROID) {
  973. jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "deleteApks", "()V");
  974. }
  975. }
  976. }
  977. window['AdM'] = AdM