Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_BookTable
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_BookTable
Commits
412543e3
Commit
412543e3
authored
Jun 10, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 界面
parent
d5c494f9
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
552 additions
and
167 deletions
+552
-167
NJ_BookTable.fire
assets/NJ_BookTable/scene/NJ_BookTable.fire
+306
-38
NJ_BookTable.ts
assets/NJ_BookTable/scene/NJ_BookTable.ts
+52
-7
MyCocosSceneComponent.ts
assets/NJ_BookTable/script/MyCocosSceneComponent.ts
+2
-2
defaultData.ts
assets/NJ_BookTable/script/defaultData.ts
+7
-4
util.ts
assets/NJ_BookTable/script/util.ts
+185
-116
No files found.
assets/NJ_BookTable/scene/NJ_BookTable.fire
View file @
412543e3
This diff is collapsed.
Click to expand it.
assets/NJ_BookTable/scene/NJ_BookTable.ts
View file @
412543e3
import
{
asyncDelay
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
asyncDelay
,
playAudioByUrl
,
asyncGetSpriteFrimeByUrl
,
buttonOnClick
}
from
"
../script/util
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -7,14 +7,12 @@ const { ccclass, property } = cc._decorator;
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
// this._imageResList.push({ url: this.data.pic_url });
// this._imageResList.push({ url: this.data.pic_url_2 });
this
.
_imageResList
.
push
({
url
:
this
.
data
.
bookImg
});
}
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
// this._audioResList.push({ url: this.data.audio_url
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
questionTextAudio
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
bookAudio
});
}
addPreloadAnima
()
{
...
...
@@ -22,12 +20,59 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async
onLoadEnd
()
{
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
await
this
.
initView
();
this
.
initListener
();
}
async
initView
()
{
const
levelNode
=
cc
.
find
(
`Canvas/bg/L
${
this
.
data
.
choseLevel
}
`
);
if
(
!
levelNode
)
{
return
;
}
levelNode
.
active
=
true
;
cc
.
find
(
`box/title`
,
levelNode
).
getComponent
(
cc
.
Label
).
string
=
this
.
data
.
title
;
try
{
const
bookImgFrame
:
any
=
await
asyncGetSpriteFrimeByUrl
(
this
.
data
.
bookImg
);
cc
.
find
(
`Canvas/bg/bookImg/img`
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
bookImgFrame
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
}
initListener
()
{
const
bgButton
=
cc
.
find
(
`Canvas/bg/bookImg`
);
bgButton
.
on
(
'
click
'
,
()
=>
{
playAudioByUrl
(
this
.
data
.
bookAudio
);
});
const
levelNode
=
cc
.
find
(
`Canvas/bg/L
${
this
.
data
.
choseLevel
}
`
);
if
(
!
levelNode
)
{
return
;
}
const
levelButton
=
cc
.
find
(
`box`
,
levelNode
);
levelButton
.
on
(
'
click
'
,
()
=>
{
if
(
levelButton
[
'
cantClick
'
])
{
return
;
}
levelButton
[
'
cantClick
'
]
=
true
;
// TODO 播放骨骼动画
playAudioByUrl
(
this
.
data
.
questionTextAudio
,
()
=>
{
// TODO 更新骨骼动画状态
levelButton
[
'
cantClick
'
]
=
false
;
});
})
buttonOnClick
(
cc
.
find
(
`kdh`
,
levelNode
),
()
=>
{
// TODO 跳转到看动画(第一个课件)
});
buttonOnClick
(
cc
.
find
(
`dgs`
,
levelNode
),
()
=>
{
// TODO 跳转到读故事(第二个课件)
});
buttonOnClick
(
cc
.
find
(
`qpy`
,
levelNode
),
()
=>
{
// TODO 跳转到趣配音(第三个课件)
});
}
...
...
assets/NJ_BookTable/script/MyCocosSceneComponent.ts
View file @
412543e3
...
...
@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload
()
{
const
preloadArr
=
this
.
_imageResList
.
concat
(
this
.
_audioResList
).
concat
(
this
.
_animaResList
);
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
(
err
,
data
)
=>
{
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
async
(
err
,
data
)
=>
{
if
(
window
&&
window
[
"
air
"
])
{
// window["air"].onCourseInScreen = (next) => {
...
...
@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd();
// next();
// };
this
.
onLoadEnd
();
await
this
.
onLoadEnd
();
window
[
"
air
"
].
hideAirClassLoading
();
}
else
{
this
.
onLoadEnd
();
...
...
assets/NJ_BookTable/script/defaultData.ts
View file @
412543e3
export
const
defaultData
=
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png
"
,
"
pic_url_2
"
:
"
http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png
"
,
"
text
"
:
"
This is a test label.
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3
"
"
title
"
:
"
猩猩有个苹果。
\n
他想要什么?
"
,
"
questionTextAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/69a71b1cfb979a5e0b32d72c21c55423_l.mp3
"
,
"
audioFileName
"
:
"
胜利音效1.mp3
"
,
"
choseLevel
"
:
"
1
"
,
"
bookImg
"
:
"
http://staging-teach.cdn.ireadabc.com/601b7713313df8ee51c3533ed2e8e63d.png
"
,
"
bookAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/1c923d9ad42a500edceba37a985b49d5_l.mp3
"
,
"
bookAudioFileName
"
:
"
占位音频.mp3
"
}
\ No newline at end of file
assets/NJ_BookTable/script/util.ts
View file @
412543e3
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