Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy08_caici
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
hy08_caici
Commits
f1d32675
Commit
f1d32675
authored
Jun 27, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏提交
parent
d24cfced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
hy06_danxuan.ts
assets/hy06_danxuan/scene/hy06_danxuan.ts
+20
-16
No files found.
assets/hy06_danxuan/scene/hy06_danxuan.ts
View file @
f1d32675
...
@@ -130,7 +130,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -130,7 +130,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
startQuestion
()
{
startQuestion
()
{
// 游戏所需的初始化数据
// 游戏所需的初始化数据
this
.
currentId
=
0
this
.
currentId
=
0
this
.
time
=
this
.
data
.
options
.
length
*
3
this
.
time
=
this
.
data
.
options
.
length
*
4
this
.
currentTime
=
this
.
time
*
1000
;
this
.
currentTime
=
this
.
time
*
1000
;
this
.
lengthProgress
=
0
this
.
lengthProgress
=
0
this
.
right
=
0
this
.
right
=
0
...
@@ -151,6 +151,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -151,6 +151,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
state
=
State
.
Recording
;
this
.
state
=
State
.
Recording
;
this
.
updateTitleOptions
();
this
.
updateTitleOptions
();
}
}
gameOver
()
{
this
.
state
=
State
.
Over
;
}
private
startCountDown
:
boolean
;
private
startCountDown
:
boolean
;
update
(
dt
)
{
update
(
dt
)
{
if
(
this
.
startCountDown
)
{
if
(
this
.
startCountDown
)
{
...
@@ -186,6 +189,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -186,6 +189,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
break
;
break
;
case
State
.
RecordShow
:
case
State
.
RecordShow
:
this
.
state
=
State
.
Recording
;
this
.
state
=
State
.
Recording
;
this
.
hideAnswer
();
this
.
currentId
++
;
if
(
!
this
.
getCurrentOptions
())
{
this
.
gameOver
();
return
;
}
this
.
updateTitleOptions
()
this
.
updateTitleOptions
()
break
;
break
;
}
}
...
@@ -194,6 +203,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -194,6 +203,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
getCurrentOptions
()
{
getCurrentOptions
()
{
return
this
.
data
.
options
[
this
.
currentId
];
return
this
.
data
.
options
[
this
.
currentId
];
}
}
hideAnswer
()
{
let
topQuestion
=
pg
.
view
.
find
(
this
,
'
layer_game/topQuestion
'
);
let
row
=
pg
.
view
.
find
(
this
,
'
layer_game/row
'
);
let
right
=
pg
.
view
.
find
(
row
,
'
right
'
);
let
mistake
=
pg
.
view
.
find
(
row
,
'
mistake
'
);
let
answer
=
pg
.
view
.
find
(
topQuestion
,
'
answer
'
);
right
.
active
=
false
mistake
.
active
=
false
answer
.
active
=
false
}
//题目
//题目
updateTitleOptions
()
{
updateTitleOptions
()
{
let
topQuestion
=
pg
.
view
.
find
(
this
,
'
layer_game/topQuestion
'
);
let
topQuestion
=
pg
.
view
.
find
(
this
,
'
layer_game/topQuestion
'
);
...
@@ -302,8 +321,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -302,8 +321,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
//错误
//错误
row
.
children
[
1
].
active
=
true
row
.
children
[
1
].
active
=
true
}
}
//添加动画
this
.
addAnimation
(
row
,
topQuestion
)
}
}
//回答正确后回调
//回答正确后回调
rightQuestions
(
row
)
{
rightQuestions
(
row
)
{
...
@@ -333,19 +350,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -333,19 +350,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
row
.
children
[
0
].
active
=
true
row
.
children
[
0
].
active
=
true
}
}
addAnimation
(
row
,
topQuestion
)
{
if
(
this
.
currentId
<
(
this
.
time
/
5
)
-
1
)
{
//初始化
setTimeout
(()
=>
{
row
.
children
[
0
].
active
=
false
row
.
children
[
1
].
active
=
false
topQuestion
.
children
[
2
].
active
=
false
this
.
currentId
++
},
700
);
}
else
{
console
.
log
(
'
回答完毕
'
)
}
}
playLocalAudio
(
audioName
)
{
playLocalAudio
(
audioName
)
{
const
audio
=
cc
.
find
(
`Canvas/res/audio/
${
audioName
}
`
).
getComponent
(
cc
.
AudioSource
);
const
audio
=
cc
.
find
(
`Canvas/res/audio/
${
audioName
}
`
).
getComponent
(
cc
.
AudioSource
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
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