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
02e023e2
Commit
02e023e2
authored
Nov 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在心跳请求中,增加登录状态判断,实现单点登录
parent
cb398c89
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
91 deletions
+110
-91
PageViewer.ts
assets/middleLayer_for_kyxq/script/PageViewer.ts
+24
-27
middleLayerBase.ts
assets/middleLayer_for_kyxq/script/middleLayerBase.ts
+86
-64
No files found.
assets/middleLayer_for_kyxq/script/PageViewer.ts
View file @
02e023e2
...
@@ -81,6 +81,9 @@ export default class NewClass extends cc.Component {
...
@@ -81,6 +81,9 @@ export default class NewClass extends cc.Component {
isAnonymous
:
false
,
isAnonymous
:
false
,
isIOSReview
:
false
,
isIOSReview
:
false
,
})
})
// 清空信息
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
""
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
""
);
}
}
return
this
.
getStatus
(
"
userInfo
"
)
return
this
.
getStatus
(
"
userInfo
"
)
}
}
...
@@ -238,39 +241,33 @@ export default class NewClass extends cc.Component {
...
@@ -238,39 +241,33 @@ export default class NewClass extends cc.Component {
.
start
();
.
start
();
})
})
}
else
{
}
else
{
inPage
.
opacity
=
0
;
if
(
outPage
)
{
outPage
.
opacity
=
255
;
outPage
.
active
=
false
;
}
else
{
// 未传移除页面 则全部移除
this
.
justShowView
(
""
)
}
inPage
.
active
=
true
;
inPage
.
active
=
true
;
cc
.
tween
(
inPage
)
inPage
.
x
=
0
;
.
to
(
0.1
,
{
inPage
.
y
=
0
;
opacity
:
255
})
.
start
();
return
new
Promise
((
resovle
,
reject
)
=>
{
return
new
Promise
((
resovle
,
reject
)
=>
{
cc
.
tween
(
outPage
)
setTimeout
(()
=>
{
.
to
(
0.1
,
{
resovle
(
true
)
opacity
:
0
},
1
)
})
.
call
(()
=>
{
outPage
.
active
=
false
;
resovle
(
true
)
})
.
start
();
})
})
}
}
}
}
justShowView
(
viewName
){
justShowView
(
viewName
)
{
this
.
loginPage
.
active
=
viewName
==
"
LoginPage
"
this
.
loginPage
.
active
=
viewName
==
"
LoginPage
"
this
.
homePage
.
active
=
viewName
==
"
homePage
"
this
.
homePage
.
active
=
viewName
==
"
homePage
"
this
.
libraryPage
.
active
=
viewName
==
"
libraryPage
"
this
.
libraryPage
.
active
=
viewName
==
"
libraryPage
"
this
.
libraryReadPage
.
active
=
viewName
==
"
libraryReadPage
"
this
.
libraryReadPage
.
active
=
viewName
==
"
libraryReadPage
"
this
.
libraryAudioPage
.
active
=
viewName
==
"
libraryAudioPage
"
this
.
libraryAudioPage
.
active
=
viewName
==
"
libraryAudioPage
"
this
.
libraryVideoPage
.
active
=
viewName
==
"
libraryVideoPage
"
this
.
libraryVideoPage
.
active
=
viewName
==
"
libraryVideoPage
"
this
.
libraryReadDetailPage
.
active
=
viewName
==
"
libraryReadDetailPage
"
this
.
libraryReadDetailPage
.
active
=
viewName
==
"
libraryReadDetailPage
"
this
.
unitPage
.
active
=
viewName
==
"
unitPage
"
this
.
unitPage
.
active
=
viewName
==
"
unitPage
"
this
.
missionPage
.
active
=
viewName
==
"
missionPage
"
this
.
missionPage
.
active
=
viewName
==
"
missionPage
"
}
}
// update (dt) {}
// update (dt) {}
}
}
assets/middleLayer_for_kyxq/script/middleLayerBase.ts
View file @
02e023e2
import
{
asyncDelay
,
randomSortByArr
}
from
"
./util
"
;
import
{
asyncDelay
,
randomSortByArr
}
from
"
./util
"
;
export
abstract
class
middleLayerBase
extends
cc
.
Component
{
export
abstract
class
middleLayerBase
extends
cc
.
Component
{
abstract
reWriteAir
():
void
;
abstract
reWriteAir
():
void
;
isShowWaiting
=
false
;
isShowWaiting
=
false
;
hidePreloadWaiting
(){
hidePreloadWaiting
()
{
if
(
!
this
.
isShowWaiting
)
{
if
(
!
this
.
isShowWaiting
)
{
return
;
return
;
}
}
this
.
isShowWaiting
=
false
;
this
.
isShowWaiting
=
false
;
// 隐藏遮罩层
// 隐藏遮罩层
cc
.
find
(
`middleLayer/loadingLayer`
).
active
=
false
;
cc
.
find
(
`middleLayer/loadingLayer`
).
active
=
false
;
}
}
showPreloadWaiting
(){
showPreloadWaiting
()
{
if
(
this
.
isShowWaiting
)
{
if
(
this
.
isShowWaiting
)
{
return
;
return
;
}
}
this
.
isShowWaiting
=
true
;
this
.
isShowWaiting
=
true
;
cc
.
audioEngine
.
stopAll
();
cc
.
audioEngine
.
stopAll
();
// 显示遮罩层
// 显示遮罩层
cc
.
find
(
`middleLayer/loadingLayer`
).
active
=
true
;
cc
.
find
(
`middleLayer/loadingLayer`
).
active
=
true
;
...
@@ -47,7 +46,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -47,7 +46,7 @@ export abstract class middleLayerBase extends cc.Component {
callNetworkApiPost
(
uri
,
data
,
callBack
,
sendHook
=
null
)
{
callNetworkApiPost
(
uri
,
data
,
callBack
,
sendHook
=
null
)
{
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
data
=
{
...
data
,
token
};
data
=
{
...
data
,
token
};
this
.
getEngineInfo
().
then
((
engineInfo
)
=>
{
this
.
getEngineInfo
().
then
((
engineInfo
)
=>
{
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
const
url
=
`
${
engineInfo
[
"
apiBase
"
]}${
uri
}
`
;
const
url
=
`
${
engineInfo
[
"
apiBase
"
]}${
uri
}
`
;
...
@@ -63,9 +62,11 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -63,9 +62,11 @@ export abstract class middleLayerBase extends cc.Component {
});
});
}
}
// 超时时间 单位秒
timeoutTime
=
10
;
callNetworkApiGet
(
uri
,
data
,
callback
,
sendHook
=
null
)
{
callNetworkApiGet
(
uri
,
data
,
callback
,
sendHook
=
null
)
{
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
data
=
{
...
data
,
token
};
data
=
{
...
data
,
token
};
this
.
getEngineInfo
().
then
((
engineInfo
)
=>
{
this
.
getEngineInfo
().
then
((
engineInfo
)
=>
{
let
queryStr
=
'
?
'
;
let
queryStr
=
'
?
'
;
const
params
=
[];
const
params
=
[];
...
@@ -74,33 +75,68 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -74,33 +75,68 @@ export abstract class middleLayerBase extends cc.Component {
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
}
}
}
}
queryStr
+=
params
.
join
(
"
&
"
);
queryStr
+=
params
.
join
(
"
&
"
);
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
let
flag
=
false
;
let
flag
=
false
;
xhr
.
onreadystatechange
=
()
=>
{
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
flag
=
true
;
flag
=
true
;
callback
(
JSON
.
parse
(
xhr
.
responseText
));
const
resData
=
JSON
.
parse
(
xhr
.
responseText
)
// if(uri.includes("heart")) {
// console.log("--Heart info-------------------")
// console.log("token: ", token);
// console.log("响应码: ", resData.code);
// }
// 如果是心跳请求,并且有token - 判断是否已经登出
if
(
uri
.
includes
(
"
heart
"
))
{
if
(
resData
.
code
==
1005
)
{
// 如果是有Token的情况下 视为已经登录,登出
if
(
token
)
{
console
.
log
(
"
您的账号在其他设备上登录,请重新登陆
"
)
this
.
showTips
(
`您的账号在其他设备上登录,请重新登陆`
);
// 强制隐藏遮罩层
this
.
isShowWaiting
=
false
;
cc
.
find
(
`middleLayer/loadingLayer`
).
active
=
false
;
cc
.
find
(
`middleLayer/loading`
).
active
=
false
;
// 登出
const
vc
=
cc
.
find
(
"
middleLayer/Views
"
).
getComponent
(
"
PageViewer
"
);
global
.
middleLayer
.
isLogin
=
false
;
vc
.
setUserInfo
({
phone
:
""
,
isAnonymous
:
false
,
isIOSReview
:
false
,
});
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
""
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
""
);
// 跳转登录页
vc
.
toView
(
"
LoginPage
"
)
}
}
}
callback
(
resData
);
}
}
};
};
const
url
=
`
${
engineInfo
[
"
apiBase
"
]}${
uri
}${
queryStr
}
`
;
const
url
=
`
${
engineInfo
[
"
apiBase
"
]}${
uri
}${
queryStr
}
`
;
// console.log('url = ' + url);
sendHook
&&
sendHook
(
xhr
);
sendHook
&&
sendHook
(
xhr
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
xhr
.
send
();
//
五秒
超时重试一次
// 超时重试一次
if
(
sendHook
)
{
if
(
sendHook
)
{
// 有hook的无法重试请求
// 有hook的无法重试请求
return
;
return
;
}
}
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
if
(
flag
)
{
if
(
flag
)
{
return
;
return
;
}
}
xhr
.
abort
();
xhr
.
abort
();
this
.
callNetworkApiGet
(
uri
,
data
,
callback
);
this
.
callNetworkApiGet
(
uri
,
data
,
callback
);
},
10
);
},
this
.
timeoutTime
);
});
});
}
}
...
@@ -160,6 +196,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -160,6 +196,7 @@ export abstract class middleLayerBase extends cc.Component {
loopEngineInfo
();
loopEngineInfo
();
});
});
}
}
asyncCallNetworkApiGet
(
uri
,
data
):
Promise
<
any
>
{
asyncCallNetworkApiGet
(
uri
,
data
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
callNetworkApiGet
(
uri
,
data
,
(
res
=>
{
this
.
callNetworkApiGet
(
uri
,
data
,
(
res
=>
{
...
@@ -167,6 +204,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -167,6 +204,7 @@ export abstract class middleLayerBase extends cc.Component {
}));
}));
});
});
}
}
asyncCallNetworkApiPost
(
uri
,
data
):
Promise
<
any
>
{
asyncCallNetworkApiPost
(
uri
,
data
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
callNetworkApiPost
(
uri
,
data
,
(
res
)
=>
{
this
.
callNetworkApiPost
(
uri
,
data
,
(
res
)
=>
{
...
@@ -206,35 +244,28 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -206,35 +244,28 @@ export abstract class middleLayerBase extends cc.Component {
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
(
finish
,
total
,
item
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
(
finish
,
total
,
item
)
=>
{
this
.
setLoadingProgressBar
(
Math
.
floor
(
finish
/
total
*
100
));
this
.
setLoadingProgressBar
(
Math
.
floor
(
finish
/
total
*
100
));
},
(
err
,
scene
)
=>
{
},
(
err
,
scene
)
=>
{
this
.
setLoadingProgressBar
(
0
);
this
.
setLoadingProgressBar
(
0
);
this
.
courseOpenTimeStamp
=
Date
.
now
();
this
.
courseOpenTimeStamp
=
Date
.
now
();
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
console
.
log
(
'
sceneName =
'
+
sceneName
);
console
.
log
(
'
sceneName =
'
+
sceneName
);
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
const
wgt
=
canvas
.
getComponent
(
cc
.
Widget
);
const
wgt
=
canvas
.
getComponent
(
cc
.
Widget
);
if
(
wgt
)
{
if
(
wgt
)
{
wgt
.
updateAlignment
();
wgt
.
updateAlignment
();
}
}
middleLayer
.
scale
=
canvas
.
width
/
middleLayer
.
width
;
middleLayer
.
scale
=
canvas
.
width
/
middleLayer
.
width
;
// 挂载清洁骨骼机制节点
// 挂载清洁骨骼机制节点
const
destroyer
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/Destroyer
'
));
const
destroyer
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/Destroyer
'
));
destroyer
.
parent
=
cc
.
find
(
'
Canvas
'
);
destroyer
.
parent
=
cc
.
find
(
'
Canvas
'
);
destroyer
.
active
=
true
;
destroyer
.
active
=
true
;
// 手机端强制垃圾回收
// 手机端强制垃圾回收
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
||
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
||
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
cc
.
sys
.
garbageCollect
();
cc
.
sys
.
garbageCollect
();
}
}
//显示退出按钮
//显示退出按钮
this
.
showExitBtn
(
sceneName
);
this
.
showExitBtn
(
sceneName
);
callback
&&
callback
();
callback
&&
callback
();
this
.
IS_BUNDLE_LOADING
=
false
;
this
.
IS_BUNDLE_LOADING
=
false
;
this
.
oldSceneName
=
sceneName
;
this
.
oldSceneName
=
sceneName
;
...
@@ -246,10 +277,10 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -246,10 +277,10 @@ export abstract class middleLayerBase extends cc.Component {
progressTextCom
=
null
;
progressTextCom
=
null
;
progressBarScript
=
null
;
progressBarScript
=
null
;
setLoadingProgressBar
(
pInt
)
{
setLoadingProgressBar
(
pInt
)
{
if
(
!
this
.
progressTextCom
)
{
if
(
!
this
.
progressTextCom
)
{
this
.
progressTextCom
=
cc
.
find
(
"
middleLayer/loadingLayer/progressText
"
).
getComponent
(
cc
.
Label
)
this
.
progressTextCom
=
cc
.
find
(
"
middleLayer/loadingLayer/progressText
"
).
getComponent
(
cc
.
Label
)
}
}
if
(
!
this
.
progressBarScript
)
{
if
(
!
this
.
progressBarScript
)
{
this
.
progressBarScript
=
cc
.
find
(
'
middleLayer/loadingLayer/prograss
'
).
getComponent
(
'
progress
'
);
this
.
progressBarScript
=
cc
.
find
(
'
middleLayer/loadingLayer/prograss
'
).
getComponent
(
'
progress
'
);
}
}
this
.
progressTextCom
.
string
=
`
${
pInt
}
%`
;
this
.
progressTextCom
.
string
=
`
${
pInt
}
%`
;
...
@@ -267,7 +298,6 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -267,7 +298,6 @@ export abstract class middleLayerBase extends cc.Component {
setParentVisible
(
n
.
parent
);
setParentVisible
(
n
.
parent
);
}
}
}
}
this
.
nodeList
.
forEach
(
node
=>
{
this
.
nodeList
.
forEach
(
node
=>
{
setParentVisible
(
node
);
setParentVisible
(
node
);
});
});
...
@@ -334,7 +364,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -334,7 +364,7 @@ export abstract class middleLayerBase extends cc.Component {
this
.
callNetworkApiGet
(
api
,
{},
(
data
)
=>
{
this
.
callNetworkApiGet
(
api
,
{},
(
data
)
=>
{
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
this
.
courses
=
data
.
rows
;
this
.
courses
=
data
.
rows
;
if
(
typeof
courseIndex
!=
null
&&
!
isNaN
(
courseIndex
)
&&
courseIndex
>
0
)
{
if
(
typeof
courseIndex
!=
null
&&
!
isNaN
(
courseIndex
)
&&
courseIndex
>
0
)
{
this
.
courseIndex
=
courseIndex
-
1
;
this
.
courseIndex
=
courseIndex
-
1
;
}
else
{
}
else
{
this
.
courseIndex
=
data
.
index
||
0
;
this
.
courseIndex
=
data
.
index
||
0
;
...
@@ -399,7 +429,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -399,7 +429,7 @@ export abstract class middleLayerBase extends cc.Component {
version
=
""
;
version
=
""
;
bundleUrl
=
`
${
templateBaseUrl
}
/web_desktop`
;
bundleUrl
=
`
${
templateBaseUrl
}
/web_desktop`
;
}
}
this
.
loadBundle
(
sceneName
,
version
,
bundleUrl
,
()
=>
{
this
.
loadBundle
(
sceneName
,
version
,
bundleUrl
,
()
=>
{
callback
&&
callback
(
true
)
callback
&&
callback
(
true
)
});
});
});
});
...
@@ -417,9 +447,11 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -417,9 +447,11 @@ export abstract class middleLayerBase extends cc.Component {
goPrePage
()
{
goPrePage
()
{
this
.
goTarIndexPage
(
this
.
courseIndex
-
1
);
this
.
goTarIndexPage
(
this
.
courseIndex
-
1
);
}
}
goNextPage
()
{
goNextPage
()
{
this
.
goTarIndexPage
(
this
.
courseIndex
+
1
);
this
.
goTarIndexPage
(
this
.
courseIndex
+
1
);
}
}
goTarIndexPage
(
index
)
{
goTarIndexPage
(
index
)
{
if
(
this
.
IS_BUNDLE_LOADING
)
{
if
(
this
.
IS_BUNDLE_LOADING
)
{
return
;
return
;
...
@@ -431,7 +463,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -431,7 +463,7 @@ export abstract class middleLayerBase extends cc.Component {
}
}
this
.
showPreloadWaiting
();
this
.
showPreloadWaiting
();
(
<
any
>
window
).
courseware
.
freeAllOcMethod
();
(
<
any
>
window
).
courseware
.
freeAllOcMethod
();
this
.
courseIndex
=
index
;
this
.
courseIndex
=
index
;
...
@@ -446,34 +478,34 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -446,34 +478,34 @@ export abstract class middleLayerBase extends cc.Component {
}
}
tipsTween
=
null
;
tipsTween
=
null
;
async
showTips
(
str
:
string
)
{
async
showTips
(
str
:
string
)
{
const
tipsLayer
=
cc
.
find
(
'
middleLayer/tipsLayer
'
);
const
tipsLayer
=
cc
.
find
(
'
middleLayer/tipsLayer
'
);
if
(
this
.
tipsTween
)
{
if
(
this
.
tipsTween
)
{
this
.
tipsTween
.
stop
();
this
.
tipsTween
.
stop
();
tipsLayer
.
active
=
false
;
tipsLayer
.
active
=
false
;
}
}
const
label
=
cc
.
find
(
'
middleLayer/tipsLayer/tips/label
'
);
const
label
=
cc
.
find
(
'
middleLayer/tipsLayer/tips/label
'
);
label
.
getComponent
(
cc
.
Label
).
string
=
`
${
str
}
`
;
label
.
getComponent
(
cc
.
Label
).
string
=
`
${
str
}
`
;
const
tips
=
cc
.
find
(
'
middleLayer/tipsLayer/tips
'
);
const
tips
=
cc
.
find
(
'
middleLayer/tipsLayer/tips
'
);
tipsLayer
.
active
=
true
;
tipsLayer
.
active
=
true
;
tips
.
width
=
Math
.
max
(
300
,
label
.
width
+
50
);
tips
.
width
=
Math
.
max
(
300
,
label
.
width
+
50
);
this
.
tipsTween
=
cc
.
tween
(
tips
)
this
.
tipsTween
=
cc
.
tween
(
tips
)
.
set
({
opacity
:
255
})
.
set
({
opacity
:
255
})
.
to
(
5
,
{
opacity
:
0
})
.
to
(
5
,
{
opacity
:
0
})
.
call
(()
=>
{
.
call
(()
=>
{
tipsLayer
.
active
=
false
;
tipsLayer
.
active
=
false
;
this
.
tipsTween
=
null
;
this
.
tipsTween
=
null
;
})
})
.
start
();
.
start
();
}
}
async
hideTips
()
{
async
hideTips
()
{
const
tipsLayer
=
cc
.
find
(
'
middleLayer/tipsLayer
'
);
const
tipsLayer
=
cc
.
find
(
'
middleLayer/tipsLayer
'
);
if
(
this
.
tipsTween
)
{
if
(
this
.
tipsTween
)
{
this
.
tipsTween
.
stop
();
this
.
tipsTween
.
stop
();
}
}
tipsLayer
.
active
=
false
;
tipsLayer
.
active
=
false
;
}
}
...
@@ -488,13 +520,12 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -488,13 +520,12 @@ export abstract class middleLayerBase extends cc.Component {
this
.
setNodeListVisible
();
this
.
setNodeListVisible
();
for
(
let
i
=
0
;
i
<
this
.
atlasList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
atlasList
.
length
;
i
++
)
{
const
atlas
=
this
.
atlasList
[
i
];
const
atlas
=
this
.
atlasList
[
i
];
const
asset
=
this
.
assetList
[
i
];
const
asset
=
this
.
assetList
[
i
];
const
texture
=
this
.
textureList
[
i
];
const
texture
=
this
.
textureList
[
i
];
const
node
=
this
.
nodeList
[
i
];
const
node
=
this
.
nodeList
[
i
];
atlas
.
decRef
();
atlas
.
decRef
();
cc
.
assetManager
.
releaseAsset
(
atlas
);
cc
.
assetManager
.
releaseAsset
(
atlas
);
atlas
.
destroy
();
atlas
.
destroy
();
...
@@ -504,10 +535,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -504,10 +535,7 @@ export abstract class middleLayerBase extends cc.Component {
asset
.
destroy
();
asset
.
destroy
();
texture
.
decRef
();
texture
.
decRef
();
}
}
}
}
assetObj
=
null
;
assetObj
=
null
;
...
@@ -516,12 +544,10 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -516,12 +544,10 @@ export abstract class middleLayerBase extends cc.Component {
assetList
=
null
;
assetList
=
null
;
textureList
=
null
;
textureList
=
null
;
getDragonDisplayAssetList
(
node
)
{
getDragonDisplayAssetList
(
node
)
{
const
dragonDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
const
dragonDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
if
(
dragonDisplay
)
{
if
(
dragonDisplay
)
{
const
atlas
=
dragonDisplay
.
dragonAtlasAsset
;
const
atlas
=
dragonDisplay
.
dragonAtlasAsset
;
const
asset
=
dragonDisplay
.
dragonAsset
;
const
asset
=
dragonDisplay
.
dragonAsset
;
if
(
atlas
&&
atlas
.
texture
)
{
if
(
atlas
&&
atlas
.
texture
)
{
if
(
atlas
.
texture
.
nativeUrl
.
includes
(
'
h5template
'
))
{
if
(
atlas
.
texture
.
nativeUrl
.
includes
(
'
h5template
'
))
{
node
.
children
.
forEach
(
child
=>
{
node
.
children
.
forEach
(
child
=>
{
...
@@ -529,14 +555,12 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -529,14 +555,12 @@ export abstract class middleLayerBase extends cc.Component {
});
});
return
;
return
;
}
}
this
.
nodeList
.
push
(
node
);
this
.
nodeList
.
push
(
node
);
this
.
atlasList
.
push
(
atlas
);
this
.
atlasList
.
push
(
atlas
);
this
.
assetList
.
push
(
asset
);
this
.
assetList
.
push
(
asset
);
this
.
textureList
.
push
(
atlas
.
texture
);
this
.
textureList
.
push
(
atlas
.
texture
);
}
}
}
}
node
.
children
.
forEach
(
child
=>
{
node
.
children
.
forEach
(
child
=>
{
this
.
getDragonDisplayAssetList
(
child
);
this
.
getDragonDisplayAssetList
(
child
);
});
});
...
@@ -544,10 +568,8 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -544,10 +568,8 @@ export abstract class middleLayerBase extends cc.Component {
toCleanParent
()
{
toCleanParent
()
{
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
canvas
=
cc
.
find
(
"
Canvas
"
);
this
.
nodeList
.
forEach
(
node
=>
{
this
.
nodeList
.
forEach
(
node
=>
{
node
.
parent
=
canvas
;
node
.
parent
=
canvas
;
});
});
}
}
}
}
\ No newline at end of file
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