refactor(map): replace main node显隐操作转为动画控制
将原来通过查找main节点手动控制显隐的逻辑,替换为新增的MapLayer动画启停方法,简化代码逻辑并统一动画管理方式
This commit is contained in:
@@ -80,10 +80,8 @@ export class MissionHomeComp extends CCComp {
|
||||
this.node.active=false;
|
||||
|
||||
// 隐藏 mapLayer 下的 main 节点
|
||||
let mainNode = smc.map.MapView.scene.mapLayer?.node.getChildByName("main");
|
||||
if (mainNode) {
|
||||
mainNode.active = false;
|
||||
}
|
||||
smc.map.MapView.scene.mapLayer?.stopAnimations();
|
||||
|
||||
}
|
||||
|
||||
/** 打开排行榜弹窗 */
|
||||
@@ -106,12 +104,7 @@ export class MissionHomeComp extends CCComp {
|
||||
home_active(){
|
||||
this.uodate_data()
|
||||
this.node.active=true
|
||||
|
||||
// 重新显示 mapLayer 下的 main 节点
|
||||
let mainNode = smc.map.MapView.scene.mapLayer?.node.getChildByName("main");
|
||||
if (mainNode) {
|
||||
mainNode.active = true;
|
||||
}
|
||||
smc.map.MapView.scene.mapLayer?.playAnimations();
|
||||
}
|
||||
|
||||
/** 更新主页显示数据(预留) */
|
||||
|
||||
Reference in New Issue
Block a user