Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xy_camera
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
xy_camera
Commits
ab89e285
Commit
ab89e285
authored
Nov 30, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 中间层方法兼容
parent
ec775f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
28 deletions
+10
-28
MyCocosSceneComponent.ts
assets/cocos_generator/script/MyCocosSceneComponent.ts
+10
-28
No files found.
assets/cocos_generator/script/MyCocosSceneComponent.ts
View file @
ab89e285
...
...
@@ -52,35 +52,17 @@ export class MyCocosSceneComponent extends cc.Component {
// 生命周期 start
start
()
{
let
getData
=
this
.
getData
.
bind
(
this
);
if
(
window
&&
(
<
any
>
window
).
courseware
)
{
getData
=
(
<
any
>
window
).
courseware
.
getData
;
if
(
window
&&
(
<
any
>
window
).
courseware
&&
(
<
any
>
window
).
courseware
.
getData
)
{
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
this
.
log
(
'
data:
'
+
data
);
this
.
data
=
data
||
this
.
getDefaultData
();
this
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
data
));
this
.
preloadItem
();
})
}
else
{
this
.
data
=
this
.
getDefaultData
();
this
.
preloadItem
();
}
getData
((
data
)
=>
{
console
.
log
(
'
data:
'
,
data
);
this
.
data
=
data
||
this
.
getDefaultData
();
this
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
data
))
this
.
preloadItem
()
// courseInScreen
// scene.distroy() courseOutScreen
})
}
getData
(
func
)
{
if
(
window
&&
(
<
any
>
window
).
courseware
)
{
(
<
any
>
window
).
courseware
.
getData
(
func
,
'
scene
'
);
return
;
}
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
getData
(
func
);
return
;
}
func
(
this
.
getDefaultData
());
}
getDefaultData
()
{
...
...
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