Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_cocos_dqq
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
dfzx_cocos_dqq
Commits
18850446
Commit
18850446
authored
Mar 22, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 调整出现速度
parent
b2b6dce7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
15 deletions
+39
-15
dfzx_cocos_dqq.js
play/assets/dfzx_cocos_dqq/scene/dfzx_cocos_dqq.js
+39
-15
No files found.
play/assets/dfzx_cocos_dqq/scene/dfzx_cocos_dqq.js
View file @
18850446
...
...
@@ -23,7 +23,7 @@ cc.Class({
},
ctor
()
{
this
.
createSpeed
=
[
1250
,
10
00
,
1000
,
800
,
800
,
640
,
640
,
512
,
512
];
this
.
createSpeed
=
[
750
,
15
00
,
1000
,
800
,
800
,
640
,
640
,
512
,
512
];
this
.
moveSpeed
=
[
5
,
5
,
4
,
4
,
3.2
,
3.2
,
2.56
,
2.56
,
2.048
,
2.048
];
},
...
...
@@ -265,16 +265,26 @@ cc.Class({
currentRightNumber
:
0
};
this
.
createStars
();
this
.
showGuns
();
await
this
.
showGuns
();
await
this
.
playAudioSync
(
'
question
'
);
await
this
.
playQuestionAudio
();
this
.
startShowBalls
();
},
showGuns
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
try
{
const
bg
=
cc
.
find
(
'
Canvas/bg
'
);
const
gunBase
=
cc
.
find
(
'
Canvas/bg/GunBase
'
);
this
.
playAudio
(
'
move
'
);
asyncTweenTo
(
gunBase
,
0.5
,
{
y
:
-
bg
.
height
/
2
});
this
.
playAudio
(
'
move
'
,
()
=>
{
resolve
();
});
}
catch
(
e
)
{
reject
();
}
});
},
hideGuns
()
{
...
...
@@ -322,7 +332,7 @@ cc.Class({
ball
=
this
.
createTextBall
(
answer
);
}
const
bg
=
cc
.
find
(
'
Canvas/bg
'
);
ball
.
x
=
bg
.
width
/
2
*
(
RandomInt
(
0
,
2
)
-
0.5
)
+
RandomInt
(
-
50
,
50
);
ball
.
x
=
bg
.
width
/
4
*
(
RandomInt
(
0
,
3
)
-
1
)
+
RandomInt
(
-
50
,
50
);
ball
.
y
=
-
bg
.
height
;
ball
.
parent
=
bg
;
...
...
@@ -333,7 +343,7 @@ cc.Class({
.
repeatForever
()
.
start
();
this
.
playAudio
(
'
appare
'
,
null
,
0.
4
);
this
.
playAudio
(
'
appare
'
,
null
,
0.
1
);
ball
.
on
(
'
touchstart
'
,
async
(
event
)
=>
{
if
(
ball
.
canNotTouch
)
{
...
...
@@ -367,8 +377,14 @@ cc.Class({
const
currentQuestion
=
this
.
data
.
questionList
[
this
.
_status
.
currentQuestionIdx
];
const
time
=
this
.
moveSpeed
[
currentQuestion
.
speedLevel
];
const
targetY1
=
bg
.
height
/
2
-
ball
.
height
/
2
-
50
;
const
targetY2
=
bg
.
height
;
const
time1
=
time
*
(
ball
.
y
-
targetY1
)
/
(
ball
.
y
-
targetY2
);
const
time2
=
time
-
time1
;
cc
.
tween
(
ball
)
.
to
(
time
,
{
y
:
bg
.
height
})
.
to
(
time1
,
{
y
:
bg
.
height
/
2
-
ball
.
height
/
2
-
50
},
{
easing
:
'
quadOut
'
})
.
delay
(
0.75
)
.
to
(
time2
,
{
y
:
bg
.
height
},
{
easing
:
'
quadIn
'
})
.
removeSelf
()
.
start
();
...
...
@@ -394,7 +410,6 @@ cc.Class({
cc
.
tween
(
text
)
.
delay
(
0
)
.
call
(()
=>
{
console
.
log
(
'
text =
'
+
answer
.
answerTxt
+
'
, text.width =
'
+
text
.
width
);
text
.
scale
=
Math
.
min
(
mask
.
width
/
text
.
width
,
1
);
})
.
start
();
...
...
@@ -422,11 +437,9 @@ cc.Class({
if
(
!
currentQuestion
)
{
return
;
}
this
.
playAudio
(
'
question
'
,
async
()
=>
{
this
.
speakerBlink
();
await
playAudioByUrlSync
(
currentQuestion
.
questionAudio
);
this
.
speakerStopBlink
();
});
},
speakerList
:
null
,
...
...
@@ -524,5 +537,16 @@ cc.Class({
cb
();
}
});
},
async
playAudioSync
(
audioName
,
value
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
try
{
this
.
playAudio
(
audioName
,
()
=>
{
resolve
();
},
value
);
}
catch
(
e
)
{
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