Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
et_02
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
et_02
Commits
0ea01a0c
Commit
0ea01a0c
authored
Feb 25, 2021
by
智慧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:将之前降落伞的拖拽进度条改成可点击来变换进度条
parent
82d8c429
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
44 deletions
+54
-44
helloworld.fire
play/assets/sbox-video-ljx/Scene/helloworld.fire
+8
-8
VideoPlayer.js
play/assets/sbox-video-ljx/Script/VideoPlayer.js
+46
-36
No files found.
play/assets/sbox-video-ljx/Scene/helloworld.fire
View file @
0ea01a0c
...
...
@@ -174,7 +174,7 @@
"array": [
0,
0,
477.1677545665711
,
753.4294426550072
,
0,
0,
0,
...
...
@@ -602,7 +602,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 88
4
,
"width": 88
0
,
"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": 8
88
,
"width": 8
76
,
"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,
...
...
play/assets/sbox-video-ljx/Script/VideoPlayer.js
View file @
0ea01a0c
...
...
@@ -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_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_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
.
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment