future 1 жил өмнө
parent
commit
bb093f2685

+ 1 - 1
assets/script/config.ts

@@ -3,7 +3,7 @@ import { scene_item_data, widget_item_data } from '../data/data';
 const { ccclass, property } = _decorator;
 
 export class config {
-    static debug = false;
+    static debug = true;
     static gameName = "神秘的笔记";
     static select_res_and_control_type = {
         RES_TYPE:0,

+ 1 - 1
assets/script/run/game_run.ts

@@ -32,7 +32,7 @@ export class game_run extends Component {
     @property(gameManager) mGameManger:gameManager = null;
 
     protected start(): void {
-        SdkUtil.ttRegisterSidebar()
+        SdkUtil.init()
         this.btn_close.on(Node.EventType.TOUCH_END,()=>{
             this.close()
         })

+ 27 - 1
assets/script/sdkUtil.ts

@@ -20,7 +20,8 @@ export class SdkUtil {
 
     public static videoAd:any =null;
 
-    public static tt_isSupportSidebar:boolean = false;   //抖音_是否支持侧边栏
+    public static tt_systemInfo: any = null;               //抖音_系统信息
+    public static tt_isSupportSidebar:boolean = false;     //抖音_是否支持侧边栏
     public static tt_isToEnterFromSidebar:boolean = false; //抖音_是否从侧边栏进入
 
     private static tt_gameRecorder:any = null;      //抖音游戏录制
@@ -28,6 +29,11 @@ export class SdkUtil {
     private static tt_totalRecord:number = 300;     //抖音总录制时间
     private static tt_isRecording:boolean = false;  //抖音是否录制中
 
+    public static init() {
+        this.ttRegisterSidebar()
+        this.ttGetSystemInfo()
+    }
+
     /**
        * 自定义事件统计
        *
@@ -231,6 +237,20 @@ export class SdkUtil {
         }
     }
 
+    /**
+     * 抖音获取系统信息
+     */
+    public static ttGetSystemInfo() {
+        if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
+            tt.getSystemInfo({
+                success:(res) => {
+                    // console.log('tt.getSystemInfo=',res)
+                    SdkUtil.tt_systemInfo = res
+                }
+            })
+        }
+    }
+
     /**
      * 抖音侧边栏
      * 
@@ -302,6 +322,11 @@ export class SdkUtil {
             return
         }
 
+        if(this.tt_systemInfo.platform == 'devtools') {
+            console.log('抖音模拟器')
+            return
+        }
+
         if(this.ttIsScreenRecording()==true) {
             this.ttStopScreenRecording()
         }
@@ -322,6 +347,7 @@ export class SdkUtil {
         this.tt_gameRecorder.onError((e)=> {
             console.log('ttGameRecord error:',e)
         })
+        
     }
 
     // 抖音关闭屏幕录制