Commit e73c5be5 authored by 李维's avatar 李维

优化背景显示

parent 61c13b34
......@@ -570,6 +570,8 @@ export default class VideoPlayerComponent extends cc.Component {
if (!this._isReadyToPlay) {
console.log("视频还未准备好")
return;
} else {
console.log("播放")
}
cc.find(`Canvas/text_tips`).active = false;
......
......@@ -93,12 +93,14 @@ export default class NewClass extends cc.Component {
this.node.emit("play")
this.btn_play.active = false;
this.btn_pause.active = true;
this.scheduleHideProgressBar();
}
onPauseClick() {
this.node.emit("pause")
this.btn_pause.active = false;
this.btn_play.active = true;
this.scheduleHideProgressBar();
}
onFuscreenClick() {
......@@ -131,10 +133,7 @@ export default class NewClass extends cc.Component {
show(){
this.node.opacity = 255;
this.node.x = 0;
this.cleanMyTimeout()
this.hideSetTimeoutId = setTimeout(() => {
this.hide()
}, 5000);
this.scheduleHideProgressBar();
}
hide(){
......@@ -156,6 +155,13 @@ export default class NewClass extends cc.Component {
}, 1000)
}
scheduleHideProgressBar() {
this.cleanMyTimeout()
this.hideSetTimeoutId = setTimeout(() => {
this.hide()
}, 5000);
}
cleanMyTimeout() {
if(this.hideSetTimeoutId) {
clearTimeout(this.hideSetTimeoutId);
......@@ -235,19 +241,27 @@ export default class NewClass extends cc.Component {
this.setProgress(percent, null, null);
this.show()
});
this.node.off(cc.Node.EventType.TOUCH_END);
this.node.on(cc.Node.EventType.TOUCH_END, (e) => {
this.draging = false;
this.node.emit("play")
this.centerInfo.active = false;
if(this.draging) {
this.draging = false;
this.node.emit("play")
this.btn_play.active = false;
this.btn_pause.active = true;
this.centerInfo.active = false;
}
});
this.node.off(cc.Node.EventType.MOUSE_UP);
this.node.on(cc.Node.EventType.MOUSE_UP, (e) => {
this.draging = false;
this.node.emit("play");
this.centerInfo.active = false;
if(this.draging) {
this.draging = false;
this.node.emit("play")
this.btn_play.active = false;
this.btn_pause.active = true;
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