Просмотр исходного кода

Merge branch 'master' of http://git.mokasz.com/zouyong/mk_framework

zouyong 5 лет назад
Родитель
Сommit
f29f6c17c4
70 измененных файлов с 3486 добавлено и 67 удалено
  1. 2 1
      .gitignore
  2. 255 0
      mk_framework/assets/script/game/component/tween/FrameAnimation.ts
  3. 9 0
      mk_framework/assets/script/game/component/tween/FrameAnimation.ts.meta
  4. 61 0
      mk_framework/assets/script/game/component/tween/RopeSwung.ts
  5. 9 0
      mk_framework/assets/script/game/component/tween/RopeSwung.ts.meta
  6. 53 66
      mk_framework/assets/script/game/component/tween/UITween.ts
  7. 16 0
      mk_framework/assets/script/mk/MKSwitch.ts
  8. 9 0
      mk_framework/assets/script/mk/MKSwitch.ts.meta
  9. 12 0
      mk_framework/assets/script/mk/sdk/ad.meta
  10. 12 0
      mk_framework/assets/script/mk/sdk/ad/toppon.meta
  11. 12 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds.meta
  12. 186 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATBannerJSSDK.js
  13. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATBannerJSSDK.js.meta
  14. 146 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATInterstitialJSSDK.js
  15. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATInterstitialJSSDK.js.meta
  16. 125 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATJSSDK.js
  17. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATJSSDK.js.meta
  18. 197 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATNativeJSSDK.js
  19. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATNativeJSSDK.js.meta
  20. 138 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATRewardedVideoJSSDK.js
  21. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATRewardedVideoJSSDK.js.meta
  22. 12 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android.meta
  23. 46 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidBannerJS.js
  24. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidBannerJS.js.meta
  25. 31 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidInterstitialJS.js
  26. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidInterstitialJS.js.meta
  27. 43 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidJS.js
  28. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidJS.js.meta
  29. 31 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidNativeJS.js
  30. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidNativeJS.js.meta
  31. 31 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidRewardedVideoJS.js
  32. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidRewardedVideoJS.js.meta
  33. 12 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS.meta
  34. 45 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSBannerJS.js
  35. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSBannerJS.js.meta
  36. 36 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSInterstitialJS.js
  37. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSInterstitialJS.js.meta
  38. 52 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSJS.js
  39. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSJS.js.meta
  40. 30 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSNativeJS.js
  41. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSNativeJS.js.meta
  42. 36 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSRewardedVideoJS.js
  43. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSRewardedVideoJS.js.meta
  44. 12 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr.meta
  45. 39 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBanner.ts
  46. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBanner.ts.meta
  47. 156 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBannerJS.js
  48. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBannerJS.js.meta
  49. 36 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitial.ts
  50. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitial.ts.meta
  51. 175 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitialJS.js
  52. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitialJS.js.meta
  53. 66 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNative.ts
  54. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNative.ts.meta
  55. 222 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNativeJS.js
  56. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNativeJS.js.meta
  57. 164 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideo.ts
  58. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideo.ts.meta
  59. 143 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideoJS.js
  60. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideoJS.js.meta
  61. 93 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts
  62. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts.meta
  63. 59 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgrJS.js
  64. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgrJS.js.meta
  65. 8 0
      mk_framework/assets/script/mk/sdk/ad/toppon/zgSingleton.ts
  66. 9 0
      mk_framework/assets/script/mk/sdk/ad/toppon/zgSingleton.ts.meta
  67. 122 0
      mk_framework/assets/script/mk/system/AdSystem.ts
  68. 9 0
      mk_framework/assets/script/mk/system/AdSystem.ts.meta
  69. 292 0
      mk_framework/assets/script/mk/system/JsbSystem.ts
  70. 9 0
      mk_framework/assets/script/mk/system/JsbSystem.ts.meta

+ 2 - 1
.gitignore

@@ -3,4 +3,5 @@
 /mk_framework/temp
 .vscode
 /mk_framework/assets/scene/TestScene.fire
-/mk_framework/assets/scene/TestScene.fire.meta
+/mk_framework/assets/scene/TestScene.fire.meta
+/mk_framework/build

+ 255 - 0
mk_framework/assets/script/game/component/tween/FrameAnimation.ts

@@ -0,0 +1,255 @@
+const { ccclass, property, executeInEditMode, playOnFocus } = cc._decorator;
+
+/**
+ * 帧动画播放组件
+ * ### 开放的接口;
+ * #### play 播放
+ * #### stop 停止播放
+ * #### gotoAndPlay 跳转到某帧并播放
+ * #### gotoAndStop 跳转到某帧并停止播放
+ * #### isPlayEnd 是否播放结束
+ * ### 开放的事件
+ * #### completeTimes 单次播完完成事件
+ * #### complete 全部次数完成事件
+ * @author 薛鸿潇
+ */
+@ccclass
+@executeInEditMode()
+@playOnFocus()
+export default class FrameAnimation extends cc.Component {
+
+    @property({ displayName: '精灵纹理', type: cc.SpriteFrame }) private images: cc.SpriteFrame[] = [];
+    @property({ displayName: '每帧间隔' }) private frameTime: number = 0.1;
+    @property({ displayName: '播放次数' }) private playTimes: number = 0;
+    @property({ displayName: "是否倒播", tooltip: "勾选,倒着播放,不钩,顺序播放" }) private reverse: boolean = false;
+    @property({ displayName: '自动播放' }) private autoPlayOnLoad: boolean = true;
+    @property({ displayName: "自动销毁", tooltip: '播完自动销毁' }) private autoDestroy: boolean = false;
+    @property({ displayName: "每帧回调", type: cc.Component.EventHandler }) onFrameCall: cc.Component.EventHandler = new cc.Component.EventHandler();
+    @property({ displayName: "结束回调", type: cc.Component.EventHandler }) onCompleteCall: cc.Component.EventHandler = new cc.Component.EventHandler();
+    /** 编辑器预览 */
+    private _edit_play: boolean = false;
+    @property({ displayName: '编辑器预览' })
+    get edit_play(): boolean {
+        if (this._edit_play && !this.edit_playing) {
+            this.edit_playing = true;
+            this.play();
+        }
+        this.running = this._edit_play;
+        return this._edit_play;
+    }
+    set edit_play(v: boolean) {
+        this._edit_play = v;
+    }
+    /** 编辑器是否正在播放 */
+    private edit_playing = false;
+
+    /** 动画帧数量 */
+    public frameNum: number = 0;
+    /** 当前帧下标 */
+    public frameIndex: number = 0;
+    /** 下一帧下标 */
+    public nextFrameIndex: number = 0;
+    /** 是否允许播放 */
+    public running: boolean = true;
+    /** 精灵组件 */
+    private comp_spr: cc.Sprite;
+    /** 播放下一帧的倒计时 */
+    private time: number = 0;
+    /** 每完成一轮的回调 */
+    public completeTimesCallback: Function;
+    /** 全部播完回调 */
+    public completeCallback: Function;
+    /** 每帧回调 */
+    public frameCallback: Function;
+    /** 当前轮播次数 */
+    private currentTimes: number = 0;
+
+    onLoad() {
+        this.comp_spr = this.getComponent(cc.Sprite);
+    }
+
+    start() {
+        if (this.images.length != 0) {
+            this.frameNum = this.images.length;
+        }
+
+        if (this.reverse) {
+            this.frameIndex = this.frameNum - 1;
+            this.nextFrameIndex = this.frameNum - 1;
+        }
+        if (CC_EDITOR) {
+            this.running = this.edit_playing;
+        } else {
+            this.running = this.autoPlayOnLoad;
+        }
+
+    }
+    /**
+     * 更新动画帧
+     * @param dt 
+     */
+    update(dt) {
+
+        if (!this.running) return;
+        if (this.images.length == 0) return;
+        if (this.playTimes != 0 && this.currentTimes > this.playTimes) {
+            this.running = false;
+            return;
+        }
+
+        this.time -= dt;
+        if (this.time <= 0) {
+            this.time = this.frameTime;
+            if (!this.reverse) {
+                this.frameIndex = this.nextFrameIndex % this.frameNum;
+                this.nextFrameIndex = this.frameIndex + 1;
+            } else {
+                this.frameIndex = (this.nextFrameIndex + this.frameNum) % this.frameNum;
+                this.nextFrameIndex = this.frameIndex - 1;
+            }
+            this.playing();
+            if (this.frameIndex == 0) {
+                this.playEnd();
+            }
+        }
+    }
+    /** 播放中 */
+    private playing() {
+        this.comp_spr.spriteFrame = this.images[this.frameIndex];
+
+        if (this.comp_spr.spriteFrame) {
+            var rect: cc.Rect = this.comp_spr.spriteFrame.getRect();
+            this.node.width = rect.width;
+            this.node.height = rect.height;
+        }
+        // 事件回调
+        this.onFrameCall.emit([]);
+        if (this.frameCallback != null) {
+            this.frameCallback(this.frameIndex);
+        }
+    }
+    /** 播放结束 */
+    private playEnd() {
+        this.currentTimes++;
+
+        // 完成一次
+        this.node.emit("completeTimes", this.currentTimes);
+        if (this.completeTimesCallback != null) {
+            this.completeTimesCallback(this.currentTimes);
+        }
+
+        // 全部完成
+        if (this.playTimes != 0 && this.currentTimes > this.playTimes) {
+            // 事件回调
+            this.node.emit("complete");
+            this.onCompleteCall.emit([]);
+            if (this.completeCallback != null) {
+                this.completeCallback();
+            }
+
+            if (this.autoDestroy && !CC_EDITOR) {
+                this.node.destroy();
+            }
+            // this.edit_play = false;
+            this._edit_play = false;
+            this.edit_playing = false;
+        }
+    }
+
+    /**
+     * 开始播放
+     * @param frameCallback 
+     * @param completeCallback 
+     */
+    public play(frameCallback: Function = null, completeCallback: Function = null) {
+
+        this.frameCallback = frameCallback;
+        this.completeCallback = completeCallback;
+
+        this.running = true;
+        this.frameIndex = 0;
+        this.currentTimes = 0;
+
+        this.time = this.frameTime;
+
+        if (this.images.length != 0) {
+            this.frameNum = this.images.length;
+
+            if (this.reverse) {
+                this.frameIndex = this.frameNum - 1;
+                this.nextFrameIndex = this.frameNum - 1;
+            }
+
+        }
+
+        if (!this.comp_spr) {
+            this.comp_spr = this.getComponent(cc.Sprite);
+        }
+
+        if (this.comp_spr)
+            this.comp_spr.spriteFrame = this.images[0];
+
+
+        if (this.comp_spr.spriteFrame) {
+            var rect: cc.Rect = this.comp_spr.spriteFrame.getRect();
+            this.node.width = rect.width;
+            this.node.height = rect.height;
+        }
+
+    }
+
+    /**
+     * 跳转到某帧并开始播放
+     * @param frameIndex 帧下标
+     */
+    public gotoAndPlay(frameIndex: number) {
+        if (!this.comp_spr) {
+            this.comp_spr = this.getComponent(cc.Sprite);
+        }
+
+        this.running = true;
+        this.frameIndex = frameIndex;
+        this.nextFrameIndex = frameIndex;
+        this.currentTimes = 0;
+    }
+
+    /** 停止 */
+    public stop() {
+        this.running = false;
+    }
+
+    /**
+     * 跳转到某帧并停止播放
+     * @param frameIndex 帧下标
+     */
+    public gotoAndStop(frameIndex: number) {
+        this.frameIndex = frameIndex;
+
+        if (this.frameIndex < 0)
+            this.frameIndex = 0;
+
+        if (this.frameIndex > this.images.length - 1)
+            this.frameIndex = this.images.length - 1;
+
+        if (!this.comp_spr) {
+            this.comp_spr = this.getComponent(cc.Sprite);
+        }
+
+        this.comp_spr.spriteFrame = this.images[this.frameIndex];
+
+        if (this.comp_spr.spriteFrame) {
+            var rect: cc.Rect = this.comp_spr.spriteFrame.getRect();
+            this.node.width = rect.width;
+            this.node.height = rect.height;
+        }
+
+        this.running = false;
+    }
+    /**
+     * 是否播放结束
+     * @returns 
+     */
+    public isPlayEnd(): boolean {
+        return this.frameIndex == this.frameNum;
+    }
+}

+ 9 - 0
mk_framework/assets/script/game/component/tween/FrameAnimation.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "efc32dc9-6839-4b3d-8821-f47b199f43cb",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 61 - 0
mk_framework/assets/script/game/component/tween/RopeSwung.ts

@@ -0,0 +1,61 @@
+
+const { ccclass, property, executeInEditMode, playOnFocus } = cc._decorator;
+/**
+ * 绳索摆动效果
+ * @author 薛鸿潇
+ */
+@ccclass
+@executeInEditMode()
+@playOnFocus()
+export default class RopeSwung extends cc.Component {
+
+    @property({ displayName: '摆动角度' }) private angle: number = 15;
+    @property({ displayName: '摆动时间', tooltip: '摆动1/4距离消耗的时间' }) private time: number = 1;
+
+    /** 编辑器预览 */
+    private _edit_play: boolean = false;
+    @property({ displayName: '编辑器预览' })
+    get edit_play(): boolean {
+        if (this._edit_play && !this.edit_playing) this.initShakeSlow();
+        this.edit_playing = this._edit_play;
+        return this._edit_play;
+    }
+    set edit_play(v: boolean) {
+        this._edit_play = v;
+        if (!v) this.stop();
+    }
+    /** 编辑器是否正在播放 */
+    private edit_playing = false;
+
+    onLoad() {
+
+    }
+
+    start() {
+        if (CC_EDITOR) {
+            if (this.edit_play) {
+                this.initShakeSlow()
+            }
+        } else {
+            this.initShakeSlow()
+        }
+    }
+    /**
+     * 缓慢摇动
+     * @param node 动画节点
+     */
+    private initShakeSlow() {
+        let node = this.node;
+        let rotate1 = cc.tween().to(this.time, { angle: { value: this.angle, easing: 'sineOut' } })
+        let rotate2 = cc.tween().to(this.time, { angle: { value: 0, easing: 'sineIn' } })
+        let rotate3 = cc.tween().to(this.time, { angle: { value: -this.angle, easing: 'sineOut' } })
+        let rotate4 = cc.tween().to(this.time, { angle: { value: 0, easing: 'sineIn' } })
+        let sequence1 = cc.tween().sequence(rotate1, rotate2, rotate3, rotate4)
+        cc.tween(node).then(sequence1).repeatForever().start();
+    }
+    /** 停止动画 */
+    private stop() {
+        this.node.stopAllActions();
+    }
+
+}

