瀏覽代碼

Merge branch 'dev' of http://svn.ouj.com:3000/DWG/taptapstar into dev

# Conflicts:
#	assets/scene/game.fire
#	assets/scripts/game/HomeSideCtrl.js
smallqiang 5 年之前
父節點
當前提交
0c6d5ec77c

二進制
assets/resources/textures/game/record_start.png


+ 31 - 0
assets/resources/textures/game/record_start.png.meta

@@ -0,0 +1,31 @@
+{
+  "ver": "2.2.0",
+  "uuid": "93c1aa2d-cb0f-4ca7-b59b-bc0688c60558",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "subMetas": {
+    "record_start": {
+      "ver": "1.0.3",
+      "uuid": "69496493-f55e-46d9-8895-d280a1a1acea",
+      "rawTextureUuid": "93c1aa2d-cb0f-4ca7-b59b-bc0688c60558",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": -1,
+      "offsetY": -3,
+      "trimX": 0,
+      "trimY": 6,
+      "width": 102,
+      "height": 76,
+      "rawWidth": 104,
+      "rawHeight": 82,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

二進制
assets/resources/textures/game/record_video.png


+ 31 - 0
assets/resources/textures/game/record_video.png.meta

@@ -0,0 +1,31 @@
+{
+  "ver": "2.2.0",
+  "uuid": "f1ac1cb9-226d-4f46-aa8d-232414b0cc9c",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "subMetas": {
+    "record_video": {
+      "ver": "1.0.3",
+      "uuid": "8ffee2f2-b3a5-4e36-982c-bc062b80f9ee",
+      "rawTextureUuid": "f1ac1cb9-226d-4f46-aa8d-232414b0cc9c",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": -3,
+      "trimX": 1,
+      "trimY": 6,
+      "width": 102,
+      "height": 76,
+      "rawWidth": 104,
+      "rawHeight": 82,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

文件差異過大導致無法顯示
+ 750 - 240
assets/scene/game.fire


+ 0 - 29
assets/scripts/game/Game.js

@@ -439,34 +439,5 @@ cc.Class({
         }
     },
 
-    //处理头条录制视频然后分享的功能
-    handleTTRecordVideo: _.debounce((event) => {
-        const recorder = tt.getGameRecorderManager();
-
-        recorder.start({
-        microphoneEnabled: true,
-        })
-
-        recorder.onStart(res =>{
-        // 录屏开始
-        console.log(res.microphoneStatus);
-        // do somethine;
-        })
-
-        recorder.onStop(res =>{
-        // 录屏结束;
-        console.log(res.videoPath);
-        })
-
-        recorder.onPause(() =>{
-        // 录屏已暂停;
-        })
-
-        recorder.onResume(() =>{
-        // 录屏已恢复;
-        })
-
-
-    }, 1000, true),
     // update (dt) {},
 });

+ 71 - 4
assets/scripts/game/HomeSideCtrl.js

@@ -40,7 +40,14 @@ cc.Class({
         //自动点击
         friendRewardNode: cc.Node,
         //邀请
-        inviteNode: cc.Node
+        inviteNode: cc.Node,
+
+        //// 以下都是头条录屏功能需要的节点
+        recordNode: cc.Node,
+        startRecordNode: cc.Node,
+        /// 正在录屏
+        recordingNode: cc.Node,
+        recordTimeRichText: cc.RichText,
     },
 
     // LIFE-CYCLE CALLBACKS:
@@ -58,10 +65,14 @@ cc.Class({
         }
 
         /// 如果是头条那么隐藏商城
-        if (window.tt != undefined) {
+        if (window.tt !== undefined) {
             this.storeNode.active = false;
             this.friendRewardNode.active = false;
             this.inviteNode.active = false;
+            this._starRecord = false;
+            this._recordTime = 0;
+        } else {
+            this.recordNode.active = false;
         }
 
         //判断正在审核中的版本隐藏7天登录按钮或已完成7天登录任务
@@ -162,7 +173,7 @@ cc.Class({
         this.helpRedNode.active = redTypes.indexOf(GameRedDot.friendAward) != -1;
         /// 只要这里一个有红点就都有红点
         this.giftRedNode.active = this.awardRedNode.active || this.inviteFriendRedNode.active || this.signRedNode.active;
-        if (GameGlobal.isShowBar) {
+        if (GameGlobal.isShowBar && window.tt == undefined) {
             let isStoreRed = (redTypes.indexOf(GameRedDot.storeDiamond) != -1 || redTypes.indexOf(GameRedDot.storeCoin) != -1);
             this.storeRedNode.active = isStoreRed;
             if (isStoreRed) {
@@ -258,7 +269,63 @@ cc.Class({
 
     showMoreWelfare() {
         this.handleShowMore();
-    }
+    },
+
+    recordTimeAction() {
+        this._recordTime += 1;
+        this.recordTimeRichText.string = `<b><color=#fdfdef >${DWTool.calculateTime(this._recordTime)}</c></b>`;
+    },
+
+    //处理头条录制视频然后分享的功能
+    handleTTRecordVideo() {
+        let recorder = tt.getGameRecorderManager();
+        /// 如果是开始录制了
+        if (this._starRecord) {
+            recorder.stop();
+        } else {
+            recorder.start({
+                duration: 120,
+                microphoneEnabled: true,
+            });
+        }
+        recorder.onStart(res =>{
+            // 录屏开始
+            console.log('录屏开始');
+            GameGlobal.commonAlert.showCommonErrorAlert('录屏开始');
+            this._starRecord = true;
+            this.startRecordNode.active = false;
+            this.recordingNode.active = true;
+            this.schedule(this.recordTimeAction, 1);
+        })
+
+        recorder.onStop(res =>{
+            // 录屏结束;
+            GameGlobal.commonAlert.showCommonErrorAlert('录屏结束');
+            this._starRecord = false;
+            this.startRecordNode.active = true;
+            this.recordingNode.active = false;
+            this.recordTimeRichText.string = '<b><color=#fdfdef >00:00</c></b>';
+            this._recordTime = 0;
+            this.unschedule(this.recordTimeAction, this);
+            tt.shareVideo({
+                videoPath: `${res.videoPath}`,
+                success () {
+                  console.log(`分享成功!`);
+                },
+                fail (e) {
+                  console.log(`分享失败!`);
+                }
+              });
+        })
+
+        recorder.onPause(() =>{
+        // 录屏已暂停;
+        })
+
+        recorder.onResume(() =>{
+        // 录屏已恢复;
+        })
+    },
 });
 
 

部分文件因文件數量過多而無法顯示