Commit 0ea01a0c authored by 智慧's avatar 智慧

feat:将之前降落伞的拖拽进度条改成可点击来变换进度条

parent 82d8c429
......@@ -174,7 +174,7 @@
"array": [
0,
0,
477.1677545665711,
753.4294426550072,
0,
0,
0,
......@@ -602,7 +602,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 884,
"width": 880,
"height": 24
},
"_anchorPoint": {
......@@ -614,8 +614,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-3,
-1,
0,
0,
0,
0,
0,
......@@ -667,7 +667,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 888,
"width": 876,
"height": 24
},
"_anchorPoint": {
......@@ -679,7 +679,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-3,
0,
-13,
0,
0,
......@@ -747,8 +747,8 @@
"alignMode": 1,
"_target": null,
"_alignFlags": 40,
"_left": -3,
"_right": -1,
"_left": 0,
"_right": 4,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
......
......@@ -111,45 +111,55 @@ cc.Class({
this.barTag.off(cc.Node.EventType.TOUCH_START);
this.barTag.on(cc.Node.EventType.TOUCH_START, (e) => {
console.log("TOUCH_START");
this.userDragStart = true;
this.triggerInteractive()
});
this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => {
var delta = e.getDelta();
let newX = this.barTag.x+delta.x;
newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX;
this.barTag.width = newX;
const percent = newX / maxX;
// console.log(newX, percent);
const dur = this.videoPlayer.getDuration();
// this.videoPlayer.currentTime = percent * dur
// this.updateBarByPos(this.barTag.x);
this.currentTimeLabel.string = this.formatTime(percent * dur );
this.triggerInteractive()
});
this.barTag.off(cc.Node.EventType.TOUCH_ENDED);
this.barTag.on(cc.Node.EventType.TOUCH_ENDED, (e) => {
console.log("TOUCH_ENDED");
this.userDragStart = false;
this.updateBarByPos(this.barTag.x);
this.triggerInteractive()
});
this.barTag.on(cc.Node.EventType.MOUSE_UP, (e) => {
console.log("MOUSE_UP");
this.userDragStart = false;
this.updateBarByPos(this.barTag.x);
this.triggerInteractive()
});
// this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
// this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => {
// var delta = e.getDelta();
// let newX = this.barTag.x+delta.x;
// newX = Math.min(maxX, Math.max(newX, minX));
// this.barTag.width = newX;
// const percent = newX / maxX;
// // console.log(newX, percent);
// const dur = this.videoPlayer.getDuration();
// // this.videoPlayer.currentTime = percent * dur
// // this.updateBarByPos(this.barTag.x);
// this.currentTimeLabel.string = this.formatTime(percent * dur );
// this.triggerInteractive()
// });
// this.barTag.off(cc.Node.EventType.TOUCH_ENDED);
// this.barTag.on(cc.Node.EventType.TOUCH_ENDED, (e) => {
// console.log("TOUCH_ENDED");
// this.userDragStart = false;
// this.updateBarByPos(this.barTag.x);
// this.triggerInteractive()
// });
// this.barTag.on(cc.Node.EventType.MOUSE_UP, (e) => {
// console.log("MOUSE_UP");
// this.userDragStart = false;
// this.updateBarByPos(this.barTag.x);
// this.triggerInteractive()
// });
this.barTag.off(cc.Node.EventType.TOUCH_CANCEL);
this.barTag.on(cc.Node.EventType.TOUCH_CANCEL, (e) => {
console.log("TOUCH_CANCEL");
this.userDragStart = false;
this.updateBarByPos(this.barTag.x);
this.triggerInteractive()
});
// this.barTag.off(cc.Node.EventType.TOUCH_CANCEL);
// this.barTag.on(cc.Node.EventType.TOUCH_CANCEL, (e) => {
// console.log("TOUCH_CANCEL");
// this.userDragStart = false;
// this.updateBarByPos(this.barTag.x);
// this.triggerInteractive()
// });
this.ProgressBar.node.off(cc.Node.EventType.TOUCH_START);
this.ProgressBar.node.on(cc.Node.EventType.TOUCH_START, (e) => {
const pos = e.getLocation();
......@@ -158,15 +168,15 @@ cc.Class({
this.updateBarByPos(newX);
// console.log("ProgressBar TOUCH_START", newX);
});
this.node.off(cc.Node.EventType.TOUCH_START);
this.node.on(cc.Node.EventType.TOUCH_START, (e) => {
console.log("screen TOUCH_START");
this.triggerInteractive()
});
// this.node.off(cc.Node.EventType.TOUCH_START);
// this.node.on(cc.Node.EventType.TOUCH_START, (e) => {
// console.log("screen TOUCH_START");
// this.triggerInteractive()
// });
const pgBar = this.ProgressBar.node;
this.tw = new (function(){
this._tw = cc.tween(pgBar).delay(3).to(.6, {
opacity: 0
opacity: 255
}).call(() => {
console.log('This is a callback');
this.running = false;
......@@ -191,7 +201,7 @@ cc.Class({
}
});
this.tw = cc.tween(this.ProgressBar.node).delay(3).to(.6, {
opacity: 0
opacity: 255
}).call(() => {
console.log('This is a callback');
// this.tw.stop();
......@@ -262,7 +272,7 @@ cc.Class({
const minX = 0;
let newX = percent * maxX;
newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX;
this.barTag.width = newX;
},
formatTime(time) {
if (time === undefined) {
......
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