+ 9 - 0
mk_framework/assets/script/game/component/tween/RopeSwung.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "93753008-b78e-47c2-8a94-f28e9579ed30",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 53 - 66
mk_framework/assets/script/game/component/tween/UITween.ts

@@ -3,93 +3,78 @@ import { TweenEasing } from "./TweenEasing";
 const { ccclass, property, executeInEditMode, playOnFocus } = cc._decorator;
 /**
  * 缓动数据
- * @author 
+ * @author 薛鸿潇
  */
 @ccclass("PropsData")
 export class PropsData {
-    @property({ tooltip: "坐标" })
-    public position: cc.Vec2 = cc.Vec2.ZERO;
-    @property({ tooltip: "旋转" })
-    public angle: number = 0;
-    @property({ tooltip: "缩放" })
-    public scale: number = 1;
+    @property({ displayName: "坐标" }) public position: cc.Vec2 = cc.Vec2.ZERO;
+    @property({ displayName: "旋转" }) public angle: number = 0;
+    @property({ displayName: "缩放" }) public scale: number = 1;
 }
 /**
  * 缓动数据
- * @author 
+ * @author 薛鸿潇
  */
-@ccclass//("TweenData")
+@ccclass("TweenData")
 export class TweenData {
-    // @property({ tooltip: "属性数据", type: PropsData })
-    // public propsData: PropsData = new PropsData();
-    @property({ tooltip: "坐标" })
-    public position: cc.Vec2 = cc.Vec2.ZERO;
-    @property({ tooltip: "旋转" })
-    public angle: number = 0;
-    @property({ tooltip: "缩放" })
-    public scale: number = 1;
-
-    @property({ tooltip: "持续时间,单位为秒" })
-    public duration: number = 0.3;
-    @property({ tooltip: "延迟时间,单位为秒" })
-    public delay: number = 0;
-    @property({ tooltip: "是否为差值" })
-    public isOffset: boolean = false;
-    @property({ tooltip: "当缓动动作完成时触发", type: cc.Component.EventHandler })
-    public onComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
-    @property({ tooltip: "当缓动动作启动时触发", type: cc.Component.EventHandler })
-    public onStart: cc.Component.EventHandler = new cc.Component.EventHandler();
-    @property({ tooltip: "当缓动动作更新时触发", type: cc.Component.EventHandler })
-    public onUpdate: cc.Component.EventHandler = new cc.Component.EventHandler();
+    @property({ displayName: "属性数据", type: PropsData }) public propsData: PropsData = new PropsData();
+    @property({ displayName: "持续时间", tooltip: '单位:秒' }) public duration: number = 0.3;
+    @property({ displayName: "延迟时间", tooltip: '单位:秒' }) public delay: number = 0;
+    @property({ displayName: "是否为差值" }) public isOffset: boolean = false;
+    @property({ displayName: '完成回调', tooltip: "当缓动动作完成时触发", type: cc.Component.EventHandler }) public onComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
+    @property({ displayName: '开始回调', tooltip: "当缓动动作启动时触发", type: cc.Component.EventHandler }) public onStart: cc.Component.EventHandler = new cc.Component.EventHandler();
+    @property({ displayName: '过程回调', tooltip: "当缓动动作更新时触发", type: cc.Component.EventHandler }) public onUpdate: cc.Component.EventHandler = new cc.Component.EventHandler();
 }
 /**
  * 缓动组件,目前只支持节点的三个基础属性
- * 目前改动类后会导致编辑器内的属性记录丢失,请不要使用 
- * @author 
+ * @author 薛鸿潇
  */
