Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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
middleLayer_for_kyxq
Commits
e977c6c7
Commit
e977c6c7
authored
Sep 28, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 资源库
parent
a52dd163
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1276 additions
and
1125 deletions
+1276
-1125
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+1243
-1047
LibraryPage.ts
assets/middleLayer_for_kyxq/script/LibraryPage.ts
+28
-23
middleLayer.ts
assets/middleLayer_for_kyxq/script/middleLayer.ts
+5
-55
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
e977c6c7
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_kyxq/script/LibraryPage.ts
View file @
e977c6c7
// Learn TypeScript:
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
}
from
"
./util
"
;
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -16,15 +9,31 @@ export default class NewClass extends cc.Component {
...
@@ -16,15 +9,31 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
Viewer
:
cc
.
Node
=
null
;
Viewer
:
cc
.
Node
=
null
;
data
;
@
property
(
cc
.
Node
)
btnReading
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btnListening
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btnWatching
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
handleClickBackBtn
()
{
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
topIn
"
)
vc
.
toView
(
"
HomePage
"
,
"
topIn
"
)
}
}
handleClickReadBook
()
{
handleClickReadBook
(
evt
:
cc
.
Event
)
{
const
syllabusId
=
evt
.
currentTarget
.
syllabus_id
;
if
(
!
syllabusId
)
{
global
.
middleLayer
.
showTips
(
`未制作`
);
return
;
}
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
libraryReadPage
.
attr
({
syllabus_pid
:
syllabusId
});
vc
.
toView
(
"
LibraryReadPage
"
,
"
rightIn
"
)
vc
.
toView
(
"
LibraryReadPage
"
,
"
rightIn
"
)
}
}
...
@@ -32,22 +41,18 @@ export default class NewClass extends cc.Component {
...
@@ -32,22 +41,18 @@ export default class NewClass extends cc.Component {
// onLoad () {}
// onLoad () {}
start
()
{
async
start
()
{
this
.
initData
();
this
.
loading
.
active
=
true
;
this
.
initView
();
await
this
.
initView
();
this
.
loading
.
active
=
false
;
}
}
initData
()
{
async
initView
()
{
const
{
code
,
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/kyxq/v1/library`
,
{});
}
this
.
btnReading
[
`syllabus_id`
]
=
rows
[
0
].
id
;
this
.
btnListening
[
`syllabus_id`
]
=
rows
[
1
].
id
;
initView
()
{
this
.
btnWatching
[
`syllabus_id`
]
=
rows
[
2
].
id
;
}
}
// update (dt) {}
// update (dt) {}
}
}
assets/middleLayer_for_kyxq/script/middleLayer.ts
View file @
e977c6c7
...
@@ -85,11 +85,14 @@ export default class NewClass extends middleLayerBase {
...
@@ -85,11 +85,14 @@ export default class NewClass extends middleLayerBase {
}
}
onHomeworkFinish
(
d1
=
null
,
d2
=
null
)
{
onHomeworkFinish
(
d1
=
null
,
d2
=
null
)
{
let
data
=
d1
;
let
data
=
null
;
let
callback
=
null
;
let
callback
=
null
;
if
(
typeof
(
d1
)
==
'
function
'
)
{
if
(
typeof
(
d1
)
==
'
function
'
)
{
data
=
d2
;
data
=
d2
;
callback
=
d1
;
callback
=
d1
;
}
else
{
data
=
d1
;
callback
=
d2
;
}
}
console
.
log
(
'
onHomeworkFinish:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
onHomeworkFinish:
'
+
JSON
.
stringify
(
data
));
callback
&&
callback
();
callback
&&
callback
();
...
@@ -135,59 +138,6 @@ export default class NewClass extends middleLayerBase {
...
@@ -135,59 +138,6 @@ export default class NewClass extends middleLayerBase {
}
}
initListener
()
{
initListener
()
{
const
exitBtn
=
cc
.
find
(
'
middleLayer/ExitBtn
'
);
exitBtn
.
on
(
'
click
'
,
()
=>
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
cc
.
tween
(
exitBtn
)
.
to
(
0.1
,
{
scaleX
:
0.4
,
scaleY
:
0.6
})
.
to
(
0.1
,
{
scaleX
:
0.6
,
scaleY
:
0.4
})
.
to
(
0.1
,
{
scaleX
:
0.5
,
scaleY
:
0.5
})
.
call
(()
=>
{
exitBtn
.
active
=
false
;
cc
.
game
.
removePersistRootNode
(
this
.
node
);
// cc.director.getScene().destroy();
cc
.
audioEngine
.
stopAll
();
(
<
any
>
window
).
courseware
.
freeAllOcMethod
();
const
flag
=
cc
.
director
.
loadScene
(
"
debug_shell
"
,
(
err
,
scene
)
=>
{
});
if
(
!
flag
)
{
// 没有壳的情况下,直接加载中间层场景
cc
.
director
.
loadScene
(
"
middleLayer_for_HY
"
,
(
err
,
scene
)
=>
{
});
}
})
.
start
();
});
cc
.
find
(
'
middleLayer/BtnRight
'
).
on
(
'
click
'
,
()
=>
{
this
.
goNextPage
();
if
(
this
.
courseIndex
==
0
)
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
else
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
if
(
this
.
courseIndex
==
this
.
courses
.
length
-
1
)
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
}
else
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
}
});
cc
.
find
(
'
middleLayer/BtnLeft
'
).
on
(
'
click
'
,
()
=>
{
this
.
goPrePage
();
if
(
this
.
courseIndex
==
0
)
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
else
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
if
(
this
.
courseIndex
==
this
.
courses
.
length
-
1
)
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
}
else
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
}
});
}
}
backPageNode
:
cc
.
Node
=
null
;
// 从绘本里返回的界面
backPageNode
:
cc
.
Node
=
null
;
// 从绘本里返回的界面
...
@@ -196,7 +146,7 @@ export default class NewClass extends middleLayerBase {
...
@@ -196,7 +146,7 @@ export default class NewClass extends middleLayerBase {
(
<
any
>
window
).
courseware
.
freeAllOcMethod
();
(
<
any
>
window
).
courseware
.
freeAllOcMethod
();
this
.
hideTips
();
this
.
hideTips
();
// 切换到空场景
// 切换到空场景
cc
.
director
.
loadScene
(
'
middleLayer_for_
JJ
'
,
()
=>
{
cc
.
director
.
loadScene
(
'
middleLayer_for_
kyxq
'
,
()
=>
{
this
.
initSize
();
this
.
initSize
();
this
.
backPageNode
.
active
=
true
;
this
.
backPageNode
.
active
=
true
;
this
.
hideTips
();
this
.
hideTips
();
...
...
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