ATSDKMgrJS.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. require("./AnyThinkAds/ATJSSDK");
  2. var ATSDKMgrJS = cc.Class({
  3. name: "ATSDKMgrJS",
  4. /** 代理脚本(TS) */
  5. proxy: null,
  6. ctor: function () {
  7. console.log("ATSDKMgrJS.js created! ")
  8. },
  9. /** 初始化Sdk */
  10. initATJSSDK: function (appid, appsecret, umchannel) {
  11. ATJSSDK.setLogDebug(true);
  12. var customMap = {
  13. "channel": umchannel
  14. };
  15. ATJSSDK.initCustomMap(customMap);
  16. // ATJSSDK.setPlacementCustomMap(customPlacementId, placementCustomMap);
  17. //替换------------------------------------------------------------------
  18. var placementCustomMap = {
  19. "placementCustomKey1": "placementCustomValue1",
  20. "placementCustomKey2": "placementCustomValue2"
  21. };
  22. ATJSSDK.setPlacementCustomMap(this.placementID(), placementCustomMap);
  23. //ATJSSDK.setGDPRLevel(ATJSSDK.NONPERSONALIZED);
  24. var GDPRLevel = ATJSSDK.getGDPRLevel();
  25. // ATJSSDK.printLog("Current GDPR Level :" + GDPRLevel);
  26. if (cc.sys.os === cc.sys.OS_IOS) {
  27. ATJSSDK.initSDK(appid, appsecret);
  28. } else if (cc.sys.os === cc.sys.OS_ANDROID) {
  29. ATJSSDK.initSDK(appid, appsecret);
  30. }
  31. ATJSSDK.getUserLocation(function (userLocation) {
  32. // ATJSSDK.printLog("getUserLocation callback userLocation :" + userLocation);
  33. if (userLocation === ATJSSDK.kATUserLocationInEU) {
  34. if (ATJSSDK.getGDPRLevel() === ATJSSDK.UNKNOWN) {
  35. ATJSSDK.showGDPRAuth();
  36. }
  37. }
  38. });
  39. },
  40. placementID() {
  41. return this.proxy.placementID();
  42. }
  43. });
  44. module.exports = ATSDKMgrJS;
  45. if (!cc["ATSDKMgrJS"]) {
  46. cc["ATSDKMgrJS"] = new ATSDKMgrJS();
  47. }