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
c13d8df6
Commit
c13d8df6
authored
Dec 31, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
桥接完成 待测试
parent
c9c5ac5c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
55 deletions
+65
-55
boy.prefab
assets/dg29_museum/DG16/prefabs/boy.prefab
+2
-2
DG16.ts
assets/dg29_museum/DG16/scene/DG16.ts
+48
-47
MyCocosSceneComponent_DG16.ts
assets/dg29_museum/DG16/script/MyCocosSceneComponent_DG16.ts
+1
-1
dg29_museum.fire
assets/dg29_museum/scene/dg29_museum.fire
+7
-4
dg29_museum_game.ts
assets/dg29_museum/scene/dg29_museum_game.ts
+7
-1
No files found.
assets/dg29_museum/DG16/prefabs/boy.prefab
View file @
c13d8df6
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"__id__": 2
"__id__": 2
}
}
],
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
"_components": [
{
{
"__id__": 5
"__id__": 5
...
@@ -177,7 +177,7 @@
...
@@ -177,7 +177,7 @@
"__uuid__": "ef2c3639-6259-495b-9b46-6958888540bb"
"__uuid__": "ef2c3639-6259-495b-9b46-6958888540bb"
},
},
"_N$_defaultArmatureIndex": 0,
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex":
9
,
"_N$_animationIndex":
0
,
"_N$_defaultCacheMode": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$debugBones": false,
...
...
assets/dg29_museum/DG16/scene/DG16.ts
View file @
c13d8df6
...
@@ -3,6 +3,8 @@ import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG16";
...
@@ -3,6 +3,8 @@ import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG16";
import
Boy
from
"
../script/ui/boy_DG16
"
;
import
Boy
from
"
../script/ui/boy_DG16
"
;
import
QuestionView
from
"
../script/ui/question_DG16
"
;
import
QuestionView
from
"
../script/ui/question_DG16
"
;
import
videoCtrl
from
"
../script/ui/videoCtrl_DG16
"
;
import
videoCtrl
from
"
../script/ui/videoCtrl_DG16
"
;
import
pg
from
"
../../scene/pg_dg29_museum
"
;
import
dg29_museum_game
from
"
../../scene/dg29_museum_game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -59,11 +61,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -59,11 +61,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
@
property
(
dg29_museum_game
)
root_game
:
dg29_museum_game
;
async
onLoadEnd
()
{
async
onLoadEnd
()
{
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this
.
initData
();
this
.
initData
();
this
.
initView
();
this
.
initView
();
this
.
root_game
.
init
(
this
.
data
);
}
}
_cantouch
=
null
;
_cantouch
=
null
;
...
@@ -76,10 +79,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -76,10 +79,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
touchlayer
.
_touchListener
.
setSwallowTouches
(
false
)
this
.
touchlayer
.
_touchListener
.
setSwallowTouches
(
false
)
this
.
vplayer
.
node
.
active
=
true
;
this
.
vplayer
.
node
.
active
=
true
;
this
.
vplayer
.
remoteURL
=
this
.
data
.
video
_url
;
this
.
vplayer
.
remoteURL
=
this
.
data
.
video
;
this
.
vplayer
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
this
.
vplayer
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
pg
.
event
.
on
(
'
play_video
'
,
()
=>
{
this
.
playVideo
()
})
}
}
tryPlayVideo
()
{
tryPlayVideo
()
{
...
@@ -102,50 +105,50 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -102,50 +105,50 @@ export default class SceneComponent extends MyCocosSceneComponent {
initView
()
{
initView
()
{
this
.
initBg
();
this
.
initBg
();
this
.
btn_next
.
on
(
"
click
"
,
()
=>
{
//
this.btn_next.on("click", () => {
this
.
playLocalAudio
(
"
btn
"
)
//
this.playLocalAudio("btn")
if
(
!
cc
.
find
(
'
middleLayer
'
))
{
//
if (!cc.find('middleLayer')) {
console
.
log
(
"
==点击了下一页按钮==
"
)
//
console.log("==点击了下一页按钮==")
return
;
//
return;
}
//
}
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
//
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer
.
goNextPage
();
// 跳转到下一页
//
middleLayer.goNextPage(); // 跳转到下一页
},
this
)
//
}, this)
this
.
videoCtrl
.
active
=
false
;
this
.
videoCtrl
.
active
=
false
;
this
.
qustionCom
=
this
.
qustionLayer
.
getComponent
(
QuestionView
);
this
.
qustionCom
=
this
.
qustionLayer
.
getComponent
(
QuestionView
);
this
.
_totalIndex
=
this
.
data
.
contentObj
.
dataArray
.
length
;
//
this._totalIndex = this.data.contentObj.dataArray.length;
this
.
_roundIndex
=
0
;
this
.
_roundIndex
=
0
;
this
.
firstRound
=
true
this
.
firstRound
=
true
this
.
doWrongTime
=
0
;
this
.
doWrongTime
=
0
;
cc
.
log
(
JSON
.
stringify
(
this
.
data
,
null
,
2
))
//
cc.log(JSON.stringify(this.data, null, 2))
this
.
WrongList
=
[];
this
.
WrongList
=
[];
this
.
qustionCom
.
hide
();
this
.
qustionCom
.
hide
();
this
.
boyNode
.
x
=
cc
.
winSize
.
width
;
//
this.boyNode.x = cc.winSize.width;
this
.
boyNode
.
getComponent
(
Boy
).
playRun
(
-
1
);
//
this.boyNode.getComponent(Boy).playRun(-1);
cc
.
tween
(
this
.
boyNode
).
to
(
3
,
{
x
:
0
}).
call
(()
=>
{
//
cc.tween(this.boyNode).to(3, { x: 0 }).call(() => {
this
.
boyNode
.
getComponent
(
Boy
).
playtalk
(
-
1
);
//
this.boyNode.getComponent(Boy).playtalk(-1);
this
.
playAudioByUrl
(
this
.
data
.
audio_url_guide
,
()
=>
{
//
this.playAudioByUrl(this.data.audio_url_guide, () => {
this
.
boyNode
.
scaleX
=
-
0.65
;
//
this.boyNode.scaleX = -0.65;
this
.
log
(
"
playRun start
"
)
//
this.log("playRun start")
this
.
boyNode
.
getComponent
(
Boy
).
playRun
(
-
1
);
//
this.boyNode.getComponent(Boy).playRun(-1);
cc
.
tween
(
this
.
boyNode
).
to
(
1
,
{
x
:
500
}).
call
(()
=>
{
//
cc.tween(this.boyNode).to(1, { x: 500 }).call(() => {
this
.
log
(
"
playRun end
"
)
//
this.log("playRun end")
this
.
boyNode
.
scaleX
=
0.65
;
//
this.boyNode.scaleX = 0.65;
this
.
boyNode
.
getComponent
(
Boy
).
playNormal
();
//
this.boyNode.getComponent(Boy).playNormal();
this
.
qustionCom
.
show
();
//
this.qustionCom.show();
this
.
doRound
()
//
this.doRound()
}).
start
();
//
}).start();
})
//
})
}).
start
()
//
}).start()
}
}
doRound
()
{
doRound
()
{
...
@@ -185,28 +188,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -185,28 +188,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
boyNode
.
scaleX
=
0.65
;
this
.
boyNode
.
scaleX
=
0.65
;
this
.
boyNode
.
getComponent
(
Boy
).
playNormal
();
this
.
boyNode
.
getComponent
(
Boy
).
playNormal
();
this
.
playVideo
();
this
.
videoCtrl
.
active
=
true
;
this
.
node
.
getChildByName
(
"
bg
"
).
active
=
false
;
this
.
videoCtrl
.
getComponent
(
videoCtrl
).
setVideCom
(
this
.
vplayer
);
this
.
vplayer
.
volume
=
1
;
this
.
vplayer
.
node
.
scale
=
1
;
this
.
vplayer
.
currentTime
=
0
;
this
.
vplayer
.
play
();
await
asyncDelay
(
0.1
);
this
.
boyNode
.
active
=
false
;
}).
start
();
}).
start
();
})
})
}).
start
()
}).
start
()
}
}
}
}
async
playVideo
()
{
this
.
videoCtrl
.
active
=
true
;
this
.
node
.
getChildByName
(
"
bg
"
).
active
=
false
;
this
.
videoCtrl
.
getComponent
(
videoCtrl
).
setVideCom
(
this
.
vplayer
);
this
.
vplayer
.
volume
=
1
;
this
.
vplayer
.
node
.
scale
=
1
;
this
.
vplayer
.
currentTime
=
0
;
this
.
vplayer
.
play
();
await
asyncDelay
(
0.1
);
this
.
boyNode
.
active
=
false
;
}
initWorongLogic
()
{
initWorongLogic
()
{
this
.
_totalIndex
=
this
.
WrongList
.
length
;
this
.
_totalIndex
=
this
.
WrongList
.
length
;
this
.
_roundIndex
=
0
;
this
.
_roundIndex
=
0
;
...
...
assets/dg29_museum/DG16/script/MyCocosSceneComponent_DG16.ts
View file @
c13d8df6
import
{
defaultData
}
from
"
../
script/defaultData_DG16
"
;
import
{
defaultData
}
from
"
../
../script/defaultData_dg29_museum
"
;
export
class
MyCocosSceneComponent
extends
cc
.
Component
{
export
class
MyCocosSceneComponent
extends
cc
.
Component
{
...
...
assets/dg29_museum/scene/dg29_museum.fire
View file @
c13d8df6
...
@@ -430,7 +430,7 @@
...
@@ -430,7 +430,7 @@
"__id__": 9
"__id__": 9
},
},
"_name": "boy",
"_name": "boy",
"_active":
tru
e,
"_active":
fals
e,
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
...
@@ -545,7 +545,7 @@
...
@@ -545,7 +545,7 @@
"__id__": 12
"__id__": 12
},
},
"_name": "qustionLayer",
"_name": "qustionLayer",
"_active":
tru
e,
"_active":
fals
e,
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
...
@@ -4351,7 +4351,7 @@
...
@@ -4351,7 +4351,7 @@
"__id__": 118
"__id__": 118
}
}
],
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [],
"_components": [],
"_prefab": {
"_prefab": {
"__id__": 145
"__id__": 145
...
@@ -5502,7 +5502,7 @@
...
@@ -5502,7 +5502,7 @@
"__id__": 7
"__id__": 7
},
},
"_children": [],
"_children": [],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
"_components": [
{
{
"__id__": 151
"__id__": 151
...
@@ -8738,6 +8738,9 @@
...
@@ -8738,6 +8738,9 @@
"touchlayer": {
"touchlayer": {
"__id__": 217
"__id__": 217
},
},
"root_game": {
"__id__": 147
},
"_id": "eaTVUpqahPfZeO9+sUI7RP"
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
}
]
]
\ No newline at end of file
assets/dg29_museum/scene/dg29_museum_game.ts
View file @
c13d8df6
...
@@ -69,6 +69,8 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -69,6 +69,8 @@ export default class dg29_museum_game extends cc.Component {
pg
.
view
.
touchOn
(
this
.
btn_restart
,
this
.
onTouchRestart
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_restart
,
this
.
onTouchRestart
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_vioce
,
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_vioce
,
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_vioce_ing
,
this
.
onTouchRecordEnd
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_vioce_ing
,
this
.
onTouchRecordEnd
,
this
);
pg
.
event
.
on
(
'
play_video_end
'
,
()
=>
{
this
.
playVideoEnd
()
})
}
}
// 初始化游戏
// 初始化游戏
initGame
()
{
initGame
()
{
...
@@ -360,6 +362,8 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -360,6 +362,8 @@ export default class dg29_museum_game extends cc.Component {
private
timeCtrl
:
TimeCtrl
;
private
timeCtrl
:
TimeCtrl
;
showVideo
()
{
showVideo
()
{
return
new
Promise
(
async
(
reslove
)
=>
{
return
new
Promise
(
async
(
reslove
)
=>
{
this
.
hideUI
();
pg
.
event
.
emit
(
"
play_video
"
)
if
(
1
)
return
;
if
(
1
)
return
;
this
.
showVideoPlayer
();
this
.
showVideoPlayer
();
this
.
timeCtrl
=
pg
.
time
.
delayCtrl
()
this
.
timeCtrl
=
pg
.
time
.
delayCtrl
()
...
@@ -520,7 +524,9 @@ export default class dg29_museum_game extends cc.Component {
...
@@ -520,7 +524,9 @@ export default class dg29_museum_game extends cc.Component {
});
});
}
}
playVideoEnd
()
{
this
.
hideVideo
();
}
onVideoPlayerEvent
(
sender
,
event
)
{
onVideoPlayerEvent
(
sender
,
event
)
{
...
...
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