Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dg29_museum
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
dg29_museum
Commits
126da80b
Commit
126da80b
authored
Dec 31, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复重播bug
parent
fda2e532
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
394 deletions
+10
-394
dg29_museum.fire
assets/dg29_museum/scene/dg29_museum.fire
+5
-30
dg29_museum.ts
assets/dg29_museum/scene/dg29_museum.ts
+4
-2
dg29_museum_game.ts
assets/dg29_museum/scene/dg29_museum_game.ts
+1
-362
No files found.
assets/dg29_museum/scene/dg29_museum.fire
View file @
126da80b
...
@@ -5319,31 +5319,6 @@
...
@@ -5319,31 +5319,6 @@
"btn_go": {
"btn_go": {
"__id__": 101
"__id__": 101
},
},
"barTag": {
"__id__": 117
},
"ProgressBar": {
"__id__": 115
},
"currentTimeLabel": {
"__id__": 129
},
"touchlayer": null,
"layout_video": {
"__id__": 113
},
"videoControls": {
"__id__": 114
},
"pauseButton": {
"__id__": 125
},
"playButton": {
"__id__": 122
},
"video_canvas": {
"__id__": 10
},
"_id": "ecvaVWEwVJS5w6icTw0NSx"
"_id": "ecvaVWEwVJS5w6icTw0NSx"
},
},
{
{
...
@@ -5677,7 +5652,7 @@
...
@@ -5677,7 +5652,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-833.906,
-833.906,
-
458.762
,
-
392.138
,
0,
0,
0,
0,
0,
0,
...
@@ -5931,11 +5906,11 @@
...
@@ -5931,11 +5906,11 @@
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
"_target": null,
"_target": null,
"_alignFlags":
12
,
"_alignFlags":
0
,
"_left": 101.09400000000005,
"_left": 101.09400000000005,
"_right": 0,
"_right": 0,
"_top": 0,
"_top": 0,
"_bottom":
36.238
,
"_bottom":
102.86200000000002
,
"_verticalCenter": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsLeft": true,
...
@@ -6246,7 +6221,7 @@
...
@@ -6246,7 +6221,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
719.777,
719.777,
-
458.136
,
-
391.512
,
0,
0,
0,
0,
0,
0,
...
@@ -7028,7 +7003,7 @@
...
@@ -7028,7 +7003,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-748.719,
-748.719,
-
465.866
,
-
399.242
,
0,
0,
0,
0,
0,
0,
...
...
assets/dg29_museum/scene/dg29_museum.ts
View file @
126da80b
...
@@ -85,7 +85,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -85,7 +85,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
tryPlayVideo
()
{
tryPlayVideo
()
{
cc
.
log
(
"
touch layer--
"
)
cc
.
log
(
"
touch layer--
"
)
if
(
this
.
prepared
)
{
if
(
this
.
prepared
)
{
this
.
prepared
=
false
;
this
.
prepared
=
false
;
this
.
vplayer
.
volume
=
0
;
this
.
vplayer
.
volume
=
0
;
...
@@ -114,10 +114,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -114,10 +114,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
WrongList
=
[];
this
.
WrongList
=
[];
}
}
async
playVideo
()
{
playVideo
()
{
this
.
videoCtrl
.
active
=
true
;
this
.
videoCtrl
.
active
=
true
;
this
.
node
.
getChildByName
(
"
bg
"
).
active
=
false
;
this
.
node
.
getChildByName
(
"
bg
"
).
active
=
false
;
this
.
vplayer
.
node
.
active
=
true
;
this
.
videoCtrl
.
getComponent
(
videoCtrl
).
setVideCom
(
this
.
vplayer
);
this
.
videoCtrl
.
getComponent
(
videoCtrl
).
setVideCom
(
this
.
vplayer
);
this
.
vplayer
.
volume
=
1
;
this
.
vplayer
.
volume
=
1
;
this
.
vplayer
.
node
.
scale
=
1
;
this
.
vplayer
.
node
.
scale
=
1
;
...
...
assets/dg29_museum/scene/dg29_museum_game.ts
View file @
126da80b
...
@@ -61,7 +61,6 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -61,7 +61,6 @@ export default class dg29_museum_game extends cc.Component {
this
.
label_tip_wait
.
active
=
false
;
this
.
label_tip_wait
.
active
=
false
;
this
.
label_tip_ing
.
active
=
false
;
this
.
label_tip_ing
.
active
=
false
;
this
.
rich_content
.
active
=
false
;
this
.
rich_content
.
active
=
false
;
this
.
layout_video
.
active
=
false
;
}
}
// 事件监听
// 事件监听
initEvent
()
{
initEvent
()
{
...
@@ -288,19 +287,6 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -288,19 +287,6 @@ export default class dg29_museum_game extends cc.Component {
}
}
//-----------------------------------------Video------------------------------
//-----------------------------------------Video------------------------------
@
property
(
cc
.
Node
)
barTag
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
ProgressBar
:
cc
.
Node
=
null
;
// @property(cc.VideoPlayer) videoPlayer: cc.VideoPlayer = null;
@
property
(
cc
.
Label
)
currentTimeLabel
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
touchlayer
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
layout_video
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
videoControls
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
pauseButton
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
playButton
:
cc
.
Node
=
null
;
private
_isReadyToPlay
:
boolean
;
showUI
()
{
showUI
()
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
,
'
bg
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
,
'
bg
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
,
'
layout_game
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
,
'
layout_game
'
),
true
)
...
@@ -314,62 +300,11 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -314,62 +300,11 @@ export default class dg29_museum_game extends cc.Component {
this
.
xiaodi
.
hideAll
();
this
.
xiaodi
.
hideAll
();
}
}
@
property
(
cc
.
Node
)
video_canvas
:
cc
.
Node
=
null
;
// hideVideoPlayer() {
// if (!this.node) return;
// if (!this.videoPlayer) return;
// if (!this.layout_video) return;
// this.layout_video.active = true;
// this.videoPlayer.stayOnBottom = true;
// this.videoPlayer.node.x = 0;
// this.videoPlayer.node.y = 0;
// this.videoPlayer.node.width = 100;
// this.videoPlayer.node.height = 100;
// }
// showVideoPlayer() {
// if (!this.node) return;
// if (!this.videoPlayer) return;
// if (!this.layout_video) return;
// this.hideUI();
// this.scheduleOnce(() => {
// this.layout_video.active = true;
// this.videoPlayer.stayOnBottom = true;
// this.videoPlayer.node.x = this.video_canvas.x;
// this.videoPlayer.node.y = this.video_canvas.y;
// this.videoPlayer.node.width = this.video_canvas.width;
// this.videoPlayer.node.height = this.video_canvas.height;
// if (!this._isReadyToPlay) {
// //首次播放
// this._isReadyToPlay = false;
// // this.videoPlayer.remoteURL = this.data.video;
// pg.view.touchOn(this.playButton, this.play, this);
// pg.view.touchOn(this.pauseButton, this.pause, this);
// }
// //重复播放
// this.videoPlayer.currentTime = 0;
// this._isPlayComplated = false;
// this.play();
// this.scheduleOnce(() => {
// if (!this.node) return;
// if (!this.videoPlayer) return;
// if (!this.layout_video) return;
// this.videoPlayer.stayOnBottom = false;
// this.videoControls.active = false;
// }, 3);
// }, 0.1)
// }
private
timeCtrl
:
TimeCtrl
;
private
timeCtrl
:
TimeCtrl
;
showVideo
()
{
showVideo
()
{
return
new
Promise
(
async
(
reslove
)
=>
{
return
new
Promise
(
async
(
reslove
)
=>
{
this
.
hideUI
();
this
.
hideUI
();
pg
.
event
.
emit
(
"
play_video
"
)
pg
.
event
.
emit
(
"
play_video
"
)
// if (1) return;
// this.showVideoPlayer();
this
.
timeCtrl
=
pg
.
time
.
delayCtrl
()
this
.
timeCtrl
=
pg
.
time
.
delayCtrl
()
this
.
timeCtrl
.
fillTime
(
99999
);
this
.
timeCtrl
.
fillTime
(
99999
);
await
this
.
timeCtrl
.
wait
();
await
this
.
timeCtrl
.
wait
();
...
@@ -378,156 +313,9 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -378,156 +313,9 @@ export default class dg29_museum_game extends cc.Component {
}
}
hideVideo
()
{
hideVideo
()
{
this
.
timeCtrl
.
reset
();
this
.
timeCtrl
.
reset
();
// this.videoPlayer.node.x = -10000;
// this.videoPlayer.node.y = -10000;
this
.
layout_video
.
active
=
false
;
this
.
showUI
();
this
.
showUI
();
}
}
// initVideoUrl() {
// this.prepared = true;
// this.touchlayer.on(cc.Node.EventType.TOUCH_START, this.tryPlayVideo, this)
// this.touchlayer._touchListener.setSwallowTouches(false)
// this.videoPlayer.node.active = true;
// this.videoPlayer.remoteURL = this.data.video;
// this.videoPlayer.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
// }
// private prepared: boolean;
// tryPlayVideo() {
// cc.log("touch layer--")
// if (this.prepared) {
// this.prepared = false;
// this.videoPlayer.volume = 0;
// this.videoPlayer.play();
// this.scheduleOnce(() => {
// this.videoPlayer.volume = 1;
// this.videoPlayer.pause();
// }, 1)
// }
// }
// initVideoPlayer() {
// if (1) return;
// this.initVideoUrl();
// this.videoPlayer.node.x = -10000;
// this.videoPlayer.node.y = -10000;
// this.layout_video.active = false;
// // this.videoPlayer.node.on('ready-to-play', () => {
// // console.log('ready-to-play');
// // this._isReadyToPlay = true;
// // this._isPlayComplated = false;
// // this.videoPlayer.currentTime = 0;
// // });
// // this.videoPlayer.node.on('meta-loaded', () => {
// // console.log('meta-loaded');
// // });
// // this.videoPlayer.node.on('clicked', () => {
// // if (!this.node) return;
// // if (!this.videoPlayer) return;
// // if (!this.layout_video) return;
// // this.videoPlayer.stayOnBottom = true;
// // this.videoControls.active = true;
// // if (this.time1) {
// // clearTimeout(this.time1);
// // }
// // this.time1 = setTimeout(() => {
// // if (!this.node) return;
// // if (!this.videoPlayer) return;
// // if (!this.layout_video) return;
// // this.videoPlayer.stayOnBottom = false;
// // this.videoControls.active = false;
// // }, 6000);
// // });
// // this.videoPlayer.node.on('touchstart', () => {
// // if (!this.node) return;
// // if (!this.videoPlayer) return;
// // if (!this.layout_video) return;
// // this.videoPlayer.stayOnBottom = true;
// // this.videoControls.active = true;
// // if (this.time1) {
// // clearTimeout(this.time1);
// // }
// // this.time1 = setTimeout(() => {
// // if (!this.node) return;
// // if (!this.videoPlayer) return;
// // if (!this.layout_video) return;
// // this.videoPlayer.stayOnBottom = false;
// // this.videoControls.active = false;
// // }, 6000);
// // });
// // this.videoPlayer.node.on('playing', () => {
// // this.playButton.active = false;
// // this.pauseButton.active = true;
// // });
// // this.videoPlayer.node.on('paused', () => {
// // console.log('paused');
// // this.playButton.active = true;
// // this.pauseButton.active = false;
// // });
// // this.videoPlayer.node.on('stopped', () => {
// // console.log('stopped');
// // this.playButton.active = true;
// // this.pauseButton.active = false;
// // });
// // this.videoPlayer.node.on('completed', async () => {
// // console.log('completed');
// // this._isPlayComplated = true;
// // this.playButton.active = false;
// // this.pauseButton.active = false;
// // // 循环播放下一个
// // this.hideVideo();
// // });
// // cc.view.setResizeCallback((params) => {
// // console.log('Resize', params);
// // this.initdDrag()
// // });
// // this.initdDrag();
// }
// initdDrag() {
// const maxX = this.ProgressBar.width;
// const minX = 0;
// this.barTag.off(cc.Node.EventType.TOUCH_START);
// this.barTag.on(cc.Node.EventType.TOUCH_START, (e) => {
// if (!this._isReadyToPlay) {
// return;
// }
// console.log("TOUCH_START");
// });
// this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
// this.barTag.on(cc.Node.EventType.TOUCH_MOVE, (e) => {
// if (!this._isReadyToPlay) {
// return;
// }
// const worldPos = e.getLocation();
// const localPos = this.barTag.parent.convertToNodeSpaceAR(worldPos);
// let newX = localPos.x;
// newX = Math.min(maxX, Math.max(newX, minX));
// this.barTag.x = newX;
// const percent = newX / maxX;
// const dur = this.videoPlayer.getDuration();
// this.currentTimeLabel.string = this.formatTime(percent * dur);
// this.videoPlayer.currentTime = percent * dur;
// });
// this.barTag.off(cc.Node.EventType.TOUCH_END);
// this.barTag.on(cc.Node.EventType.TOUCH_END, (e) => {
// if (!this._isReadyToPlay) {
// return;
// }
// console.log("TOUCH_ENDED");
// this.updateBarByPos(this.barTag.x);
// });
// this.barTag.off(cc.Node.EventType.MOUSE_UP);
// this.barTag.on(cc.Node.EventType.MOUSE_UP, (e) => {
// if (!this._isReadyToPlay) {
// return;
// }
// console.log("MOUSE_UP");
// this.updateBarByPos(this.barTag.x);
// });
// }
playVideoEnd
()
{
playVideoEnd
()
{
this
.
hideVideo
();
this
.
hideVideo
();
}
}
...
@@ -535,157 +323,8 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -535,157 +323,8 @@ export default class dg29_museum_game extends cc.Component {
onVideoPlayerEvent
(
sender
,
event
)
{
onVideoPlayerEvent
(
sender
,
event
)
{
cc
.
log
(
event
)
cc
.
log
(
event
)
if
(
event
===
cc
.
VideoPlayer
.
EventType
.
CLICKED
)
{
}
else
if
(
event
===
cc
.
VideoPlayer
.
EventType
.
READY_TO_PLAY
||
event
===
cc
.
VideoPlayer
.
EventType
.
META_LOADED
)
{
}
else
if
(
event
===
cc
.
VideoPlayer
.
EventType
.
PLAYING
)
{
cc
.
log
(
"
=========
"
)
cc
.
log
(
sender
);
cc
.
log
(
sender
.
_impl
.
_h
)
cc
.
log
(
sender
.
_impl
.
_w
);
if
(
sender
?.
_impl
?.
_w
)
{
// this.vplayer.node.scale = cc.winSize.width / sender._impl._w;
}
}
else
if
(
event
===
cc
.
VideoPlayer
.
EventType
.
COMPLETED
)
{
// this._isPlayComplated = true;
this
.
playButton
.
active
=
false
;
this
.
pauseButton
.
active
=
false
;
// 循环播放下一个
this
.
hideVideo
();
// this.videoCtrl.active = false;
// this.node.getChildByName("bg").active = true;
// cc.log("video completed");
// this.boyNode.active = true;
// this.vplayer.node.active = false;
// if (this.WrongList.length > 0) {
// this.initWorongLogic();
// } else {
// this.boyNode.getComponent(Boy).playtalk(-1);
// this.playAudioByUrl(this.data.audio_url_end, () => {
// this.boyNode.getComponent(Boy).playWave(-1);
// this.btn_next.active = true;
// })
// }
}
}
}
// updateBarByPos(newX) {
// const maxX = this.ProgressBar.width;
// const minX = 0;
// let percent = newX / maxX;
// if (percent > 1) {
// percent = 1
// }
// const dur = this.videoPlayer.getDuration();
// this.videoPlayer.currentTime = percent * dur
// }
// private _isPlayComplated: boolean
// updateBarByTime(ct) {
// if (this._isPlayComplated) {
// return;
// }
// this.currentTimeLabel.string = this.formatTime(ct);
// const dur = this.videoPlayer.getDuration();
// let percent = ct / dur;
// if (percent > 1) {
// percent = 1
// }
// this.ProgressBar.getComponent(cc.ProgressBar).progress = percent;
// const maxX = this.ProgressBar.width;
// const minX = 0;
// let newX = percent * maxX;
// newX = Math.min(maxX, Math.max(newX, minX));
// this.barTag.x = newX;
// }
// formatTime(time) {
// if (time === undefined) {
// return '';
// }
// let hh = "" + Math.floor(time / 60 / 60);
// if (Number(hh) > 0) {
// hh = `${hh.toString().padStart(2, '0')}:`;
// } else {
// hh = '';
// }
// const mm = Math.floor(time / 60).toString().padStart(2, '0');
// const ss = Math.round(time % 60).toString().padStart(2, '0');
// return `${hh}${mm}:${ss}`;
// }
// play() {
// if (!this._isReadyToPlay) return;
// this.videoPlayer.play();
// }
// pause() {
// this.videoPlayer.pause();
// }
// forward() {
// }
// backward() {
// }
// replay() {
// this._isPlayComplated = false;
// this.videoPlayer.currentTime = 0;
// this.videoPlayer.play();
// }
// private time1: any;
// private isVideoFull: boolean;//false,
// private tempPos: any;
// fullScreen() {
// // setTimeout(() => {
// // // IOS下视频的全屏适配比例有问题,所以做一个计算
// // this.videoPlayer.node.width = Math.min(this.node.width, this.node.height * 16 / 9);
// // }, 100);
// }
// updateVideo() {
// if (!this._isReadyToPlay) {
// return;
// }
// if (this.videoPlayer) {
// const ct = this.videoPlayer.currentTime;
// if (ct) {
// this.updateBarByTime(ct);
// }
// if (this.videoPlayer.isPlaying()) {
// if (this.playButton.active) {
// this.playButton.active = false;
// }
// if (!this.pauseButton.active) {
// this.pauseButton.active = true;
// }
// } else {
// if (!this.playButton.active) {
// this.playButton.active = true;
// }
// if (this.pauseButton.active) {
// this.pauseButton.active = false;
// }
// }
// }
// }
//----------------------------------------VideoEND-------------------------
//----------------------------------------VideoEND-------------------------
showData
(
data
)
{
showData
(
data
)
{
...
...
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