Commit e73c5be5 authored by 李维's avatar 李维

优化背景显示

parent 61c13b34
...@@ -570,6 +570,8 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -570,6 +570,8 @@ export default class VideoPlayerComponent extends cc.Component {
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
console.log("视频还未准备好") console.log("视频还未准备好")
return; return;
} else {
console.log("播放")
} }
cc.find(`Canvas/text_tips`).active = false; cc.find(`Canvas/text_tips`).active = false;
......
...@@ -93,12 +93,14 @@ export default class NewClass extends cc.Component { ...@@ -93,12 +93,14 @@ export default class NewClass extends cc.Component {
this.node.emit("play") this.node.emit("play")
this.btn_play.active = false; this.btn_play.active = false;
this.btn_pause.active = true; this.btn_pause.active = true;
this.scheduleHideProgressBar();
} }
onPauseClick() { onPauseClick() {
this.node.emit("pause") this.node.emit("pause")
this.btn_pause.active = false; this.btn_pause.active = false;
this.btn_play.active = true; this.btn_play.active = true;
this.scheduleHideProgressBar();
} }
onFuscreenClick() { onFuscreenClick() {
...@@ -131,10 +133,7 @@ export default class NewClass extends cc.Component { ...@@ -131,10 +133,7 @@ export default class NewClass extends cc.Component {
show(){ show(){
this.node.opacity = 255; this.node.opacity = 255;
this.node.x = 0; this.node.x = 0;
this.cleanMyTimeout() this.scheduleHideProgressBar();
this.hideSetTimeoutId = setTimeout(() => {
this.hide()
}, 5000);
} }
hide(){ hide(){
...@@ -156,6 +155,13 @@ export default class NewClass extends cc.Component { ...@@ -156,6 +155,13 @@ export default class NewClass extends cc.Component {
}, 1000) }, 1000)
} }
scheduleHideProgressBar() {
this.cleanMyTimeout()
this.hideSetTimeoutId = setTimeout(() => {
this.hide()
}, 5000);
}
cleanMyTimeout() { cleanMyTimeout() {
if(this.hideSetTimeoutId) { if(this.hideSetTimeoutId) {
clearTimeout(this.hideSetTimeoutId); clearTimeout(this.hideSetTimeoutId);
...@@ -238,16 +244,24 @@ export default class NewClass extends cc.Component { ...@@ -238,16 +244,24 @@ export default class NewClass extends cc.Component {
this.node.off(cc.Node.EventType.TOUCH_END); this.node.off(cc.Node.EventType.TOUCH_END);
this.node.on(cc.Node.EventType.TOUCH_END, (e) => { this.node.on(cc.Node.EventType.TOUCH_END, (e) => {
if(this.draging) {
this.draging = false; this.draging = false;
this.node.emit("play") this.node.emit("play")
this.btn_play.active = false;
this.btn_pause.active = true;
this.centerInfo.active = false; this.centerInfo.active = false;
}
}); });
this.node.off(cc.Node.EventType.MOUSE_UP); this.node.off(cc.Node.EventType.MOUSE_UP);
this.node.on(cc.Node.EventType.MOUSE_UP, (e) => { this.node.on(cc.Node.EventType.MOUSE_UP, (e) => {
if(this.draging) {
this.draging = false; this.draging = false;
this.node.emit("play"); this.node.emit("play")
this.btn_play.active = false;
this.btn_pause.active = true;
this.centerInfo.active = false; this.centerInfo.active = false;
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment