|
@@ -35,6 +35,14 @@ cc.Class({
|
|
storeNode: cc.Node,
|
|
storeNode: cc.Node,
|
|
|
|
|
|
drawNode: cc.Node,
|
|
drawNode: cc.Node,
|
|
|
|
+
|
|
|
|
+ //// 以下都是头条录屏功能需要的节点
|
|
|
|
+
|
|
|
|
+ recordNode: cc.Node,
|
|
|
|
+ startRecordNode: cc.Node,
|
|
|
|
+ /// 正在录屏
|
|
|
|
+ recordingNode: cc.Node,
|
|
|
|
+ recordTimeRichText: cc.RichText,
|
|
},
|
|
},
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
// LIFE-CYCLE CALLBACKS:
|
|
@@ -52,8 +60,12 @@ cc.Class({
|
|
}
|
|
}
|
|
|
|
|
|
/// 如果是头条那么隐藏商城
|
|
/// 如果是头条那么隐藏商城
|
|
- if (window.tt != undefined) {
|
|
|
|
|
|
+ if (window.tt !== undefined) {
|
|
this.storeNode.active = false;
|
|
this.storeNode.active = false;
|
|
|
|
+ this._starRecord = false;
|
|
|
|
+ this._recordTime = 0;
|
|
|
|
+ } else {
|
|
|
|
+ this.recordNode.active = false;
|
|
}
|
|
}
|
|
|
|
|
|
//判断正在审核中的版本隐藏7天登录按钮或已完成7天登录任务
|
|
//判断正在审核中的版本隐藏7天登录按钮或已完成7天登录任务
|
|
@@ -148,7 +160,7 @@ cc.Class({
|
|
this.helpRedNode.active = redTypes.indexOf(GameRedDot.friendAward) != -1;
|
|
this.helpRedNode.active = redTypes.indexOf(GameRedDot.friendAward) != -1;
|
|
/// 只要这里一个有红点就都有红点
|
|
/// 只要这里一个有红点就都有红点
|
|
this.giftRedNode.active = this.awardRedNode.active || this.inviteFriendRedNode.active || this.signRedNode.active;
|
|
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);
|
|
let isStoreRed = (redTypes.indexOf(GameRedDot.storeDiamond) != -1 || redTypes.indexOf(GameRedDot.storeCoin) != -1);
|
|
this.storeRedNode.active = isStoreRed;
|
|
this.storeRedNode.active = isStoreRed;
|
|
if (isStoreRed) {
|
|
if (isStoreRed) {
|
|
@@ -244,7 +256,64 @@ cc.Class({
|
|
|
|
|
|
showMoreWelfare() {
|
|
showMoreWelfare() {
|
|
this.handleShowMore();
|
|
this.handleShowMore();
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ recordTimeAction() {
|
|
|
|
+ this._recordTime += 1;
|
|
|
|
+ this.recordTimeRichText.string = `<b><color=#fdfdef >${DWTool.calculateTime(this._recordTime)}</c></b>`;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //处理头条录制视频然后分享的功能
|
|
|
|
+ handleTTRecordVideo() {
|
|
|
|
+ debugger
|
|
|
|
+ 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(() =>{
|
|
|
|
+ // 录屏已恢复;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|