Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
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_debug
Commits
1c35a0b2
Commit
1c35a0b2
authored
Jun 24, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
f9bdbc38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
+49
-2
middleLayerBase.ts
assets/middleLayer_for_debug/script/middleLayerBase.ts
+49
-2
No files found.
assets/middleLayer_for_debug/script/middleLayerBase.ts
View file @
1c35a0b2
...
...
@@ -105,10 +105,18 @@ export abstract class middleLayerBase extends cc.Component {
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
}
loadBundle
(
sceneName
,
version
,
bondleUrl
)
{
async
loadBundle
(
sceneName
,
version
,
bondleUrl
)
{
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
this
.
showMask
();
this
.
showWaitingLetters
();
const
oldSceneName
=
this
.
currentBundleInfo
?.
sceneName
;
const
engineInfo
=
await
this
.
getEngineInfo
();
const
{
isChanged
}
=
JSON
.
parse
(
engineInfo
);
if
(
isChanged
)
{
await
this
.
checkRotateScreen
(
oldSceneName
,
sceneName
);
}
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
const
btnRestart
=
cc
.
find
(
'
middleLayer/BtnRestart
'
);
...
...
@@ -129,6 +137,41 @@ export abstract class middleLayerBase extends cc.Component {
});
}
checkRotateScreen
(
oldSceneName
:
string
,
newSceneName
:
string
)
{
const
sceneNameList
=
[
'
op_16
'
];
if
(
sceneNameList
.
includes
(
oldSceneName
)
||
sceneNameList
.
includes
(
newSceneName
))
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
sceneNameList
.
includes
(
newSceneName
))
{
// 如果已经是竖屏了
if
(
cc
.
view
.
getCanvasSize
().
width
<
cc
.
view
.
getCanvasSize
().
height
)
{
resolve
(
null
);
return
;
}
// 旋转到竖屏
(
<
any
>
window
).
courseware
.
onConfigurationPortrait
({},
async
()
=>
{
while
(
cc
.
view
.
getCanvasSize
().
width
>
cc
.
view
.
getCanvasSize
().
height
)
{
await
asyncDelay
(
0.1
);
}
resolve
(
null
);
});
}
else
{
// 如果已经是横屏了
if
(
cc
.
view
.
getCanvasSize
().
width
>
cc
.
view
.
getCanvasSize
().
height
)
{
resolve
(
null
);
return
;
}
// 旋转到横屏
(
<
any
>
window
).
courseware
.
onConfigurationLandscape
({},
async
()
=>
{
while
(
cc
.
view
.
getCanvasSize
().
width
<
cc
.
view
.
getCanvasSize
().
height
)
{
await
asyncDelay
(
0.1
);
}
resolve
(
null
);
});
}
});
}
}
courses
=
null
;
courseIndex
=
0
;
courseItem
=
null
;
...
...
@@ -223,4 +266,8 @@ export abstract class middleLayerBase extends cc.Component {
cc
.
log
(
str
);
}
}
\ No newline at end of file
}
function
asyncDelay
(
arg0
:
number
)
{
throw
new
Error
(
"
Function not implemented.
"
);
}
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