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
835c0f7c
Commit
835c0f7c
authored
Dec 11, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复某些情况下nativeUrl为空导致的异常
parent
3a9d89ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
47 deletions
+49
-47
middleLayerBase.ts
assets/middleLayer_for_kyxq/script/middleLayerBase.ts
+49
-47
No files found.
assets/middleLayer_for_kyxq/script/middleLayerBase.ts
View file @
835c0f7c
...
...
@@ -92,10 +92,10 @@ export abstract class middleLayerBase extends cc.Component {
// }
// 如果是心跳请求,并且有token - 判断是否已经登出
if
(
uri
.
includes
(
"
heart
"
))
{
if
(
resData
.
code
==
1005
)
{
if
(
uri
.
includes
(
"
heart
"
))
{
if
(
resData
.
code
==
1005
)
{
// 如果是有Token的情况下 视为已经登录,登出
if
(
token
)
{
if
(
token
)
{
console
.
log
(
"
您的账号在其他设备上登录,请重新登陆
"
)
this
.
showTips
(
`您的账号在其他设备上登录,请重新登陆`
);
// 强制隐藏遮罩层
...
...
@@ -280,7 +280,7 @@ export abstract class middleLayerBase extends cc.Component {
*/
gcTimeoutId
=
null
;
runGC
()
{
if
(
this
.
gcTimeoutId
)
{
if
(
this
.
gcTimeoutId
)
{
this
.
log
(
`上次垃圾回收还未执行,重置回收计划时间`
)
clearTimeout
(
this
.
gcTimeoutId
);
this
.
gcTimeoutId
=
null
;
...
...
@@ -419,13 +419,13 @@ export abstract class middleLayerBase extends cc.Component {
async
loadPrefabByBundleName
(
bundleName
:
string
,
prefabPath
:
string
,
callback
:
Function
)
{
const
bundle
=
cc
.
assetManager
.
getBundle
(
bundleName
);
this
.
showPreloadWaiting
();
if
(
!
bundle
)
{
if
(
!
bundle
)
{
cc
.
log
(
`[F: loadPrefabByBundleName] Bundle:
${
bundleName
}
不存在尝试远程拉取信息`
)
cc
.
assetManager
.
loadBundle
(
bundleName
,
(
err
,
bundle
:
cc
.
AssetManager
.
Bundle
)
=>
{
bundle
.
load
(
prefabPath
,
cc
.
Prefab
,
(
finish
,
total
,
item
)
=>
{
this
.
setLoadingProgressBar
(
Math
.
floor
(
finish
/
total
*
100
));
},
async
(
err
,
prefab
:
cc
.
Prefab
)
=>
{
if
(
err
)
{
if
(
err
)
{
cc
.
log
(
`加载Prefab出错. 信息[BundleName:
${
bundleName
}
, PrefabPath:
${
prefabPath
}
]`
)
}
callback
(
err
,
prefab
)
...
...
@@ -437,7 +437,7 @@ export abstract class middleLayerBase extends cc.Component {
bundle
.
load
(
prefabPath
,
cc
.
Prefab
,
(
finish
,
total
,
item
)
=>
{
this
.
setLoadingProgressBar
(
Math
.
floor
(
finish
/
total
*
100
));
},
async
(
err
,
prefab
:
cc
.
Prefab
)
=>
{
if
(
err
)
{
if
(
err
)
{
cc
.
log
(
`加载Prefab出错. 信息[BundleName:
${
bundleName
}
, PrefabPath:
${
prefabPath
}
]`
)
}
callback
(
err
,
prefab
)
...
...
@@ -511,10 +511,12 @@ export abstract class middleLayerBase extends cc.Component {
// 释放远程加载的资源
cc
.
assetManager
.
assets
.
forEach
(
item
=>
{
if
(
item
&&
item
.
nativeUrl
)
{
if
(
item
.
nativeUrl
.
indexOf
(
`h5template`
)
==
-
1
&&
item
.
nativeUrl
.
indexOf
(
`dist`
)
==
-
1
&&
item
.
nativeUrl
.
indexOf
(
`http`
)
>
-
1
)
{
// console.log("Release: " + item.nativeUrl)
cc
.
assetManager
.
releaseAsset
(
item
);
}
}
});
}
...
...
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