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
fc1185ad
Commit
fc1185ad
authored
May 26, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
bb6ee648
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
NJ_game_select.ts
assets/NJ_game_select/scene/NJ_game_select.ts
+12
-8
No files found.
assets/NJ_game_select/scene/NJ_game_select.ts
View file @
fc1185ad
...
...
@@ -56,10 +56,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
)
{
...
...
@@ -78,22 +77,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
(()
=>
{
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
();
}
...
...
@@ -128,6 +131,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
pageId
=
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
pageIdx
;
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
window
[
"
air
"
].
osmoFingerReadCallback
=
(
result
)
=>
{
this
.
showTips
(
"
===========
"
);
const
resultObj
=
JSON
.
parse
(
result
);
const
p
=
resultObj
.
finger_pos_in_page
;
if
(
p
.
x
==
-
1
||
p
.
y
==
-
1
)
{
...
...
@@ -248,7 +252,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
();
...
...
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