-@ccclass//('UITween')
+@ccclass
 @executeInEditMode()
 @playOnFocus()
 export class UITween extends cc.Component {
-    @property
-    private err = '属性记录会丢失,请不要使用'
-    @property({ tooltip: "节点初始属性", type: PropsData })
-    public fromData: PropsData = new PropsData();
-    @property({ tooltip: "节点目标属性", type: TweenData, serializable: false })//, serializable: false
-    public targetData: TweenData[] = [];//new TweenData()
-    @property({ tooltip: "要播放缓动动画的目标,不填则是当前节点", type: cc.Node })
-    public target: cc.Node = null;
-    @property({ tooltip: "缓动效果", type: cc.Enum(TweenEasing) })
-    public tweenEasing: TweenEasing = TweenEasing.linear;
-    @property({ tooltip: "执行次数,为0则一直重复执行" })
-    public repeat: number = 1;
-    @property({ tooltip: "单次缓动序列执行完毕时触发", type: cc.Component.EventHandler })
-    public onOneRepeatComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
-    @property({ tooltip: "是否在缓动组件运行时自动播放缓动动画" })
-    public playOnLoad: boolean = false;
+    @property({ displayName: "节点初始属性", type: PropsData }) public fromData: PropsData = new PropsData();
+    @property({ displayName: "节点目标属性", type: TweenData }) public targetData: TweenData[] = [];
+    @property({ displayName: '缓动节点', tooltip: "要播放缓动动画的目标,不填则是当前节点", type: cc.Node }) public target: cc.Node = null;
+    @property({ displayName: "缓动效果", type: cc.Enum(TweenEasing) }) public tweenEasing: TweenEasing = TweenEasing.linear;
+    @property({ displayName: '执行次数', tooltip: "为0则一直重复执行" }) public repeat: number = 1;
+    @property({ displayName: "单次完成回调", tooltip: '单次缓动序列执行完毕时触发', type: cc.Component.EventHandler }) public onOneRepeatComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
+    @property({ displayName: "自动播放" }) public playOnLoad: boolean = false;
+
+    private _edit_play: boolean = false;
     @property({ displayName: "编辑器预览" })
-    public _playOnEdit: boolean = false;
-    @property({ displayName: "编辑器预览" })//, editorOnly: true
-    get playOnEdit(): boolean {
-        if (this._playOnEdit) {
-            this.play()
+    get edit_play(): boolean {
+        if (this._edit_play && !this.edit_playing) {
+            this.edit_playing = true;
+            this.play();
         }
-        return this._playOnEdit;
+        return this._edit_play;
     }
-    set playOnEdit(v: boolean) {
-        this._playOnEdit = v;
+    set edit_play(v: boolean) {
+        this._edit_play = v;
+        if (this.target && v) {
+            this.target.stopAllActions();
+        }
+        if (!v) this.edit_playing = false;
     }
+    /** 编辑器是否正在播放 */
+    private edit_playing = false;
+
     public start() {
-        // if (CC_EDITOR && !this._playOnEdit) return;
         !this.target && (this.target = this.node);
         this.target = this.target || this.node;
         this.currentRepeat = this.repeat;
-        this.playOnLoad && this.play();
+        if (CC_EDITOR) {
+            this._edit_play && this.play();
+        } else {
+            this.playOnLoad && this.play();
+        }
     }
     private t: cc.Tween<any>;
+    /** 剩余播放次数 */
     private currentRepeat: number;
     public play() {
-        if (CC_EDITOR && !this._playOnEdit) return;
+        if (CC_EDITOR && !this.edit_playing) return;
         if (this.repeat == 0) {
             this.t = cc.tween(this.target);
             this.readyPlay();
@@ -121,14 +106,14 @@ export class UITween extends cc.Component {
                     this.t = this.t.delay(targetData.delay);
                 }
                 let toData = {
-                    position: targetData.position,
-                    scale: targetData.scale,
-                    angle: targetData.angle
+                    position: targetData.propsData.position,
+                    scale: targetData.propsData.scale,
+                    angle: targetData.propsData.angle
                 }
                 if (targetData.isOffset) {
-                    toData.position = this.node.getPosition().add(targetData.position);
-                    toData.scale = this.node.scale + targetData.scale;
-                    toData.angle = this.node.angle + targetData.angle;
+                    toData.position = this.node.getPosition().add(targetData.propsData.position);
+                    toData.scale = this.node.scale + targetData.propsData.scale;
+                    toData.angle = this.node.angle + targetData.propsData.angle;
                 }
                 this.t = this.t.to(
                     targetData.duration,
@@ -137,6 +122,8 @@ export class UITween extends cc.Component {
                         easing: TweenEasing[this.tweenEasing] as any,
                         onComplete: (target: cc.Node) => {
                             targetData.onComplete && targetData.onComplete.emit([target]);
+                            this.edit_playing = false;
+                            this._edit_play = false;
                         },
                         onStart: (target: cc.Node) => { targetData.onStart && targetData.onStart.emit([target]) },
                         onUpdate: (target: cc.Node, ratio: number) => { targetData.onUpdate && targetData.onUpdate.emit([target, ratio]) }

+ 16 - 0
mk_framework/assets/script/mk/MKSwitch.ts

@@ -0,0 +1,16 @@
+const { ccclass, property } = cc._decorator;
+@ccclass
+/**
+ * 框架开关
+ */
+export default class MKSwitch extends cc.Component {
+
+    @property({
+        displayName: "是否显示广告",
+        tooltip: "",
+        serializable: true,
+    })
+    public ifShowAd: boolean = false;
+
+
+}

+ 9 - 0
mk_framework/assets/script/mk/MKSwitch.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "a0fd9818-5e16-4c27-8e80-aea623db0072",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "a480255d-9cd6-465b-8fe9-dfeeaabcb4fc",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad/toppon.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "526bf647-bf52-434c-a02a-b5a63b812a40",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "020d8c05-55c4-4e26-8d68-4a1eb374b1a0",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 186 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATBannerJSSDK.js

@@ -0,0 +1,186 @@
+
+var ATAndroidBannerJS = require("./Android/ATAndroidBannerJS");
+var ATiOSBannerJS = require("./iOS/ATiOSBannerJS");
+
+var initPlatformBridge = function() {  
+    if (cc.sys.os === cc.sys.OS_IOS) {           
+        return ATiOSBannerJS;
+    } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+        return ATAndroidBannerJS;
+    }
+};
+
+var platformBridge = initPlatformBridge();
+
+
+var ATBannerSDK = ATBannerSDK || {
+    kATBannerAdLoadingExtraBannerAdSizeStruct: "banner_ad_size_struct",
+	kATBannerAdShowingPositionTop : "top",
+    kATBannerAdShowingPositionBottom : "bottom",
+	
+	kATBannerAdInlineAdaptiveWidth : "inline_adaptive_width",
+	kATBannerAdInlineAdaptiveOrientation : "inline_adaptive_orientation",
+	kATBannerAdInlineAdaptiveOrientationCurrent : 0,
+	kATBannerAdInlineAdaptiveOrientationPortrait : 1,
+	kATBannerAdInlineAdaptiveOrientationLandscape : 2,
+	
+
+    ATBannerListener : {
+        developerCallback : null,
+
+        onBannerAdLoaded : function (placementId) {
+            if(this.developerCallback != null && this.developerCallback.onBannerAdLoaded != null && undefined != this.developerCallback.onBannerAdLoaded) {
+                this.developerCallback.onBannerAdLoaded(placementId);
+            }
+        },
+
+        onBannerAdLoadFail : function(placementId, errorInfo) {
+          if(this.developerCallback != null && this.developerCallback.onBannerAdLoadFail != null && undefined != this.developerCallback.onBannerAdLoadFail) {
+                this.developerCallback.onBannerAdLoadFail(placementId, errorInfo);
+            }
+        },
+
+        onBannerAdShow : function(placementId, callbackInfo) {
+           if(this.developerCallback != null && this.developerCallback.onBannerAdShow != null && undefined != this.developerCallback.onBannerAdShow) {
+                this.developerCallback.onBannerAdShow(placementId, callbackInfo);
+            }
+        },
+
+        onBannerAdClick : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onBannerAdClick != null && undefined != this.developerCallback.onBannerAdClick) {
+                this.developerCallback.onBannerAdClick(placementId, callbackInfo);
+            }
+        },
+
+        onBannerAdAutoRefresh : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onBannerAdAutoRefresh != null && undefined != this.developerCallback.onBannerAdAutoRefresh) {
+                this.developerCallback.onBannerAdAutoRefresh(placementId, callbackInfo);
+            }
+        },
+
+        onBannerAdAutoRefreshFail : function(placementId, errorInfo) {
+            if(this.developerCallback != null && this.developerCallback.onBannerAdAutoRefreshFail != null && undefined != this.developerCallback.onBannerAdAutoRefreshFail) {
+                this.developerCallback.onBannerAdAutoRefreshFail(placementId, errorInfo);
+            }
+        },
+
+        onBannerAdCloseButtonTapped : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onBannerAdCloseButtonTapped != null && undefined != this.developerCallback.onBannerAdCloseButtonTapped) {
+                this.developerCallback.onBannerAdCloseButtonTapped(placementId, callbackInfo);
+            }
+        }
+        
+    },
+    
+    loadBanner : function(placementId, settings={}) {
+
+        if (undefined != platformBridge && platformBridge != null) {
+			
+			if (settings.hasOwnProperty(ATBannerSDK.kATBannerAdLoadingExtraBannerAdSizeStruct)) {
+				var loadAdSize = settings[ATBannerSDK.kATBannerAdLoadingExtraBannerAdSizeStruct];
+				settings["width"] = loadAdSize["width"];
+				settings["height"] = loadAdSize["height"];
+			}
+			
+            platformBridge.loadBanner(placementId, JSON.stringify(settings));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setAdListener : function(listener) {
+        var eventJSON = {};
+        eventJSON[LoadedCallbackKey]= "ATBannerJSSDK.ATBannerListener.onBannerAdLoaded",
+        eventJSON[LoadFailCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdLoadFail",
+        eventJSON[CloseCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdCloseButtonTapped",
+        eventJSON[ClickCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdClick",
+        eventJSON[ShowCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdShow",
+        eventJSON[RefreshCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdAutoRefresh",
+        eventJSON[RefreshFailCallbackKey]=  "ATBannerJSSDK.ATBannerListener.onBannerAdAutoRefreshFail"
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.setAdListener(JSON.stringify(eventJSON));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+
+        this.ATBannerListener.developerCallback = listener;
+    },
+
+    hasAdReady : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+            return platformBridge.hasAdReady(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+        return false;
+    },
+
+    showAdInPosition : function(placementId, position) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAdInPosition(placementId, position);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    showAdInRectangle : function(placementId, showAdRect) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAdInRectangle(placementId, JSON.stringify(showAdRect));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+
+    removeAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.removeAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    reShowAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.reShowAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    hideAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.hideAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    createLoadAdSize : function(width, height) {
+    	var loadAdSize = {};
+    	loadAdSize["width"] = width;
+    	loadAdSize["height"] = height;
+    	return loadAdSize;
+    },
+
+    createShowAdRect : function(x, y, width, height) {
+    	var adRect = {};
+    	adRect["x"] = x;
+    	adRect["y"] = y;
+    	adRect["width"] = width;
+    	adRect["height"] = height;
+    	return adRect;
+    }
+
+  
+};
+
+const LoadedCallbackKey = "BannerLoaded";
+const LoadFailCallbackKey = "BannerLoadFail";
+const CloseCallbackKey = "BannerCloseButtonTapped";
+const ClickCallbackKey = "BannerClick";
+const ShowCallbackKey = "BannerShow";
+const RefreshCallbackKey = "BannerRefresh";
+const RefreshFailCallbackKey = "BannerRefreshFail";
+
+window.ATBannerJSSDK = ATBannerSDK;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATBannerJSSDK.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "fed33789-cbf5-4a0f-a6d2-261e027a3735",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 146 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATInterstitialJSSDK.js

@@ -0,0 +1,146 @@
+var ATiOSInterstitialJS = require("./iOS/ATiOSInterstitialJS");
+var ATAndroidInterstitialJS = require("./Android/ATAndroidInterstitialJS");
+
+var initPlatformBridge = function() {  
+    if (cc.sys.os === cc.sys.OS_IOS) {           
+        return ATiOSInterstitialJS;
+    } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+        return ATAndroidInterstitialJS;
+    }
+};
+
+var platformBridge = initPlatformBridge();
+
+
+var ATInterstitialSDK = ATInterstitialSDK || {
+
+	UseRewardedVideoAsInterstitial: "UseRewardedVideoAsInterstitial",
+
+    ATInterstitialListener : {
+        developerCallback : null,
+
+        onInterstitialAdLoaded : function (placementId) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdLoaded != null && undefined != this.developerCallback.onInterstitialAdLoaded) {
+                this.developerCallback.onInterstitialAdLoaded(placementId);
+            }
+        },
+
+        onInterstitialAdLoadFail : function(placementId, errorInfo) {
+          if(this.developerCallback != null && this.developerCallback.onInterstitialAdLoadFail != null && undefined != this.developerCallback.onInterstitialAdLoadFail) {
+                this.developerCallback.onInterstitialAdLoadFail(placementId, errorInfo);
+            }
+        },
+
+        onInterstitialAdShow : function(placementId, callbackInfo) {
+           if(this.developerCallback != null && this.developerCallback.onInterstitialAdShow != null && undefined != this.developerCallback.onInterstitialAdShow) {
+                this.developerCallback.onInterstitialAdShow(placementId, callbackInfo);
+            }
+        },
+
+        onInterstitialAdStartPlayingVideo : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdStartPlayingVideo != null && undefined != this.developerCallback.onInterstitialAdStartPlayingVideo) {
+                this.developerCallback.onInterstitialAdStartPlayingVideo(placementId, callbackInfo);
+            }
+        },
+
+        onInterstitialAdEndPlayingVideo : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdEndPlayingVideo != null && undefined != this.developerCallback.onInterstitialAdEndPlayingVideo) {
+                this.developerCallback.onInterstitialAdEndPlayingVideo(placementId, callbackInfo);
+            }
+        },
+
+        onInterstitialAdFailedToPlayVideo : function(placementId, errorInfo) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToPlayVideo != null && undefined != this.developerCallback.onInterstitialAdFailedToPlayVideo) {
+                this.developerCallback.onInterstitialAdFailedToPlayVideo(placementId, errorInfo);
+            }
+        },
+
+        onInterstitialAdFailedToShow : function(placementId) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToShow != null && undefined != this.developerCallback.onInterstitialAdFailedToShow) {
+                this.developerCallback.onInterstitialAdFailedToShow(placementId);
+            }
+        },
+
+        onInterstitialAdClose : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdClose != null && undefined != this.developerCallback.onInterstitialAdClose) {
+                this.developerCallback.onInterstitialAdClose(placementId, callbackInfo);
+            }
+        },
+
+        onInterstitialAdClick : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onInterstitialAdClick != null && undefined != this.developerCallback.onInterstitialAdClick) {
+                this.developerCallback.onInterstitialAdClick(placementId, callbackInfo);
+            }
+        }
+        
+    },
+    
+	loadInterstitial : function(placementId, settings={}) {
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.loadInterstitial(placementId, JSON.stringify(settings));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setAdListener : function(listener) {
+        var eventJSON = {};
+        eventJSON[LoadedCallbackKey]="ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdLoaded",
+        eventJSON[LoadFailCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdLoadFail",
+        eventJSON[PlayStartCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdStartPlayingVideo",
+        eventJSON[PlayEndCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdEndPlayingVideo",
+        eventJSON[PlayFailCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdFailedToPlayVideo",
+        eventJSON[CloseCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdClose",
+        eventJSON[ClickCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdClick",
+        eventJSON[ShowCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdShow",
+        eventJSON[ShowFailCallbackKey]= "ATInterstitialJSSDK.ATInterstitialListener.onInterstitialAdFailedToShow"
+
+        if (undefined != platformBridge && platformBridge != null) {
+             platformBridge.setAdListener(JSON.stringify(eventJSON));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+
+        this.ATInterstitialListener.developerCallback = listener;
+    },
+
+    hasAdReady : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+            return platformBridge.hasAdReady(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+        return false;
+    },
+
+    showAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    showAdInScenario : function(placementId, scenario="") {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAdInScenario(placementId, scenario);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    } 
+  
+  
+};
+
+const LoadedCallbackKey = "InterstitialLoaded";
+const LoadFailCallbackKey = "InterstitialLoadFail";
+const PlayStartCallbackKey = "InterstitialPlayStart";
+const PlayEndCallbackKey = "InterstitialPlayEnd";
+const PlayFailCallbackKey = "InterstitialPlayFail";
+const CloseCallbackKey = "InterstitialClose";
+const ClickCallbackKey = "InterstitialClick";
+const ShowCallbackKey = "InterstitialAdShow";
+const ShowFailCallbackKey = "InterstitialAdShowFail";
+
+window.ATInterstitialJSSDK = ATInterstitialSDK;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATInterstitialJSSDK.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "778c3334-b837-4b64-a094-d62c069fa4fa",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 125 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATJSSDK.js

@@ -0,0 +1,125 @@
+
+var ATAndroidJS = require("./Android/ATAndroidJS");
+var ATiOSJS = require("./iOS/ATiOSJS");
+var isDebugLog = false;
+
+var initPlatformBridge = function() {  
+    if (cc.sys.os === cc.sys.OS_IOS) {           
+        return ATiOSJS;
+    } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+        return ATAndroidJS;
+    }
+};
+
+var platformBridge = initPlatformBridge();
+
+
+var ATSDK = ATSDK || {
+
+    kATUserLocationUnknown : 0,
+    kATUserLocationInEU : 1,
+    kATUserLocationOutOfEU : 2,
+
+
+    PERSONALIZED : 0,
+    NONPERSONALIZED :1,
+    UNKNOWN : 2,
+
+    ATSDKListener : {
+        userLocationCallback : null,
+
+        getUserLocationCallback : function(userLocation) {
+            if(undefined != this.userLocationCallback && this.userLocationCallback != null ){
+                this.userLocationCallback(userLocation);
+            }
+        }
+    },
+    
+    initSDK : function(appId, appKey) {
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.initSDK(appId, appKey);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    initCustomMap : function(customMap) {
+        if (undefined != platformBridge && platformBridge != null) {
+            if(undefined != customMap && customMap != null) {
+                platformBridge.initCustomMap(JSON.stringify(customMap));
+            }
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setPlacementCustomMap : function(placmentId, customMap) {
+        if (undefined != platformBridge && platformBridge != null) {
+            if(undefined != customMap && customMap != null) {
+                 platformBridge.setPlacementCustomMap(placmentId, JSON.stringify(customMap));
+            }
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setGDPRLevel : function(level) {
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.setGDPRLevel(level);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    getGDPRLevel : function() {
+        if (undefined != platformBridge && platformBridge != null) {
+            return platformBridge.getGDPRLevel();
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+        return this.UNKNOWN;
+    },
+
+    getUserLocation : function(userLocationCallback) {
+        this.ATSDKListener.userLocationCallback = userLocationCallback;
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.getUserLocation(GetUserLocationJsCallback);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    showGDPRAuth : function () {
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.showGDPRAuth();
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setLogDebug : function (debug) {
+        isDebugLog = debug;
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.setLogDebug(debug);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    printLog : function(msg) {
+        if (undefined != msg && null != msg && isDebugLog && platformBridge != null ) {
+            if (undefined != platformBridge && platformBridge != null) {
+                platformBridge.printJsLog(msg); 
+            } else {
+                cc.log("You must run on Android or iOS.");
+            }
+                
+        }
+    }
+  
+};
+
+const GetUserLocationJsCallback = "ATJSSDK.ATSDKListener.getUserLocationCallback";
+
+window.ATJSSDK = ATSDK;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATJSSDK.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "bac5a0c3-c4dc-449f-aac7-d4df30e3a296",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 197 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATNativeJSSDK.js

@@ -0,0 +1,197 @@
+
+var ATAndroidNativeJS = require("./Android/ATAndroidNativeJS");
+var ATiOSNativeJS = require("./iOS/ATiOSNativeJS");
+var initPlatformBridge = function() {  
+    if (cc.sys.os === cc.sys.OS_IOS) {           
+        return ATiOSNativeJS;
+    } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+        return ATAndroidNativeJS;
+    }
+};
+
+var platformBridge = initPlatformBridge();
+
+
+var ATNativeSDK = ATNativeSDK || {   
+
+    ATNativeListener : {
+        developerCallback : null,
+
+        onNativeAdLoaded : function (placementId) {
+            if(this.developerCallback != null && this.developerCallback.onNativeAdLoaded != null && undefined != this.developerCallback.onNativeAdLoaded) {
+                this.developerCallback.onNativeAdLoaded(placementId);
+            }
+        },
+
+        onNativeAdLoadFail : function(placementId, errorInfo) {
+          if(this.developerCallback != null && this.developerCallback.onNativeAdLoadFail != null && undefined != this.developerCallback.onNativeAdLoadFail) {
+                this.developerCallback.onNativeAdLoadFail(placementId, errorInfo);
+            }
+        },
+
+        onNativeAdShow : function(placementId, callbackInfo) {
+           if(this.developerCallback != null && this.developerCallback.onNativeAdShow != null && undefined != this.developerCallback.onNativeAdShow) {
+                this.developerCallback.onNativeAdShow(placementId, callbackInfo);
+            }
+        },
+
+        onNativeAdClick : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onNativeAdClick != null && undefined != this.developerCallback.onNativeAdClick) {
+                this.developerCallback.onNativeAdClick(placementId, callbackInfo);
+            }
+        },
+
+        onNativeAdVideoStart : function(placementId) {
+            if(this.developerCallback != null && this.developerCallback.onNativeAdVideoStart != null && undefined != this.developerCallback.onNativeAdVideoStart) {
+                this.developerCallback.onNativeAdVideoStart(placementId,);
+            }
+        },
+
+        onNativeAdVideoEnd : function(placementId) {
+            if(this.developerCallback != null && this.developerCallback.onNativeAdVideoEnd != null && undefined !=this.developerCallback.onNativeAdVideoEnd) {
+                this.developerCallback.onNativeAdVideoEnd(placementId);
+            }
+        },
+
+        onNativeAdCloseButtonTapped : function(placementId, callbackInfo) {
+            if(this.developerCallback != null && this.developerCallback.onNativeAdCloseButtonTapped != null && undefined != this.developerCallback.onNativeAdCloseButtonTapped) {
+                this.developerCallback.onNativeAdCloseButtonTapped(placementId, callbackInfo);
+            }
+        }
+        
+    },
+    
+    loadNative : function(placementId, settings={}) {
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.loadNative(placementId, JSON.stringify(settings));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setAdListener : function(listener) {
+        var eventJSON = {};
+        eventJSON[LoadedCallbackKey]="ATNativeJSSDK.ATNativeListener.onNativeAdLoaded",
+        eventJSON[LoadFailCallbackKey]= "ATNativeJSSDK.ATNativeListener.onNativeAdLoadFail",
+        eventJSON[CloseCallbackKey]="ATNativeJSSDK.ATNativeListener.onNativeAdCloseButtonTapped",
+        eventJSON[ClickCallbackKey]= "ATNativeJSSDK.ATNativeListener.onNativeAdClick",
+        eventJSON[ShowCallbackKey]= "ATNativeJSSDK.ATNativeListener.onNativeAdShow",
+        eventJSON[VideoStartKey]= "ATNativeJSSDK.ATNativeListener.onNativeAdVideoStart",
+        eventJSON[VideoEndKey]= "ATNativeJSSDK.ATNativeListener.onNativeAdVideoEnd"
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.setAdListener(JSON.stringify(eventJSON));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+
+        this.ATNativeListener.developerCallback = listener;
+    },
+
+    hasAdReady : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+            return platformBridge.hasAdReady(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+        return false;
+    },
+
+    showAd : function(placementId, adViewProperty) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAd(placementId, JSON.stringify(adViewProperty.getAdViewProperty()));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    removeAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.removeAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    createLoadAdSize : function(width, height) {
+        var loadAdSize = {};
+        loadAdSize["width"] = width;
+        loadAdSize["height"] = height;
+        return loadAdSize;
+    },
+
+    AdViewProperty : cc.Class({
+
+        parent : null,
+        appIcon : null,
+        mainImage: null,
+        title:null,
+        desc:null,
+        adLogo:null,
+        cta:null,
+        rating:null,
+
+        createItemViewProperty: function(x, y ,width ,height ,backgroundColor ,textColor ,textSize) {
+            var itemProperty = {};
+            itemProperty["x"] = x;
+            itemProperty["y"] = y;
+            itemProperty["width"] = width;
+            itemProperty["height"] = height;
+            itemProperty["backgroundColor"] = backgroundColor;
+            itemProperty["textColor"] = textColor;
+            itemProperty["textSize"] = textSize;
+
+            return itemProperty;
+        },
+
+        getAdViewProperty: function() {
+            var nativeViewProperty = {};
+
+            if(this.parent != null){
+                nativeViewProperty["parent"] = this.parent; 
+            }
+            
+            if(this.appIcon != null){
+                nativeViewProperty["icon"] = this.appIcon;
+            }
+            
+            if(this.mainImage != null){
+                nativeViewProperty["mainImage"] = this.mainImage;
+            }
+           
+            if(this.title != null){
+                nativeViewProperty["title"] = this.title;
+            }
+           
+            if(this.desc != null){
+                nativeViewProperty["desc"] = this.desc;
+            }
+
+            if(this.adLogo != null){
+                nativeViewProperty["adLogo"] = this.adLogo;
+            }
+
+            if(this.cta != null){
+                nativeViewProperty["cta"] = this.cta;
+            }
+
+            if(this.rating != null){
+                nativeViewProperty["rating"] = this.rating;
+            }
+           
+            return nativeViewProperty;
+        }
+    })
+  
+};
+
+const LoadedCallbackKey = "NativeLoaded";
+const LoadFailCallbackKey = "NativeLoadFail";
+const CloseCallbackKey = "NativeCloseButtonTapped";
+const ClickCallbackKey = "NativeClick";
+const ShowCallbackKey = "NativeShow";
+const VideoStartKey = "NativeVideoStart";
+const VideoEndKey = "NativeVideoEnd";
+
+window.ATNativeJSSDK = ATNativeSDK;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATNativeJSSDK.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "39725c03-3818-4341-820c-e7f4fb70b5d9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 138 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATRewardedVideoJSSDK.js

@@ -0,0 +1,138 @@
+var ATAndroidRewardedVideoJS = require("./Android/ATAndroidRewardedVideoJS");
+var ATiOSRewardedVideoJS = require("./iOS/ATiOSRewardedVideoJS");
+
+var initPlatformBridge = function() {  
+    if (cc.sys.os === cc.sys.OS_IOS) {           
+        return ATiOSRewardedVideoJS;
+    } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+        return ATAndroidRewardedVideoJS;
+    }
+};
+
+var platformBridge = initPlatformBridge();
+
+
+var ATRewardedVideoSDK = ATRewardedVideoSDK || {
+    userIdKey: "userID",
+    userDataKey: "media_ext",
+
+    ATRewardedVideoListener : {
+        developerCallback : null,
+
+        onRewardedVideoAdLoaded : function (placementId) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdLoaded(" + placementId + ")");
+            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdLoaded != null && undefined != this.developerCallback.onRewardedVideoAdLoaded) {
+                this.developerCallback.onRewardedVideoAdLoaded(placementId);
+            }
+        },
+        onRewardedVideoAdFailed : function(placementId, errorInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdFailed(" + placementId + ", " + errorInfo + ")");
+          if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdFailed != null && undefined != this.developerCallback.onRewardedVideoAdFailed) {
+                this.developerCallback.onRewardedVideoAdFailed(placementId, errorInfo);
+            }
+        },
+        onRewardedVideoAdPlayStart : function(placementId, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayStart(" + placementId + ", " + callbackInfo + ")");
+           if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayStart != null && undefined != this.developerCallback.onRewardedVideoAdPlayStart) {
+                this.developerCallback.onRewardedVideoAdPlayStart(placementId, callbackInfo);
+            }
+        },
+        onRewardedVideoAdPlayEnd : function(placementId, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayEnd(" + placementId + ", " + callbackInfo + ")");
+            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayEnd != null && undefined != this.developerCallback.onRewardedVideoAdPlayEnd) {
+                this.developerCallback.onRewardedVideoAdPlayEnd(placementId, callbackInfo);
+            }
+        },
+        onRewardedVideoAdPlayFailed : function(placementId, errorInfo, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayFailed(" + placementId + ", " + callbackInfo + ")");
+            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayFailed != null && undefined != this.developerCallback.onRewardedVideoAdPlayFailed) {
+                this.developerCallback.onRewardedVideoAdPlayFailed(placementId, errorInfo, callbackInfo);
+            }
+        },
+        onRewardedVideoAdClosed : function(placementId, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdClosed(" + placementId + ", " + callbackInfo + ")");
+            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdClosed != null && undefined != this.developerCallback.onRewardedVideoAdClosed) {
+                this.developerCallback.onRewardedVideoAdClosed(placementId, callbackInfo);
+            }
+        },
+        onRewardedVideoAdPlayClicked : function(placementId, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayClicked(" + placementId + ", " + callbackInfo + ")");
+            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayClicked != null && undefined != this.developerCallback.onRewardedVideoAdPlayClicked) {
+                this.developerCallback.onRewardedVideoAdPlayClicked(placementId, callbackInfo);
+            }
+        },
+        onReward : function(placementId, callbackInfo) {
+            ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onReward(" + placementId + ", " + callbackInfo + ")");
+            if(this.developerCallback != null && this.developerCallback.onReward != null && undefined != this.developerCallback.onReward) {
+                this.developerCallback.onReward(placementId, callbackInfo);
+            }
+        }
+    },
+    
+    loadRewardedVideo : function(placementId, settings={}) {
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.loadRewardedVideo(placementId, JSON.stringify(settings));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    setAdListener : function(listener) {
+        var eventJSON = {};
+        eventJSON[LoadedCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdLoaded",
+        eventJSON[LoadFailCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdFailed",
+        eventJSON[PlayStartCallbackKey]=  "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayStart",
+        eventJSON[PlayEndCallbackKey]=  "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayEnd",
+        eventJSON[PlayFailCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayFailed",
+        eventJSON[CloseCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdClosed",
+        eventJSON[ClickCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayClicked",
+        eventJSON[RewardCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onReward"
+
+        if (undefined != platformBridge && platformBridge != null) {
+            platformBridge.setAdListener(JSON.stringify(eventJSON));
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+
+        this.ATRewardedVideoListener.developerCallback = listener;
+    },
+
+    hasAdReady : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+            return platformBridge.hasAdReady(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+        return false;
+    },
+
+    showAd : function(placementId) {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAd(placementId);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    },
+
+    showAdInScenario : function(placementId, scenario="") {
+        if (undefined != platformBridge && platformBridge != null) {
+           platformBridge.showAdInScenario(placementId, scenario);
+        } else {
+            cc.log("You must run on Android or iOS.");
+        }
+    } 
+  
+};
+
+const LoadedCallbackKey = "RewardedVideoLoaded";
+const LoadFailCallbackKey = "RewardedVideoLoadFail";
+const PlayStartCallbackKey = "RewardedVideoPlayStart";
+const PlayEndCallbackKey = "RewardedVideoPlayEnd";
+const PlayFailCallbackKey = "RewardedVideoPlayFail";
+const CloseCallbackKey = "RewardedVideoClose";
+const ClickCallbackKey = "RewardedVideoClick";
+const RewardCallbackKey = "RewardedVideoReward";
+
+
+window.ATRewardedVideoJSSDK = ATRewardedVideoSDK;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATRewardedVideoJSSDK.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "8ac0ad32-864c-4807-b19a-d05903b6d06c",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "080ba951-a9dd-462f-8d86-f3653d5632cf",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 46 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidBannerJS.js

@@ -0,0 +1,46 @@
+var classJavaName = "com/anythink/cocosjs/ATBannerJSBridge";
+var ATAndroidBannerJS = ATAndroidBannerJS || {
+  
+    loadBanner : function (placementId, settings) {
+        cc.log("Android-loadBanner:" + settings);
+		jsb.reflection.callStaticMethod(classJavaName, "load", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, settings);
+    },
+
+    setAdListener : function (listener) {
+        cc.log("Android-setAdListener");
+		jsb.reflection.callStaticMethod(classJavaName, "setAdListener", "(Ljava/lang/String;)V", listener);
+    },
+
+    hasAdReady : function (placementId) {
+         cc.log("Android-hasAdReady");
+        return jsb.reflection.callStaticMethod(classJavaName, "isAdReady", "(Ljava/lang/String;)Z", placementId);;
+    },
+
+    showAdInPosition : function(placementId, position) {
+        cc.log("Android-showAdInPosistion");
+		jsb.reflection.callStaticMethod(classJavaName, "showWithPosition", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, position);
+    },
+
+    showAdInRectangle : function(placementId, showAdRect) {
+        cc.log("Android-showAdInRectangle");
+		jsb.reflection.callStaticMethod(classJavaName, "showWithRect", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, showAdRect);
+    },
+    
+    removeAd : function(placementId) {
+         cc.log("Android-removeAd");
+		 jsb.reflection.callStaticMethod(classJavaName, "remove", "(Ljava/lang/String;)V", placementId);
+    },
+
+    reShowAd : function(placementId) {
+        cc.log("Android-reShowAd");
+		jsb.reflection.callStaticMethod(classJavaName, "reshow", "(Ljava/lang/String;)V", placementId);
+    },
+
+    hideAd : function(placementId) {
+         cc.log("Android-hideAd");
+		 jsb.reflection.callStaticMethod(classJavaName, "hide", "(Ljava/lang/String;)V", placementId);
+    }
+  
+};
+
+module.exports = ATAndroidBannerJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidBannerJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "373b2b02-3859-422d-97a8-9adf3add7c82",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 31 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidInterstitialJS.js

@@ -0,0 +1,31 @@
+var classJavaName = "com/anythink/cocosjs/ATInterstitialJSBridge";
+var ATAndroidInterstitialJS = ATAndroidInterstitialJS || {
+	
+	loadInterstitial : function (placementId, settings) {
+        cc.log("Android-loadInterstitial");
+		jsb.reflection.callStaticMethod(classJavaName, "load", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, settings);
+    },
+
+    setAdListener : function (listener) {
+        cc.log("Android-setAdListener");
+		jsb.reflection.callStaticMethod(classJavaName, "setAdListener", "(Ljava/lang/String;)V", listener);
+    },
+
+    hasAdReady : function (placementId) {
+         cc.log("Android-hasAdReady");
+        return jsb.reflection.callStaticMethod(classJavaName, "isAdReady", "(Ljava/lang/String;)Z", placementId);
+    },
+
+    showAd : function(placementId) {
+        cc.log("Android-showAd:" + placementId);
+		jsb.reflection.callStaticMethod(classJavaName, "show", "(Ljava/lang/String;)V", placementId);
+    },
+
+    showAdInScenario : function(placementId, scenario) {
+         cc.log("Android-showAdInScenario:" + placementId + "---" + scenario);
+		 jsb.reflection.callStaticMethod(classJavaName, "show", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, scenario);
+    } 
+  
+};
+
+module.exports = ATAndroidInterstitialJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidInterstitialJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f073fa18-74b7-4f33-a62b-d67b5bda5320",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 43 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidJS.js

@@ -0,0 +1,43 @@
+var classJavaName = "com/anythink/cocosjs/ATJSBridge";
+var ATAndroidJS = ATAndroidJS || {
+    printJsLog : function(msg) {
+        if (undefined != msg && msg != null) {
+            jsb.reflection.callStaticMethod("android/util/Log", "i", "(Ljava/lang/String;Ljava/lang/String;)I", "AT-Cocos-JS", msg);
+        }
+    },
+
+    initSDK : function(appid, appkey) {
+        jsb.reflection.callStaticMethod(classJavaName, "initSDK", "(Ljava/lang/String;Ljava/lang/String;)V", appid, appkey);
+    },
+
+    initCustomMap : function(customMap) {      
+        jsb.reflection.callStaticMethod(classJavaName, "initCustomMap", "(Ljava/lang/String;)V", customMap);
+    },
+
+    setPlacementCustomMap : function(placmentId, customMap) {
+        jsb.reflection.callStaticMethod(classJavaName, "setPlacementCustomMap", "(Ljava/lang/String;Ljava/lang/String;)V", placmentId, customMap);
+    },
+
+    setGDPRLevel : function(level) {
+        jsb.reflection.callStaticMethod(classJavaName, "setGDPRLevel", "(I)V", level);
+    },
+
+    getGDPRLevel : function() {
+        return jsb.reflection.callStaticMethod(classJavaName, "getGDPRLevel", "()I");
+    },
+
+    getUserLocation : function(callbackMethod) {
+        jsb.reflection.callStaticMethod(classJavaName, "getUserLocation", "(Ljava/lang/String;)V", callbackMethod);
+    },
+
+    showGDPRAuth : function () {
+        jsb.reflection.callStaticMethod(classJavaName, "showGDPRAuth", "()V");
+    },
+
+    setLogDebug : function (debug) {
+        jsb.reflection.callStaticMethod(classJavaName, "setLogDebug", "(Z)V", debug);
+    }
+  
+};
+
+module.exports = ATAndroidJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "85a5e4e1-3fad-4f2b-ae58-e321b006f13c",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 31 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidNativeJS.js

@@ -0,0 +1,31 @@
+var classJavaName = "com/anythink/cocosjs/ATNativeJSBridge";
+var ATAndroidBannerJS = ATAndroidBannerJS || {
+  
+    loadNative : function (placementId, settings) {
+        cc.log("Android-loadNative");
+		jsb.reflection.callStaticMethod(classJavaName, "load", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, settings);
+    },
+
+    setAdListener : function (listener) {
+        cc.log("Android-setAdListener");
+		jsb.reflection.callStaticMethod(classJavaName, "setAdListener", "(Ljava/lang/String;)V", listener);
+    },
+
+    hasAdReady : function (placementId) {
+         cc.log("Android-hasAdReady");
+        return jsb.reflection.callStaticMethod(classJavaName, "isAdReady", "(Ljava/lang/String;)Z", placementId);;
+    },
+
+    showAd : function(placementId, adViewProperty) {
+        cc.log("Android-showAd");
+		jsb.reflection.callStaticMethod(classJavaName, "show", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, adViewProperty);
+    },
+    
+    removeAd : function(placementId) {
+         cc.log("Android-removeAd");
+		 jsb.reflection.callStaticMethod(classJavaName, "remove", "(Ljava/lang/String;)V", placementId);
+    }
+  
+};
+
+module.exports = ATAndroidBannerJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidNativeJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "c7e28fd5-d25b-46b9-a564-cacb0b9a5f79",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 31 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidRewardedVideoJS.js

@@ -0,0 +1,31 @@
+var classJavaName = "com/anythink/cocosjs/ATRewardedVideoJSBridge";
+var ATAndroidRewardedVideoJS = ATAndroidRewardedVideoJS || {
+  
+    loadRewardedVideo : function (placementId, settings) {
+        cc.log("Android-loadRewardedVideo");
+		jsb.reflection.callStaticMethod(classJavaName, "load", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, settings);
+    },
+
+    setAdListener : function (listener) {
+        cc.log("Android-setAdListener");
+		jsb.reflection.callStaticMethod(classJavaName, "setAdListener", "(Ljava/lang/String;)V", listener);
+    },
+
+    hasAdReady : function (placementId) {
+        cc.log("Android-hasAdReady");
+        return jsb.reflection.callStaticMethod(classJavaName, "isAdReady", "(Ljava/lang/String;)Z", placementId);
+    },
+
+    showAd : function(placementId) {
+        cc.log("Android-rv_showAd:" + placementId);
+		jsb.reflection.callStaticMethod(classJavaName, "show", "(Ljava/lang/String;)V", placementId);
+    },
+
+    showAdInScenario : function(placementId, scenario) {
+        cc.log("Android-rv_showAdInScenario:" + placementId + "---" + scenario);
+		jsb.reflection.callStaticMethod(classJavaName, "show", "(Ljava/lang/String;Ljava/lang/String;)V", placementId, scenario);
+    } 
+  
+};
+
+module.exports = ATAndroidRewardedVideoJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/Android/ATAndroidRewardedVideoJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "0e16c923-5bce-4d64-85e3-c57c90db17a6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "343a0f1a-e034-430b-9684-a0d0c11eac01",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 45 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSBannerJS.js

@@ -0,0 +1,45 @@
+var ATiOSJS = require("ATiOSJS");
+const OC_WRAPPER_CLASS = "ATBannerAdWrapper";
+var ATiOSBannerJS = ATiOSBannerJS || {
+    loadBanner: function(placementId, extra) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::loadBanner(" + placementId + ", " + extra + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "loadBannerWithPlacementID:extra:", placementId, extra);
+    },
+
+    setAdListener : function (listener) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::setAdListener(" + listener + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "setDelegates:", listener);
+    },
+  
+    hasAdReady : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::hasAdReady(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "bannerReadyForPlacementID:", placementId);
+    },
+
+    showAdInPosition : function(placementId, position) { 
+        ATiOSJS.printJsLog("ATiOSBannerJS::showAdInPosition(" + placementId + ", " + position + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:position:", placementId, position);
+    },
+
+    showAdInRectangle : function(placementId, showAdRect) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::showAdInRectangle(" + placementId + ", " + showAdRect + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:rect:", placementId, showAdRect);
+    },
+
+    removeAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::removeAd(" + placementId + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "removeAd:", placementId);
+    },
+
+    reShowAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::reShowAd(" + placementId + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "reShowAd:", placementId);
+    },
+
+    hideAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::hideAd(" + placementId + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "hideAd:", placementId);
+    }
+};
+
+module.exports = ATiOSBannerJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSBannerJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "47c245b5-22f6-40ba-a288-368a4da3e216",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 36 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSInterstitialJS.js

@@ -0,0 +1,36 @@
+var ATiOSJS = require("ATiOSJS");
+const OC_WRAPPER_CLASS = "ATInterstitialAdWrapper";
+var ATiOSInterstitialJS = ATiOSInterstitialJS || {
+    loadInterstitial : function (placementId, extra) {
+        ATiOSJS.printJsLog("ATiOSInterstitialJS::loadInterstitial(" + placementId + ", " + extra + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "loadInterstitialWithPlacementID:extra:", placementId, extra);
+    },
+
+    setAdListener : function (listener) {
+        ATiOSJS.printJsLog("ATiOSInterstitialJS::setAdListener(" + listener + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "setDelegates:", listener);
+    },
+
+    hasAdReady : function (placementId) {
+        ATiOSJS.printJsLog("ATiOSInterstitialJS::hasAdReady(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "interstitialReadyForPlacementID:", placementId);
+    },
+
+    setUserData : function (placementId, userId, userData) {
+         cc.log("Android-setUserData");
+    },
+
+    showAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSInterstitialJS::showAd(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showInterstitialWithPlacementID:scene:", placementId, null);
+        
+    },
+
+    showAdInScenario : function(placementId, scenario) {
+        ATiOSJS.printJsLog("ATiOSInterstitialJS::showAd(" + placementId  + ", " + scenario + ")");
+        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showInterstitialWithPlacementID:scene:", placementId, scenario);
+    } 
+  
+};
+
+module.exports = ATiOSInterstitialJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSInterstitialJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ddd93de0-3491-4310-809b-e2cebee1ebb9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 52 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSJS.js

@@ -0,0 +1,52 @@
+const OC_ATSDK_MANAGER_CLASS = "ATSDKManager";
+const OC_BIRDGE_CLASS = "ATJSBridge";
+var ATiOSJS = ATiOSJS || {
+    initSDK : function(appid, appkey) {
+    	this.printJsLog("ATiOSJS::initSDK(" + appid + "," + appkey + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "startWithAppID:appKey:", appid, appkey);
+    },
+
+    initCustomMap : function(customMap) {
+        this.printJsLog("ATiOSJS::initCustomMap(" + customMap + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:", customMap);
+    },
+
+    setPlacementCustomMap : function(placmentId, customMap) {
+        this.printJsLog("ATiOSJS::setPlacementCustomMap(" + placmentId + ", " + customMap + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:forPlacementID:", customMap, placmentId);
+    },
+
+    setGDPRLevel : function(level) {
+        this.printJsLog("ATiOSJS::setGDPRLevel(" + level + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDataConsent:", level);
+    },
+
+    getGDPRLevel : function() {
+        this.printJsLog("ATiOSJS::getGDPRLevel()");
+        return jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "dataConsent");
+    },
+
+    getUserLocation : function(callbackMethod) {
+        this.printJsLog("ATiOSJS::getUserLocation(" + callbackMethod + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "getUserLocationWithCallback:", callbackMethod);
+    },
+
+    showGDPRAuth : function () {
+        this.printJsLog("ATiOSJS::showGDPRAuth()");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "presentDataConsentDialog");
+    },
+    
+    setLogDebug : function (debug) {
+        this.printJsLog("ATiOSJS::setLogDebug(" + debug + ")");
+        jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDebugLog:", debug);
+    },
+    
+    printJsLog : function(msg) {
+        if (undefined != msg && msg != null) {
+            jsb.reflection.callStaticMethod(OC_BIRDGE_CLASS, "log:", msg);
+        }
+    }
+  
+};
+
+module.exports = ATiOSJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f0cfb2a4-fda2-4e87-b02b-71c7acf1ed8b",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 30 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSNativeJS.js

@@ -0,0 +1,30 @@
+var ATiOSJS = require("ATiOSJS");
+const OC_WRAPPER_CLASS = "ATNativeAdWrapper";
+var ATiOSNativeJS = ATiOSNativeJS || {
+    loadNative : function(placementId, settings) {
+        ATiOSJS.printJsLog("ATiOSBannerJS::loadNative(" + placementId + ", " + settings + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "loadNativeWithPlacementID:extra:", placementId, settings);
+    },
+
+    setAdListener : function (listener) {
+        ATiOSJS.printJsLog("ATiOSNativeJS::setAdListener(" + listener + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "setDelegates:", listener);
+    },
+  
+    hasAdReady : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSNativeJS::hasAdReady(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "nativeReadyForPlacementID:", placementId);
+    },
+
+    showAd : function(placementId, adViewProperty) { 
+        ATiOSJS.printJsLog("ATiOSNativeJS::showAd(" + placementId + ", " + adViewProperty + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showNativeWithPlacementID:metrics:", placementId, adViewProperty);
+    },
+
+    removeAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSNativeJS::removeAd(" + placementId + ")");
+        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "removeNativeWithPlacementID:", placementId);
+    }
+};
+
+module.exports = ATiOSNativeJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSNativeJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "2aa64d81-8c51-4a84-9da4-462f0234cd59",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 36 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSRewardedVideoJS.js

@@ -0,0 +1,36 @@
+var ATiOSJS = require("ATiOSJS");
+const OC_RV_WRAPPER_CLASS = "ATRewardedVideoWrapper";
+var ATiOSRewardedVideoJS = ATiOSRewardedVideoJS || {
+    loadRewardedVideo : function (placementId, extra) {
+        ATiOSJS.printJsLog("ATiOSRewardedVideoJS::loadRewardedVideo(" + placementId + ", " + extra + ")");
+        jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "loadRewardedVideoWithPlacementID:extra:", placementId, extra);
+    },
+
+    setAdListener : function (listener) {
+        ATiOSJS.printJsLog("ATiOSRewardedVideoJS::setAdListener(" + listener + ")");
+        jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "setDelegates:", listener);
+    },
+
+    hasAdReady : function (placementId) {
+        ATiOSJS.printJsLog("ATiOSRewardedVideoJS::hasAdReady(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "rewardedVideoReadyForPlacementID:", placementId);
+    },
+
+    setUserData : function (placementId, userId, userData) {
+         cc.log("Android-setUserData");
+    },
+
+    showAd : function(placementId) {
+        ATiOSJS.printJsLog("ATiOSRewardedVideoJS::showAd(" + placementId + ")");
+        return jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "showRewardedVideoWithPlacementID:scene:", placementId, null);
+        
+    },
+
+    showAdInScenario : function(placementId, scenario) {
+        ATiOSJS.printJsLog("ATiOSRewardedVideoJS::showAdInScenario(" + placementId  + ", " + scenario + ")");
+        return jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "showRewardedVideoWithPlacementID:scene:", placementId, scenario);
+    } 
+  
+};
+
+module.exports = ATiOSRewardedVideoJS;

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAds/iOS/ATiOSRewardedVideoJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f7d797d0-edde-4ce4-aa04-59e5dd50db15",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "764cedc9-959b-4ce0-a852-8a9c9ed85ffc",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 39 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBanner.ts

@@ -0,0 +1,39 @@
+import { zgSingleton } from "../zgSingleton";
+import ATSDKMgr from "./ATSDKMgr";
+
+/**
+ * banner广告
+ * @description
+ * @author 冯聪
+ */
+export default class ATBanner extends zgSingleton {
+
+    init() {
+        cc["ATNativeJS"].proxy = this;;
+        cc["ATNativeJS"].init();
+        this.loadBanner();
+    }
+
+    /** 广告位id */
+    placementID() {
+        if (cc.sys.os === cc.sys.OS_IOS) {
+            return ATSDKMgr.topon_banner_placementId;
+        } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+            return ATSDKMgr.topon_banner_placementId;
+        }
+    }
+
+    /* *加载banner */
+    loadBanner() {
+        cc["ATNativeJS"].loadBanner();
+    }
+    
+    /** 显示banner */
+    showBanner() {
+        cc["ATNativeJS"].showBanner();
+    }
+
+    destroyBanner() {
+        cc["ATNativeJS"].destroyBanner()
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBanner.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "180ddc5d-bbce-485d-88f1-14c306f91cf9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 156 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBannerJS.js

@@ -0,0 +1,156 @@
+require("./AnyThinkAds/ATBannerJSSDK");
+require("./AnyThinkAds/ATJSSDK");
+
+var ATBannerJS = cc.Class({
+
+    name: "ATBannerJS",
+
+    /** 代理脚本(TS) */
+    proxy: null,
+
+    ctor: function () {
+        // console.log("ATNativeJS created! ");
+    },
+
+    init: function () {
+        ATBannerJSSDK.setAdListener(this);
+    },
+
+    /** 广告位id */
+    placementID: function () {
+        return this.proxy.placementID();
+    },
+
+    /**
+     * 加载banner广告
+     * @returns 
+     */
+    loadBanner: function () {
+        let winHeight = cc.view.getFrameSize().height
+        if (winHeight < 1400) {
+            return
+        }
+        var setting = {}
+        var bannerH = winHeight / 1334 * 115
+
+        setting[ATBannerJSSDK.kATBannerAdLoadingExtraBannerAdSizeStruct] = ATBannerJSSDK.createLoadAdSize(cc.view.getFrameSize().width, bannerH);
+        //只针对Admob的自适应banner
+        setting[ATBannerJSSDK.kATBannerAdInlineAdaptiveWidth] = cc.view.getFrameSize().width;
+        setting[ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientation] = ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientationCurrent;
+        // setting[ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientation] =      ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientationPortrait;
+        // setting[ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientation] = ATBannerJSSDK.kATBannerAdInlineAdaptiveOrientationLandscape;
+        ATBannerJSSDK.loadBanner(this.placementID(), setting);
+    },
+
+    /**
+     * 检测banner是否准备就绪
+     * @returns 
+     */
+    checkBannerReady: function () {
+        return ATBannerJSSDK.hasAdReady(this.placementID()) ? true : false
+    },
+
+    /**
+     * 显示banner
+     * @returns 
+     */
+    showBanner: function () {
+        if (this.bannerIsShow) {
+            return
+        }
+        ATBannerJSSDK.showAdInPosition(this.placementID(), ATBannerJSSDK.kATBannerAdShowingPositionBottom);
+    },
+
+    /**
+     * 销毁banner
+     */
+    destroyBanner: function () {
+        if (this.bannerIsShow) {
+            ATBannerJSSDK.removeAd(this.placementID());
+            this.bannerIsShow = false
+            this.loadBanner()
+        }
+    },
+
+    /**
+     * banner加载成功
+     * @param {*} placementId 广告位id
+     * @returns 
+     */
+    onBannerAdLoaded: function (placementId) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdLoaded(" + placementId + ")");
+        if (this.proxy == null) return;
+        this.proxy.onBannerAdLoaded(placementId);
+    },
+
+    /**
+     *  banner加载失败
+     * @param {*} placementId 广告位id
+     * @param {*} errorInfo   错误信息
+     * @returns 
+     */
+    onBannerAdLoadFail: function (placementId, errorInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdLoadFail(" + placementId + ", " + errorInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onBannerAdLoadFail(placementId, errorInfo);
+    },
+
+    /**
+     * banner展示成功
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onBannerAdShow: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdShow(" + placementId + ", " + callbackInfo + ")");
+        this.bannerIsShow = true
+        if (this.proxy == null) return;
+        this.proxy.onBannerAdShow(placementId, callbackInfo);
+    },
+
+    /**
+     * banner被点击
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onBannerAdClick: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdClick(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onBannerAdClick(placementId, callbackInfo);
+    },
+
+    /** banner自动刷新成功 */
+    onBannerAdAutoRefresh: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdAutoRefresh(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+    },
+
+    /**
+     * banner自动刷新失败
+     * @param {*} placementId 广告位id
+     * @param {*} errorInfo   错误信息
+     * @returns 
+     */
+    onBannerAdAutoRefreshFail: function (placementId, errorInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdAutoRefreshFail(" + placementId + ", " + errorInfo + ")");
+        if (this.proxy == null) return;
+    },
+
+    /**
+     * banner关闭按钮被点击
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 错误信息
+     * @returns 
+     */
+    onBannerAdCloseButtonTapped: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkBannerDemo::onBannerAdCloseButtonTapped(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+    }
+});
+
+module.exports = ATBannerJS;
+if (!cc["ATBannerJS"]) {
+    cc["ATBannerJS"] = new ATBannerJS();
+}
+

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATBannerJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "e39eedc3-d3a5-47d8-920e-293467752565",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 36 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitial.ts

@@ -0,0 +1,36 @@
+
+import { zgSingleton } from "../zgSingleton";
+import ATSDKMgr from "./ATSDKMgr";
+
+/**
+ * inter插屏广告
+ * @description
+ * @author 冯聪
+ */
+export default class ATInterstitial extends zgSingleton {
+
+   
+    init() {
+        cc["ATInterstitialJS"].proxy = this;;
+        cc["ATInterstitialJS"].init();
+        // this.loadNative();
+    }
+
+    /** 广告位id */
+    placementID(type: number) {
+        if (type == 0) {
+            if (cc.sys.os === cc.sys.OS_IOS) {
+                return ATSDKMgr.topon_inter_placementId;
+            } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+                return ATSDKMgr.topon_inter_placementId;
+            }
+        }
+        else {
+            if (cc.sys.os === cc.sys.OS_IOS) {
+                return ATSDKMgr.topon_fullinter_placementId;
+            } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+                return ATSDKMgr.topon_fullinter_placementId;
+            }
+        }
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitial.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3adb1db6-87f5-4680-92a5-2179acc6f083",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 175 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitialJS.js

@@ -0,0 +1,175 @@
+require("./AnyThinkAds/ATInterstitialJSSDK");
+require("./AnyThinkAds/ATJSSDK");
+
+var ATInterstitialJS = cc.Class({
+
+    name: "ATInterstitialJS",
+
+    /** 代理脚本(TS) */
+    proxy: null,
+
+    /** 插屏类型 */
+    interType: 0,
+
+    ctor: function () {
+        // console.log("ATNativeJS created! ");
+    },
+
+    init: function () {
+        ATBannerJSSDK.setAdListener(this);
+    },
+
+    /** 广告位id */
+    placementID: function () {
+        return this.proxy.placementID(this.interType);
+    },
+
+    /**
+     * 插屏广告加载
+     * @param {*} type 0 插屏 1 全屏
+     */
+    loadInter: function (type) {
+        //v5.6.8新增,只针对Sigmob平台,Sigmob的激励视频广告源当做插屏使用
+        var setting = {};
+        setting[ATInterstitialJSSDK.UseRewardedVideoAsInterstitial] = false;
+        this.interType = type
+        ATInterstitialJSSDK.setAdListener(this);
+        //setting[ATInterstitialJSSDK.UseRewardedVideoAsInterstitial] = true;
+        if (this.interType == 0) {
+            ATInterstitialJSSDK.loadInterstitial(this.placementID(), setting);
+            // ATInterstitialJSSDK.showAd(this.interPlacementId);
+        }
+        else if (this.interType == 1) {
+            ATInterstitialJSSDK.loadInterstitial(this.placementID(), setting);
+            // ATInterstitialJSSDK.showAd(this.fullInterPlacementId);
+        }
+    },
+
+    /**
+     * 检查插屏是否加载成功
+     * @param {*} type 0 插屏 1 全屏
+     * @returns 
+     */
+    checkInterReady: function (type) {
+        if (this.proxy == null) return;
+        if (type == 0) {
+            return ATInterstitialJSSDK.hasAdReady(this.placementID()) ? true : false;
+        }
+        else if (type == 1) {
+            return ATInterstitialJSSDK.hasAdReady(this.placementID()) ? true : false;
+        }
+    },
+
+    /**
+     * 显示插屏
+     * @param {*} type 0 插屏 1 全屏
+     */
+    showInter: function (type) {
+        if (type == 0) {
+            ATInterstitialJSSDK.showAd(this.placementID());
+        }
+        else if (type == 1) {
+            ATInterstitialJSSDK.showAd(this.placementID());
+        }
+    },
+
+    /**
+     * 插屏广告加载成功
+     * @param {*} placementId 广告位Id
+     * @returns 
+     */
+    onInterstitialAdLoaded: function (placementId) {
+        //ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdLoaded(" + placementId + ")");
+        if (this.proxy == null) return;
+        this.proxy.onInterstitialAdLoaded(placementId);
+    },
+
+    /**
+     * 插屏广告加载失败
+     * @param {*} placementId 广告位Id
+     * @param {*} errorInfo   错误信息
+     * @returns 
+     */
+    onInterstitialAdLoadFail: function (placementId, errorInfo) {
+        //ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdLoadFail(" + placementId + ", " + errorInfo + ")");   
+        if (this.proxy == null) return;
+        this.proxy.onInterstitialAdLoadFail(placementId, errorInfo);
+    },
+
+    /**
+     * 插屏广告显示成功
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onInterstitialAdShow: function (placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdShow("  + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onInterstitialAdShow(placementId, callbackInfo);
+    },
+    //广告视频开始播放,部分平台有此回调
+
+    /**
+     * 插屏广告开始播放视屏,部分广告平台有此回调
+     * @param {*} placementId  广告位id 
+     * @param {*} callbackInfo 回调信息
+     */
+    onInterstitialAdStartPlayingVideo: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdStartPlayingVideo("  + placementId + ", " + callbackInfo + ")");
+    },
+
+    /**
+     * 插屏广告视频播放结束,部分广告平台有此回调
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     */
+    onInterstitialAdEndPlayingVideo: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdEndPlayingVideo("  + placementId + ", " + callbackInfo + ")");
+    },
+
+    /**
+     * 插屏广告视频播放失败,部分广告平台有此回调
+     * @param {*} placementId 广告位id
+     * @param {*} errorInfo   错误回调
+     */
+    onInterstitialAdFailedToPlayVideo: function (placementId, errorInfo) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdFailedToPlayVideo(" + placementId + ", " + errorInfo + ")");
+    },
+
+    /**
+     * 插屏广告显示失败
+     * @param {*} placementId 广告位id
+     */
+    onInterstitialAdFailedToShow: function (placementId) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdFailedToShow(" + placementId + ")");
+    },
+
+    /**
+     * 广告被关闭
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onInterstitialAdClose: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdClose("  + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onInterstitialAdClose(placementId, callbackInfo);
+    },
+
+    /**
+     * 广告被点击
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onInterstitialAdClick: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkInterstitialDemo::onInterstitialAdClick("  + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onInterstitialAdClick(placementId, callbackInfo);
+    }
+});
+
+module.exports = ATInterstitialJS;
+if (!cc["ATInterstitialJS"]) {
+    cc["ATInterstitialJS"] = new ATInterstitialJS();
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitialJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "834cd834-ae3e-4ae1-b057-2d51b85f25ef",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 66 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNative.ts

@@ -0,0 +1,66 @@
+import { zgSingleton } from "../zgSingleton";
+import ATSDKMgr from "./ATSDKMgr";
+
+/**
+ * 原生广告
+ * @description
+ * @author 冯聪
+ */
+export class ATNative extends zgSingleton {
+
+    /** 初始化 */
+    init() {
+        cc["ATNativeJS"].proxy = this;;
+        cc["ATNativeJS"].init();
+        this.loadNative();
+    }
+
+    /** 广告位id */
+    placementID() {
+        if (cc.sys.os === cc.sys.OS_IOS) {
+            return ATSDKMgr.topon_native_placementId;
+        } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+            return ATSDKMgr.topon_native_placementId;
+        }
+    }
+
+    /**
+     * 加载信息流广告
+     * @param type 类型对应不同位置
+     * @param show 是否加载完显示显示
+     */
+    loadNative(type = 0, show = false) {
+        cc["ATNativeJS"].loadNative(type, show);
+    }
+
+    /** 
+     * 显示原生广告 
+     * @param type 0 弹窗里  1 最底部 2 新车奖励 3 底部小窗口
+     */
+    showNative(type) {
+        cc["ATNativeJS"].showNative(type);
+    }
+
+    /**
+     * 广告显示成功
+     * @param placementId 
+     * @param callbackInfo 
+     */
+    onNativeAdShow(placementId, callbackInfo) {
+        // 2021/06/03(勿删)此处为星云埋点,先注释,待接口调通,恢复
+        // let data = JSON.parse(callbackInfo)
+        // HttpMgr.Inst.updateADLog(3, placementId, data.adunit_format, data.network_type, data.network_placement_id,
+        //     data.network_firm_id, data.adsource_id, data.adsource_index, data.adsource_price,
+        //     data.adsource_isheaderbidding, data.publisher_revenue, data.precision, data.ecpm_level);
+    }
+
+    /** 销毁baaner */
+    destroyNative() {
+        cc["ATNativeJS"].destroyNative();
+    }
+
+    /** 当前是否有banner显示 */
+    getIsNativeShow() {
+        return cc["ATNativeJS"].nativeShow
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNative.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6935c79c-5f8e-488a-815a-c2f5916b1864",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 222 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNativeJS.js

@@ -0,0 +1,222 @@
+require("./AnyThinkAds/ATRewardedVideoJSSDK");
+require("./AnyThinkAds/ATJSSDK");
+require("./AnyThinkAds/ATInterstitialJSSDK");
+require("./AnyThinkAds/ATNativeJSSDK");
+
+var ATNativeJS = cc.Class({
+
+    name: "ATNativeJS",
+
+    /** 代理脚本(TS) */
+    proxy: null,
+
+    frameWidth: 0,
+    frameHeight: 0,
+
+    nativeIsShow: false,
+    nativeType: 0,
+    nativeShow: false,
+    nativeIsLoad: false,
+    nativeIsLoading: false,
+    // timeID: 0,
+
+    ctor: function () {
+        // console.log("ATNativeJS created! ");
+    },
+
+    init: function () {
+        ATNativeJSSDK.setAdListener(this);
+    },
+
+    /** 广告位Id */
+    placementID: function () {
+        return this.proxy.placementID();
+    },
+
+    /**
+     * 加载原生广告
+     * @param {*} type 类型 
+     * @param {*} show 是否显示
+     */
+    loadNative: function (type = 0, show = false) {
+
+        this.nativeType = type;
+        this.nativeShow = show;
+        this.nativeIsLoading = true;
+
+        //加载原生广告时需要传入广告展示的宽高
+        var frameSize = cc.view.getFrameSize();
+        this.frameWidth = frameSize.width;
+        this.frameHeight = frameSize.height;
+        var per = this.frameWidth / 750
+        var sw = per * 656
+        var sh = per * 440
+
+        if (this.nativeType == 2) {
+            this.destroyNative(false)
+            sw *= 0.9
+            sh *= 0.8
+        }
+        else if (this.nativeType == 3) {
+            this.destroyNative(false)
+            sw *= 0.9
+            sh *= 0.75
+        }
+        else {
+            sw *= 0.9
+            sh *= 0.75
+        }
+
+        ATNativeJSSDK.loadNative(this.placementID(), ATNativeJSSDK.createLoadAdSize(sw, sh));
+    },
+
+    /**
+     * 销毁原生广告
+     * @param {*} ifPreloadNext 是否预加载下一个 
+     */
+    destroyNative: function (ifPreloadNext = true) {
+        ATNativeJSSDK.removeAd(this.placementID());
+        this.nativeIsLoad = false
+        this.nativeIsShow = false
+        if (ifPreloadNext) {
+            this.loadNative()
+        }
+    },
+
+    /** 信息流位置 
+     *  @param {*} type 0 弹窗里  1 最底部 2 新车奖励 3 底部小窗口
+     */
+    showNative: function (type) {
+
+        if (this.nativeIsLoading) {
+            this.nativeType = type
+            this.nativeShow = true
+            return
+        }
+
+        if (!this.nativeIsLoad) {
+            this.loadNative(type, true)
+            return
+        }
+
+        if (this.nativeIsShow) {
+            return
+        }
+
+        this.nativeIsShow = true
+        var per = this.frameWidth / 750
+        var sw = per * 656
+        var sh = per * 440
+        var fontSize = 12
+
+        var nativeAdViewProperty = new ATNativeJSSDK.AdViewProperty();
+        var posy = 0
+        if (type == 0) {
+            // posy = this.frameHeight * 0.5 - 100
+            posy = this.frameHeight * 0.45
+        }
+        else if (type == 1) {
+            // posy = this.frameHeight * 0.5 + 280
+            posy = this.frameHeight * 0.625
+        }
+        else if (type == 2) {
+            // posy = this.frameHeight * 0.5 + 210
+            posy = this.frameHeight * 0.595
+            sw *= 0.9
+            sh *= 0.8
+            fontSize = 8
+        }
+        else if (type == 3) {
+            // posy = this.frameHeight * 0.5 + 420
+            posy = this.frameHeight * 0.69
+            sw *= 0.9
+            sh *= 0.75
+            fontSize = 8
+        }
+        else if (type == 4) {
+            posy = this.frameHeight * 0.75;
+            sw *= 1.1;
+        }
+
+        var parx = (this.frameWidth - sw) * 0.5
+
+        nativeAdViewProperty.parent = nativeAdViewProperty.createItemViewProperty(parx, posy, sw, sh, "#ffffff", "", 0);
+        nativeAdViewProperty.mainImage = nativeAdViewProperty.createItemViewProperty(0, 0, sw, sh, "#ffffff", "#ffffff", fontSize);
+        ATNativeJSSDK.showAd(this.placementID(), nativeAdViewProperty);
+    },
+
+    /**
+     * 原生广告加载成功
+     * @param {*} placementId 
+     */
+    onNativeAdLoaded: function (placementId) {
+        this.nativeIsLoad = true
+        this.nativeIsLoading = false
+        if (this.nativeShow) {
+            this.nativeIsShow = false
+            this.showNative(this.nativeType)
+        }
+    },
+
+    /**
+     * 原生广告加载失败
+     * @param {*} placementId 广告位id
+     * @param {*} errorInfo   错误信息
+     */
+    onNativeAdLoadFail: function (placementId, errorInfo) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdLoadFail(" + placementId + ", " + errorInfo + ")");
+        this.nativeIsLoading = false
+        this.nativeIsLoad = false
+    },
+
+    /**
+     * 原生广告显示成功
+     * @param {*} placementId  广告位id
+     * @param {*} callbackInfo 回调信息
+     * @returns 
+     */
+    onNativeAdShow: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdShow(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onNativeAdShow(placementId, callbackInfo);
+    },
+
+    /**
+     * 原生广告被点击
+     * @param {*} placementId  广告位Id
+     * @param {*} callbackInfo 回调信息
+     */
+    onNativeAdClick: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdClick(" + placementId + ", " + callbackInfo + ")");
+    },
+
+    /**
+     * 原生广告视频开始播放,部分广告平台有此回调
+     * @param {*} placementId 广告位id
+     */
+    onNativeAdVideoStart: function (placementId) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdVideoStart(" + placementId + ")");
+    },
+
+    /**
+     * 原生广告视频结束播放,部分广告平台有此回调
+     * @param {*} placementId 
+     */
+    onNativeAdVideoEnd: function (placementId) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdVideoEnd(" + placementId + ")");
+    },
+
+    /**
+     * 广告关闭按钮被点击,部分广告平台有此回调
+     * @param {*} placementId 
+     * @param {*} callbackInfo 
+     */
+    onNativeAdCloseButtonTapped: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkNativeDemo::onNativeAdCloseButtonTapped(" + placementId + ", " + callbackInfo + ")");
+    }
+});
+
+module.exports = ATNativeJS;
+if (!cc["ATNativeJS"]) {
+    cc["ATNativeJS"] = new ATNativeJS();
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATNativeJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "63256e8a-2394-4667-b487-feb51d3c188e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 164 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideo.ts

@@ -0,0 +1,164 @@
+import { zgSingleton } from "../zgSingleton";
+import ATSDKMgr, { AdPlayStateType } from "./ATSDKMgr";
+
+/**
+ * 激励视频广告
+ * @description
+ * @author 冯聪
+ */
+export class ATRewardVideo extends zgSingleton {
+
+    /**是否加载成功 */
+    public ifLoadSuccess: boolean = false;
+    /**是否观看完毕 */
+    public ifWatchEnd: boolean = false;
+
+    init() {
+        cc["ATRewardVideoJS"].proxy = this;
+        cc["ATRewardVideoJS"].init();
+
+        this.ifWatchEnd = false;
+        this.loadAd();
+    }
+
+    /** 广告位id */
+    placementID() {
+        if (cc.sys.os === cc.sys.OS_IOS) {
+            return ATSDKMgr.topon_rewardVideo_placementId;
+        } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+            return ATSDKMgr.topon_rewardVideo_placementId;
+        }
+    }
+
+    /** 加载广告 */
+    loadAd() {
+        this.ifLoadSuccess = false;
+        cc["ATRewardVideoJS"].loadAd("userIdKey", "userDataKey");
+    }
+
+    /** 显示广告 */
+    showAd() {
+        this.ifLoadSuccess = true;
+        cc["ATRewardVideoJS"].showAd();
+    }
+
+    /** 检测是否准备完毕 */
+    checkReady() {
+        return cc["ATRewardVideoJS"].checkReady();
+    }
+
+    /**
+     * 激励视频加载完毕
+     * @param placementId 广告位id
+     */
+    onRewardedVideoAdLoaded(placementId: string) {
+        // ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdLoaded(" + placementId + ")");
+        // ATRewardVideo.getInstance().showAd()
+    }
+
+    /**
+     * 激励视频播放失败
+     * @param placementId 广告位id
+     * @param errorInfo   错误信息
+     */
+    onRewardedVideoAdFailed(placementId, errorInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdFailed(" + placementId + ", " + errorInfo + ")");
+    }
+
+    /**
+     * 激励视频开始播放
+     * @param placementId  广告位id
+     * @param callbackInfo 回调信息
+     */
+    onRewardedVideoAdPlayStart(placementId, callbackInfo) {
+
+        //ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdPlayStart(" + placementId + ", " + callbackInfo + ")");
+
+        //视频埋点开始
+        // let data = JSON.parse(callbackInfo)
+        // HttpMgr.Inst.updateADLog(4, placementId, data.adunit_format, data.network_type, data.network_placement_id,
+        //     data.network_firm_id, data.adsource_id, data.adsource_index, data.adsource_price,
+        //     data.adsource_isheaderbidding, data.publisher_revenue, data.precision, data.ecpm_level);
+
+        this.loadAd();
+    }
+
+    /**
+     * 激励视频播放完毕
+     * @param placementId  广告位id
+     * @param callbackInfo 回调信息
+     */
+    onRewardedVideoAdPlayEnd(placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdPlayEnd(" + placementId + ", " + callbackInfo + ")");
+        this.ifWatchEnd = true;
+    }
+
+    /**
+     * 激励视频播放失败
+     * @param placementId  广告位id 
+     * @param errorInfo    错误信息
+     * @param callbackInfo 回调信息
+     */
+    onRewardedVideoAdPlayFailed(placementId, errorInfo, callbackInfo) {
+
+        //ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdPlayFailed(" + placementId + ", " + errorInfo + ", " + callbackInfo + ")");
+
+        // 2021/06/03(勿删)此处为星云埋点,先注释,待接口调通,恢复
+        // let data = JSON.parse(callbackInfo)
+        // HttpMgr.Inst.updateADLog(5, placementId, data.adunit_format, data.network_type, data.network_placement_id,
+        //     data.network_firm_id, data.adsource_id, data.adsource_index, data.adsource_price,
+        //     data.adsource_isheaderbidding, data.publisher_revenue, data.precision, data.ecpm_level);
+
+        ATSDKMgr.getInstance().watchVideoAdCallBack(AdPlayStateType.PlayFail);
+    }
+
+    /**
+     * 激励视频点击关闭
+     * @param placementId  广告位id
+     * @param callbackInfo 回调信息
+     */
+    onRewardedVideoAdClosed(placementId, callbackInfo) {
+
+        // ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdClosed(" + placementId + ", " + callbackInfo + ")");
+
+        if (this.ifWatchEnd) {
+            // 2021/06/03(勿删)此处为星云埋点,先注释,待接口调通,恢复
+            //视频埋点结束
+            // let data = JSON.parse(callbackInfo)
+            // HttpMgr.Inst.updateVideoTimes(placementId, data.adunit_format, data.network_type, data.network_placement_id,
+            //     data.network_firm_id, data.adsource_id, data.adsource_index, data.adsource_price,
+            //     data.adsource_isheaderbidding, data.publisher_revenue, data.precision, data.ecpm_level);
+
+            ATSDKMgr.getInstance().watchVideoAdCallBack(AdPlayStateType.WatchEnd);
+        }
+        else {
+            ATSDKMgr.getInstance().watchVideoAdCallBack(AdPlayStateType.Cancel);
+        }
+
+        this.ifWatchEnd = false;
+
+        if (!this.ifLoadSuccess) {
+            this.loadAd();
+        }
+    }
+
+    /**
+     * 激励视频被点击
+     * @param placementId 
+     * @param callbackInfo 
+     */
+    onRewardedVideoAdPlayClicked(placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdPlayClicked(" + placementId + ", " + callbackInfo + ")");
+    }
+
+    /**
+     * 能获取奖励
+     * @description 引擎的自动判断
+     * @param placementId  广告位id
+     * @param callbackInfo 回调信息
+     */
+    onReward(placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkRewardedVideoDemo::onReward(" + placementId + ", " + callbackInfo + ")");
+        this.ifWatchEnd = true;
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideo.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ee3a87c5-125d-474d-bfc6-97a12294101f",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 143 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideoJS.js

@@ -0,0 +1,143 @@
+require("./AnyThinkAds/ATRewardedVideoJSSDK");
+require("./AnyThinkAds/ATJSSDK");
+
+var ATRewardVideoJS = cc.Class({
+
+    name: "ATRewardVideoJS",
+
+    /** 代理脚本(TS) */
+    proxy: null,
+
+    ctor: function () {
+        console.log("ATRewardVideoJS.js created! ")
+    },
+
+    init: function () {
+        ATRewardedVideoJSSDK.setAdListener(this);
+    },
+
+    /** 广告位Id */
+    placementID: function () {
+        return this.proxy.placementID();
+    },
+
+    /** 加载广告 */
+    loadAd: function (userIdKey, userDataKey) {
+        var setting = {};
+        setting[ATRewardedVideoJSSDK.userIdKey] = userIdKey;
+        setting[ATRewardedVideoJSSDK.userDataKey] = userDataKey;
+        ATRewardedVideoJSSDK.loadRewardedVideo(this.placementID(), setting);
+    },
+
+    /** 显示广告 */
+    showAd: function () {
+        ATRewardedVideoJSSDK.showAdInScenario(this.placementID(), "");
+    },
+
+    /** 检测广告是否加载好 */
+    checkReady: function () {
+        // ATJSSDK.printLog("AnyThinkRewardedVideo::checkReady()   " + (ATRewardedVideoJSSDK.hasAdReady(this.placementID()) ? "Ready" : "No"));
+        if (this.proxy == null) return;
+        return ATRewardedVideoJSSDK.hasAdReady(this.placementID()) ? true : false;
+    },
+
+    /** 
+     * 激励视频加载完毕
+     * @param {*} placementId 广告位id
+     */
+    onRewardedVideoAdLoaded: function (placementId) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdLoaded(" + placementId + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdLoaded(placementId);
+    },
+
+    /**
+     * 激励视频加载失败
+     * @param {*} placementId 广告位Id
+     * @param {*} errorInfo   错误信息
+     * @returns 
+     */
+    onRewardedVideoAdFailed: function (placementId, errorInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdFailed(" + placementId + ", " + errorInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdFailed(placementId, errorInfo);
+    },
+
+    /**
+     * 激励视频开始播放
+     * @param {*} placementId 
+     * @param {*} callbackInfo 
+     * @returns 
+     */
+    onRewardedVideoAdPlayStart: function (placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdPlayStart(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdPlayStart(placementId, callbackInfo);
+    },
+
+    /**
+     * 激励视频播放结束
+     * @param {*} placementId   广告位Id
+     * @param {*} callbackInfo  回调返回信息
+     * @returns 
+     */
+    onRewardedVideoAdPlayEnd: function (placementId, callbackInfo) {
+        // ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdPlayEnd(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdPlayEnd(placementId, callbackInfo);
+    },
+
+    /**
+     * 激励视频播放失败
+     * @param {*} placementId  广告位ID 
+     * @param {*} errorInfo    错误信息
+     * @param {*} callbackInfo 回调返回信息
+     * @returns 
+     */
+    onRewardedVideoAdPlayFailed: function (placementId, errorInfo, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdPlayFailed(" + placementId + ", " + errorInfo + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdPlayFailed(placementId, errorInfo, callbackInfo);
+    },
+
+    /**
+     * 激励视频被关闭
+     * @param {*} placementId  广告位ID 
+     * @param {*} callbackInfo 回调返回信息
+     * @returns 
+     */
+    onRewardedVideoAdClosed: function (placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdClosed(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdClosed(placementId, callbackInfo);
+    },
+
+    /**
+     * 激励视频被点击
+     * @param {*} placementId  广告位ID
+     * @param {*} callbackInfo 回调返回信息
+     * @returns 
+     */
+    onRewardedVideoAdPlayClicked: function (placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onRewardedVideoAdPlayClicked(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onRewardedVideoAdPlayClicked(placementId, callbackInfo);
+    },
+
+    /**
+     * 激励视频获得奖励
+     * @param {*} placementId  广告位ID
+     * @param {*} callbackInfo 回调返回信息
+     * @returns 
+     */
+    onReward: function (placementId, callbackInfo) {
+        //ATJSSDK.printLog("AnyThinkRewardedVideo::onReward(" + placementId + ", " + callbackInfo + ")");
+        if (this.proxy == null) return;
+        this.proxy.onReward(placementId, callbackInfo);
+    }
+});
+
+module.exports = ATRewardVideoJS;
+if (!cc["ATRewardVideoJS"]) {
+    cc["ATRewardVideoJS"] = new ATRewardVideoJS();
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATRewardVideoJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7a311750-20ae-47ca-a902-7bfa3b6b5764",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 93 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts

@@ -0,0 +1,93 @@
+import AdSystem from "../../../../system/AdSystem";
+import { zgSingleton } from "../zgSingleton";
+import ATBanner from "./ATBanner";
+import ATInterstitial from "./ATInterstitial";
+import { ATNative } from "./ATNative";
+import { ATRewardVideo } from "./ATRewardVideo";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class ATSDKMgr extends zgSingleton {
+
+    /**Topon Appid */
+    public static topon_android_appId = "a5f8fa5f10c661";
+    /**Topon AppSecret */
+    public static topon_android_appSecret = "66b742dd0e502b64d783d9c66a9d30c4";
+    /**Topon 激励视频广告位 */
+    public static topon_rewardVideo_placementId = "b5f8fa6673e180";
+    /**Topon 插屏广告位 */
+    public static topon_inter_placementId = "b5f8fa77aa5262";
+    /**Topon 信息流广告位 */
+    public static topon_native_placementId = "b5f8fa77aa5262";
+    /**Topon 全屏插屏广告位 */
+    public static topon_fullinter_placementId = "b5f8fa77aa5262";
+    /**Topon 全屏插屏广告位 */
+    public static topon_banner_placementId = "b5f8fa77aa5262";
+
+    /**初始化ATSDK */
+    public initATSDK() {
+
+        cc["ATSDKMgrJS"].proxy = this;
+        cc["ATSDKMgrJS"].initATJSSDK(ATSDKMgr.topon_android_appId, ATSDKMgr.topon_android_appSecret);
+
+        //初始化激励视频广告
+        ATRewardVideo.getInstance().init();
+        //初始化原生广告
+        ATNative.getInstance().init();
+        // ATInterstitial.getInstance().init();
+        // ATBanner.getInstance().init();
+    }
+
+    /**显示视频广告 */
+    showVideoAd() {
+        ATRewardVideo.getInstance().showAd();
+    }
+
+    /** 
+     * 观看视频回调
+     * @param adPlayStateType 广告播放状态类型 观看结束、播放失败、取消(关闭)
+     */
+    watchVideoAdCallBack(adPlayStateType: AdPlayStateType) {
+        switch (adPlayStateType) {
+            case AdPlayStateType.WatchEnd:
+                AdSystem.getInstance().wacthAdSuccess();
+                break;
+            case AdPlayStateType.PlayFail:
+                AdSystem.getInstance().watchAdFail();
+                break;
+            case AdPlayStateType.Cancel:
+                AdSystem.getInstance().watchAdFail();
+                break;
+        }
+    }
+
+    /**显示插屏广告 */
+    showInterAd() {
+
+    }
+
+    /** 
+     * 加载原生广告
+     * @param type 0 是插屏 1 是全屏
+     * @param show 是否显示
+     */
+    loadNativeAd(type: number, show: boolean) {
+        ATNative.getInstance().loadNative(type, show);
+    }
+
+    /** 销毁原生广告 */
+    destroyNativeAd() {
+        ATNative.getInstance().destroyNative();
+    }
+}
+
+/** 广告播放状态类型 */
+export enum AdPlayStateType {
+    /** 观看结束 */
+    WatchEnd = 0,
+    /** 播放失败  */
+    PlayFail = 1,
+    /** 取消 */
+    Cancel = 2,
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ae75d5bf-3e70-4d66-9e67-2df74f0d86b9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 59 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgrJS.js

@@ -0,0 +1,59 @@
+require("./AnyThinkAds/ATJSSDK");
+
+var ATSDKMgrJS = cc.Class({
+
+    name: "ATSDKMgrJS",
+
+    /** 代理脚本(TS) */
+    proxy: null,
+
+    ctor: function () {
+        console.log("ATSDKMgrJS.js created! ")
+    },
+
+    /** 初始化Sdk */
+    initATJSSDK: function (appid, appsecret) {
+
+        ATJSSDK.setLogDebug(false);
+
+        var customMap = {
+            "appCustomKey1": "appCustomValue1",
+            "appCustomKey2": "appCustomValue2"
+        };
+
+        ATJSSDK.initCustomMap(customMap);
+        // ATJSSDK.setPlacementCustomMap(customPlacementId, placementCustomMap);
+
+        //替换------------------------------------------------------------------
+        var placementCustomMap = {
+            "placementCustomKey1": "placementCustomValue1",
+            "placementCustomKey2": "placementCustomValue2"
+        };
+
+        ATJSSDK.setPlacementCustomMap(this.placementID(), placementCustomMap);
+        //ATJSSDK.setGDPRLevel(ATJSSDK.NONPERSONALIZED);
+
+        var GDPRLevel = ATJSSDK.getGDPRLevel();
+        // ATJSSDK.printLog("Current GDPR Level :" + GDPRLevel);
+
+        if (cc.sys.os === cc.sys.OS_IOS) {
+            ATJSSDK.initSDK(appid, appsecret);
+        } else if (cc.sys.os === cc.sys.OS_ANDROID) {
+            ATJSSDK.initSDK(appid, appsecret);
+        }
+
+        ATJSSDK.getUserLocation(function (userLocation) {
+            // ATJSSDK.printLog("getUserLocation callback userLocation :" + userLocation);
+            if (userLocation === ATJSSDK.kATUserLocationInEU) {
+                if (ATJSSDK.getGDPRLevel() === ATJSSDK.UNKNOWN) {
+                    ATJSSDK.showGDPRAuth();
+                }
+            }
+        });
+    },
+});
+
+module.exports = ATSDKMgrJS;
+if (!cc["ATSDKMgrJS"]) {
+    cc["ATSDKMgrJS"] = new ATSDKMgrJS();
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgrJS.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f54e6146-08b7-41d3-a05a-4b6e40d1b5af",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 8 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/zgSingleton.ts

@@ -0,0 +1,8 @@
+export class zgSingleton{
+    static getInstance<T extends {}>(this: new () => T): T {
+        if(!(<any>this).instance){
+            (<any>this).instance = new this();
+        }
+        return (<any>this).instance;
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/sdk/ad/toppon/zgSingleton.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "32a8d1fd-ea9e-4cd1-baa9-a87b984269da",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 122 - 0
mk_framework/assets/script/mk/system/AdSystem.ts

@@ -0,0 +1,122 @@
+import ATSDKMgr from "../sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr";
+import { zgSingleton } from "../sdk/ad/toppon/zgSingleton";
+import JsbSystem from "./JsbSystem";
+
+/**
+ * 广告管理类脚本
+ * @description 显示/播放广告
+ * @author 冯聪
+ */
+export default class AdSystem extends zgSingleton {
+
+    constructor() {
+        super();
+        this.init();
+    }
+
+    /** 是否显示广告 */
+    public ifShowAd: boolean = false;
+
+    /** 视频广告回调 */
+    public videoAdcallBack: Function = null;
+
+    /** 初始化广告 */
+    public init() {
+        //获取广告渠道id
+        this.getAdvertiseChannel();
+        //初始化Topon广告SDK
+        ATSDKMgr.getInstance().initATSDK();
+    }
+
+    /** 获取投放渠道 和 广告位ID信息 */
+    public getAdvertiseChannel() {
+        let str = JsbSystem.getAdvertisingChannel();
+        let arr = str.split(',')
+        let channel = arr[0]
+        ATSDKMgr.topon_android_appId = arr[1]
+        ATSDKMgr.topon_android_appSecret = arr[2]
+        ATSDKMgr.topon_rewardVideo_placementId = arr[3]
+        ATSDKMgr.topon_inter_placementId = arr[4]
+        ATSDKMgr.topon_native_placementId = arr[5]
+        if (arr.length >= 7 && arr[6]) {
+            ATSDKMgr.topon_fullinter_placementId = arr[6]
+        }
+    }
+
+    /**
+     * 观看广告
+     * @param callBack 广告相关的回调
+     */
+    public watchAd(callBack: Function) {
+
+        this.videoAdcallBack = callBack;
+
+        if (!this.ifShowAd) {
+            this.wacthAdSuccess()
+        }
+        else {
+            if (cc.sys.platform != cc.sys.WECHAT_GAME) {
+                if (cc.sys.os == cc.sys.OS_ANDROID) {
+                    // jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "showVideo", "(I)V", pop);
+                    ATSDKMgr.getInstance().showVideoAd();
+                }
+                else if (cc.sys.os == cc.sys.OS_IOS) {
+                    jsb.reflection.callStaticMethod("AppController", "showVideo", "");
+                }
+            }
+            else {
+                // WxMgr.getInstance().showRewardAd(pop)
+            }
+        }
+    }
+
+    /** 观看广告失败 */
+    public watchAdFail() {
+        this.videoAdcallBack(false);
+    }
+
+    /** 观看广告取消 */
+    public watchAdCancel() {
+        this.videoAdcallBack(false);
+    }
+
+    /**
+     * 观看广告成功
+     * @param placementId 广告位id
+     */
+    public wacthAdSuccess(placementId = '') {
+        this.videoAdcallBack(true);
+    }
+
+    /** 显示原生广告 */
+    public showNativeAd(type = 0, show = true) {
+        if (cc.sys.platform != cc.sys.WECHAT_GAME) {
+            if (cc.sys.os == cc.sys.OS_ANDROID) {
+                // jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "showVideo", "(I)V", pop);
+                ATSDKMgr.getInstance().loadNativeAd(type, show);
+            }
+            else if (cc.sys.os == cc.sys.OS_IOS) {
+
+            }
+        }
+        else {
+            // WxMgr.getInstance().showRewardAd(pop)
+        }
+    }
+
+    /** 销毁原生广告 */
+    public destroyNativeAd() {
+        if (cc.sys.platform != cc.sys.WECHAT_GAME) {
+            if (cc.sys.os == cc.sys.OS_ANDROID) {
+                // jsb.reflection.callStaticMethod("org/cocos2dx/javascript/config/TTAdManagerHolder", "showVideo", "(I)V", pop);
+                ATSDKMgr.getInstance().destroyNativeAd();
+            }
+            else if (cc.sys.os == cc.sys.OS_IOS) {
+
+            }
+        }
+        else {
+            // WxMgr.getInstance().showRewardAd(pop)
+        }
+    }
+}

+ 9 - 0
mk_framework/assets/script/mk/system/AdSystem.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "1466a455-4914-4f6d-9bfe-3092c954e660",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 292 - 0
mk_framework/assets/script/mk/system/JsbSystem.ts

@@ -0,0 +1,292 @@
+/**
+ * Jsb管理类(与安卓Java类或者IOS交互)
+ * @description
+ * @author 冯聪
+ */
+export default class JsbSystem {
+
+    /**代码桥在AS中的路径 */
+    private static _JSB_ANDROID_PATH: string = "org/cocos2dx/javascript/thridSdk/ThirdSdkMgr";
+    /**代码桥在IOS中的路径 */
+    private static _JSB_IOS_PATH: string = "ThirdSdkMgr";
+
+    /**
+     * 是否文件存在
+     * @param filePath 文件路径 
+     */
+    public static isFileExit(filePath: string): boolean {
+        return jsb.fileUtils.isFileExist(filePath);
+    }
+
+    /**
+     * 获取写入的路径
+     * @description 
+     * @returns path 写入路径(string)
+     */
+    public static getWritablePath(): string {
+        return jsb.fileUtils.getWritablePath();
+    }
+
+    /** 
+     * 调用项目工程静态方法
+     * @description           调用Android与IOS对应的静态方法
+     * @param path            调用路径:"org/cocos2dx/javascript/AppActivity":java中的包名(.换成/)+class文件名,就当是路径好了
+     * @param methodName      调用的方法名:必须public static
+     * @param methodSignature 方法签名:“(Ljava/lang/String;)Ljava/lang/String;”:()内的是调用的java方法的参数类型,()外面的是返回值类
+     * @param parameters      参数:是java方法需要传入的参数(可以多个,与methodSignature中()内的数量和类型一一对应)
+     */
+    public static callStaticMethod(path: string, methodName: string, methodSignature: string, ...parameters: any): any {
+        jsb.reflection.callStaticMethod(path, methodName, methodSignature, ...parameters);
+    }
+
+    /**
+     * Java调用返回测试
+     * @description 自定义功能 JavaToCocos
+     */
+    public static backTest() {
+
+    }
+
+    /**
+     * 更新设备信息
+     * @description 自定义功能 JavaToCocos
+     * @param info  info(Java返回)
+     */
+    public static updateDeviceInfo(info) {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            //GameConst.updateDeviceInfo(info)
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+
+        }
+    }
+
+    /**
+     * 获取设备信息
+     * @description 自定义功能 CocosToJava
+     */
+    public static getDeviceInfo() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "getDeviceInfo", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod(this._JSB_IOS_PATH, "getDeviceInfo", "");
+        }
+    }
+
+    /**
+     * 获取包名
+     * @description 自定义功能 CocosToJava
+     * @returns     packName 包名
+     */
+    public static getPackageName() {
+        let packName = '';
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            packName = this.callStaticMethod(this._JSB_ANDROID_PATH, "getPackageName", "()Ljava/lang/String;");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            packName = this.callStaticMethod("CsjAdReward", "getPackageName", "");
+        }
+        return packName;
+    }
+
+    /** 
+     * 获取微信appid
+     * @description 自定义功能 CocosToJava
+     * @returns     appid 
+     */
+    public static getWxAppId() {
+        let appid = "";
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            appid = this.callStaticMethod(this._JSB_ANDROID_PATH, "getWXAppId", "()Ljava/lang/String;");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            appid = this.callStaticMethod("CsjAdReward", "getWXAppId", "",);
+        }
+        return appid;
+    }
+
+    /**
+     * 获取广告渠道和相关id
+     * @description 自定义功能 CocosToJava
+     * @returns     str 
+     */
+    public static getAdvertisingChannel(): string {
+        let str = "";
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            str = this.callStaticMethod(this._JSB_ANDROID_PATH, "getAdvertisingChannel", "()Ljava/lang/String;");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            str = this.callStaticMethod("CsjAdReward", "AdvertisingChannel", "");
+        }
+        return str;
+    }
+
+    /**
+     * 复制到剪切板
+     * @description Andorid功能 CocosToJava
+     * @param str   剪切板字符串内容
+     */
+    public static setClipboard(str: string) {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "setClipboard", "(Ljava/lang/String;)V", str);
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+
+        }
+    }
+
+    /**
+     * 请求用户授权  
+     * @description Andorid功能 CocosToJava
+     */
+    public static requestPermission() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "requestPermission", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("AppController", "requestPermission", "");
+        }
+    }
+
+    /**
+     * 获取安卓的版本号  
+     * @description Andorid功能 CocosToJava
+     */
+    public static getAppVersion() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "getAppVersion", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("AppController", "getAppVersion", "");
+        }
+    }
+
+    /**
+    * 设置安卓得版本号
+    * @description Andorid功能 JavaToCocos
+    * @param       appVersion app版本号
+    */
+    public static setAppVersion(appVersion: string) {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            // GameConst.appVersion = appVersion;
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+
+        }
+    }
+
+    /**
+     * 安装apk
+     * @description   Andorid功能 CocosToJava
+     * @param apkName apkName
+     */
+    public static installApk(apkName: string) {
+        let fullPath = this.getWritablePath() + apkName;
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "installApk", "(Ljava/lang/String;)V", fullPath);
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("GameConfig", "installApk:", "");
+        }
+    }
+
+    /** 
+     * 是否可以启动游戏
+     * @param packageName 包名
+     * @param start       如存在是否启动
+     * @returns ifCan         
+     */
+    static ifCanStartGame(packageName: string, start: boolean): boolean {
+        let isCan = false;
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            isCan = this.callStaticMethod(this._JSB_ANDROID_PATH, "isStartGame", "(Ljava/lang/String;Z)Z", packageName, start);
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            isCan = this.callStaticMethod("GameConfig", "installApk:", "");
+        }
+        return isCan;
+    }
+
+    /**
+     * 数数事件注册
+     * @description 数数SDK功能 已经自动放到AS授权后了 前端无需调用
+     * @returns 
+     */
+    static setTAEventRegister() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "setTAEventRegister", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+
+        }
+    }
+
+    /**
+     * 发送自定义事件 自定义功能 CocosToJava
+     * @description  发送统计事件
+     * @param key    事件的key值
+     * @param value  事件的value值
+     */
+    public static sendEvent(key: string, value: string) {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "sendEvent", "(Ljava/lang/String;Ljava/lang/String;)V", key, value);
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+
+        }
+    }
+
+    /**
+     * 微信授权
+     * @description 微信SDK功能 CocosToJava
+     */
+    public static WxAuth() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "WxAuth", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("AppController", "WxAuth", "");
+        }
+    }
+
+    /**
+     * 获取授权code
+     * @description 微信SDK功能 JavaToCocos
+     * @param code  微信code(Java返回)
+     */
+    public static onGetAccessCode(code) {
+
+        // 暂时注释,需要网络通信
+        // GameConst.wxCode = code;
+        // HttpMgr.Inst.wxlogin(true);
+    }
+
+    /**
+     * 微信打开小游戏
+     * @description 微信SDK功能 CocosToJava
+     */
+    public static OpenMiniGame() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "OpenMiniGame", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("AppController", "WxAuth", "");
+        }
+    }
+
+    /**
+     * 分享成微信小游戏
+     * @description 微信SDK功能 CocosToJava
+     */
+    public static ShareToMiniGame() {
+        if (cc.sys.os == cc.sys.OS_ANDROID) {
+            this.callStaticMethod(this._JSB_ANDROID_PATH, "ShareToMiniGame", "()V");
+        }
+        else if (cc.sys.os == cc.sys.OS_IOS) {
+            this.callStaticMethod("AppController", "WxAuth", "");
+        }
+    }
+}
+
+window['JsbMgr'] = JsbSystem

+ 9 - 0
mk_framework/assets/script/mk/system/JsbSystem.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "14403d61-e714-41b1-afae-9851841f2b86",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}