Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy17_hds
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
hy17_hds
Commits
0f3fe549
Commit
0f3fe549
authored
Jun 22, 2023
by
WangFan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善基础流程
parent
8d34e5f6
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2196 additions
and
678 deletions
+2196
-678
hy01_danci.fire
assets/hy01_danci/scene/hy01_danci.fire
+2148
-663
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+48
-15
No files found.
assets/hy01_danci/scene/hy01_danci.fire
View file @
0f3fe549
This diff is collapsed.
Click to expand it.
assets/hy01_danci/scene/hy01_danci.ts
View file @
0f3fe549
...
...
@@ -32,10 +32,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initGame
();
}
private
sentence_list
:
Array
<
string
>
;
private
current
:
number
=
0
;
initData
()
{
this
.
sentence_list
=
[
'
While there is life there is hope
'
,
'
apple
'
]
}
private
layer_bg
:
cc
.
Node
;
...
...
@@ -48,6 +51,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
time
:
cc
.
Node
;
private
microphone_area
:
cc
.
Node
;
private
coin_area
:
cc
.
Node
;
initView
()
{
this
.
layer_bg
=
pg
.
view
.
find
(
this
,
"
layer_bg
"
)
...
...
@@ -59,20 +63,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
microphone_area
=
pg
.
view
.
find
(
this
.
sentence_box
,
"
microphone_area
"
);
this
.
time_area
=
pg
.
view
.
find
(
this
.
microphone_area
,
"
time_area
"
)
this
.
time
=
pg
.
view
.
find
(
this
.
time_area
,
"
time
"
)
this
.
coin_area
=
pg
.
view
.
find
(
this
.
layer_game
,
"
coin_area
"
)
}
initListener
()
{
this
.
initTween
()
}
// 场景初始动画
initTween
()
{
this
.
setSentence
()
cc
.
tween
(
this
.
sentence_box
).
to
(
0.5
,
{
y
:
-
375
}).
start
()
setTimeout
(()
=>
{
pg
.
view
.
visible
(
this
.
time_area
,
true
);
},
0.5
*
1000
)
this
.
setTimeCountdown
()
}
setTimeCountdown
(){
pg
.
view
.
visible
(
this
.
time_area
,
true
)
let
time
=
10
;
let
timer
=
null
;
timer
=
setInterval
(()
=>
{
...
...
@@ -86,6 +91,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
clearInterval
(
timer
)
}
},
1000
)
setTimeout
(()
=>
{
this
.
stopBgAnimation
()
this
.
coinShow
()
},
15
*
1000
)
}
setSentence
(){
let
sentence
=
pg
.
view
.
find
(
this
.
sentence_box
,
'
sentence
'
);
pg
.
view
.
setString
(
sentence
,
this
.
sentence_list
[
this
.
current
])
}
microphoneAreaChange
()
{
...
...
@@ -101,27 +115,46 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
Tween
.
stopAllByTarget
(
icon_recording
);
pg
.
view
.
visible
(
icon_recording
,
false
)
}
playBgAnimation
(){
let
bg_tween
=
pg
.
view
.
find
(
this
.
layer_bg
,
"
tween
"
);
playBgAnimation
()
{
let
bg_tween
=
pg
.
view
.
find
(
this
.
layer_bg
,
"
tween
"
);
// 背景动画报错,暂时注释
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"mountain2/mountain2_ske"), 'animation',
fals
e);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"mountain2/mountain2_ske"), 'animation',
tru
e);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"mountain2_grass2/mountain2_grass2_ske"), 'animation', false);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"cloud/cloud_ske"), 'animation', false);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"tree/tree_ske"), 'animation', false);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"grass2/grass2_ske"), 'animation', false);
// pg.view.playSpineAnimation(pg.view.find(bg_tween,"mountain1_grass1/mountain1_grass1_ske"), 'animation', false);
let
icon_mountain
=
pg
.
view
.
find
(
bg_tween
,
"
icon_mountain
"
);
let
icon_mountain
=
pg
.
view
.
find
(
bg_tween
,
"
icon_mountain
"
);
pg
.
view
.
visible
(
icon_mountain
,
true
)
cc
.
tween
(
icon_mountain
).
to
(
0.5
,
{
opacity
:
0
}).
to
(
0.3
,
{
opacity
:
255
}).
union
().
repeatForever
().
start
();
}
stopBgAnimation
(){
let
bg_tween
=
pg
.
view
.
find
(
this
.
layer_bg
,
"
tween
"
);
let
icon_mountain
=
pg
.
view
.
find
(
bg_tween
,
"
icon_mountain
"
);
stopBgAnimation
()
{
let
bg_tween
=
pg
.
view
.
find
(
this
.
layer_bg
,
"
tween
"
);
let
icon_mountain
=
pg
.
view
.
find
(
bg_tween
,
"
icon_mountain
"
);
cc
.
Tween
.
stopAllByTarget
(
icon_mountain
);
pg
.
view
.
visible
(
icon_mountain
,
false
)
}
coinShow
()
{
pg
.
view
.
visible
(
this
.
time_area
,
false
)
pg
.
view
.
visible
(
this
.
coin_area
,
true
)
let
coins
=
pg
.
view
.
find
(
this
.
coin_area
,
'
coins
'
);
// pg.view.visible(pg.view.find(coins,"coin1/coin_static"), false)
// pg.view.playSpineAnimation(pg.view.find(coins,"coin1/coin_ske"), 'animation', false);
setTimeout
(()
=>
{
pg
.
view
.
visible
(
this
.
coin_area
,
false
)
this
.
current
++
;
if
(
this
.
current
===
this
.
sentence_list
.
length
){
pg
.
view
.
visible
(
this
.
layer_game
,
false
)
pg
.
view
.
visible
(
this
.
layer_finish
,
true
)
}
else
{
this
.
setSentence
();
this
.
setTimeCountdown
()
}
},
2
*
1000
)
}
initGame
()
{
}
...
...
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