Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_game_select
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
NJ_game_select
Commits
6e04ead0
Commit
6e04ead0
authored
3 years ago
by
范雪寒
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://vcs.ireadabc.com/template/NJ_game_select
parents
56501ec8
d1b6933b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
NJ_game_select.ts
assets/NJ_game_select/scene/NJ_game_select.ts
+13
-9
No files found.
assets/NJ_game_select/scene/NJ_game_select.ts
View file @
6e04ead0
...
...
@@ -33,8 +33,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
async
startStep1
()
{
await
this
.
asyncPlayAudioByUrl
(
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
startAudio
);
await
asyncDelay
(
0.3
);
const
circulate
=
async
()
=>
{
await
asyncDelay
(
0.3
);
const
circle
=
cc
.
find
(
'
Canvas/step1/pad/circle
'
);
circle
.
active
=
true
;
const
progress
=
cc
.
find
(
'
Canvas/step1/pad/circle/progress
'
);
...
...
@@ -48,6 +48,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
step
=
1
;
}
catch
(
error
)
{
this
.
showTips
(
`未检测到对应页面`
);
bar
.
progress
=
1
;
circle
.
active
=
false
;
await
circulate
();
}
...
...
@@ -56,10 +57,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async
startStep2
()
{
await
Promise
.
all
([
this
.
asyncPlayAudioByUrl
(
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
hotZoneItemArr
[
this
.
currentPartIdx
].
audio_url
),
this
.
checkPart
()
]);
const
ps1
=
this
.
asyncPlayAudioByUrl
(
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
hotZoneItemArr
[
this
.
currentPartIdx
].
audio_url
);
const
ps2
=
this
.
checkPart
();
await
Promise
.
all
([
ps1
,
ps2
]);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
...
...
@@ -84,22 +84,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
checkPage
()
{
if
(
!
window
[
"
courseware
"
]
||
cc
.
sys
.
isBrowser
)
{
// 没有中间层的话,直接判断为检测成功
return
true
;
return
;
}
let
checkSuccess
=
false
;
// 定时三秒检测
const
timeout
=
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
window
[
"
courseware
"
].
closeOsmoFingerRead
();
if
(
!
checkSuccess
){
window
[
"
courseware
"
].
closeOsmoFingerRead
();
}
reject
(
new
Error
(
'
checkpage timeout
'
));
},
2800
)
});
const
pageId
=
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
pageIdx
;
const
check
=
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
window
[
"
air
"
].
osmoFingerReadCallback
=
(
result
)
=>
{
const
resultObj
=
JSON
.
parse
(
result
);
if
(
resultObj
.
page_id
==
pageId
)
{
// 检测成功
checkSuccess
=
true
;
window
[
"
courseware
"
].
closeOsmoFingerRead
();
resolve
();
}
...
...
@@ -256,7 +260,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initListener
()
{
}
asyncPlayAudioByUrl
(
url
:
string
)
:
Promise
<
void
>
{
asyncPlayAudioByUrl
(
url
:
string
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
playAudioByUrl
(
url
,
()
=>
{
resolve
();
...
...
This diff is collapsed.
Click to expand it.
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