|
@@ -1,6 +1,7 @@
|
|
import { _decorator, SpriteFrame, sys } from "cc";
|
|
import { _decorator, SpriteFrame, sys } from "cc";
|
|
import { gameManager } from "./run/gameManager";
|
|
import { gameManager } from "./run/gameManager";
|
|
import { config } from "./config";
|
|
import { config } from "./config";
|
|
|
|
+import { statisticsManager } from "./statisticsManager";
|
|
//管理广告、分享、SDK相关内容的组件
|
|
//管理广告、分享、SDK相关内容的组件
|
|
export class SdkUtil {
|
|
export class SdkUtil {
|
|
public static platform: string = 'cocos'; //平台
|
|
public static platform: string = 'cocos'; //平台
|
|
@@ -19,6 +20,7 @@ export class SdkUtil {
|
|
|
|
|
|
|
|
|
|
public static videoAd:any =null;
|
|
public static videoAd:any =null;
|
|
|
|
+ public static isLookAd:boolean = false; //是否在看广告
|
|
|
|
|
|
public static tt_systemInfo: any = null; //抖音_系统信息
|
|
public static tt_systemInfo: any = null; //抖音_系统信息
|
|
private static tt_isSupportSidebar:boolean = false; //抖音_是否支持侧边栏
|
|
private static tt_isSupportSidebar:boolean = false; //抖音_是否支持侧边栏
|
|
@@ -237,17 +239,20 @@ export class SdkUtil {
|
|
}
|
|
}
|
|
|
|
|
|
SdkUtil.videoAd.onLoad(() => {
|
|
SdkUtil.videoAd.onLoad(() => {
|
|
|
|
+ SdkUtil.isLookAd = true
|
|
SdkUtil.videoAd.show();
|
|
SdkUtil.videoAd.show();
|
|
console.log("广告加载完成");
|
|
console.log("广告加载完成");
|
|
});
|
|
});
|
|
SdkUtil.videoAd.onClose((res) => {
|
|
SdkUtil.videoAd.onClose((res) => {
|
|
call_back(res)
|
|
call_back(res)
|
|
|
|
+ SdkUtil.isLookAd = false
|
|
SdkUtil.videoAd.destroy()
|
|
SdkUtil.videoAd.destroy()
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
});
|
|
});
|
|
SdkUtil.videoAd.onError((res) => {
|
|
SdkUtil.videoAd.onError((res) => {
|
|
let errorString = res.errCode + '-' + res.errMsg
|
|
let errorString = res.errCode + '-' + res.errMsg
|
|
call_back({isEnded:false,errorString:errorString})
|
|
call_back({isEnded:false,errorString:errorString})
|
|
|
|
+ SdkUtil.isLookAd = false
|
|
SdkUtil.videoAd.destroy()
|
|
SdkUtil.videoAd.destroy()
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
});
|
|
});
|
|
@@ -289,9 +294,12 @@ export class SdkUtil {
|
|
SdkUtil.tt_isToEnterFromSidebar = true
|
|
SdkUtil.tt_isToEnterFromSidebar = true
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- // tt.onHide(()=>{
|
|
|
|
- // console.log('tt.onHide tt.onHide tt.onHide')
|
|
|
|
- // })
|
|
|
|
|
|
+ tt.onHide(()=>{
|
|
|
|
+ console.log('tt.onHide')
|
|
|
|
+ if(SdkUtil.isLookAd==false) {
|
|
|
|
+ statisticsManager.uploadRecordUserLevel(false)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
|
|
tt.checkScene({
|
|
tt.checkScene({
|
|
scene: "sidebar",
|
|
scene: "sidebar",
|
|
@@ -350,7 +358,7 @@ export class SdkUtil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- if(this.ttIsScreenRecording()==true) {
|
|
|
|
|
|
+ if(this.tt_isRecording==true) {
|
|
this.ttStopScreenRecording()
|
|
this.ttStopScreenRecording()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -390,11 +398,6 @@ export class SdkUtil {
|
|
this.tt_gameRecorder.stop()
|
|
this.tt_gameRecorder.stop()
|
|
}
|
|
}
|
|
|
|
|
|
- // 抖音是否屏幕录制
|
|
|
|
- public static ttIsScreenRecording():boolean {
|
|
|
|
- return this.tt_isRecording;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// 抖音获取屏幕录制视频文件
|
|
// 抖音获取屏幕录制视频文件
|
|
public static ttGetScreenRecordingVideoPath():string {
|
|
public static ttGetScreenRecordingVideoPath():string {
|
|
return this.tt_recordVideoPath;
|
|
return this.tt_recordVideoPath;
|