feat: ui 控制器添加 active 用于控制是否显示

This commit is contained in:
unanmed 2025-05-27 21:04:54 +08:00
parent 046d136b5a
commit dd0f596e21
2 changed files with 5 additions and 6 deletions

View File

@ -209,7 +209,7 @@ const MainScene = defineComponent(() => {
)}
<container
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
hidden={!mainUIController.showBack.value}
hidden={!mainUIController.active.value}
zIndex={200}
>
{mainUIController.render()}

View File

@ -98,11 +98,8 @@ export class UIController
readonly showBack: ComputedRef<boolean> = computed(
() => this.userShowBack.value && this.sysShowBack.value
);
/** 当前是否显示 UI */
get active() {
return this.sysShowBack.value;
}
/** 当前 UI 是否激活 */
readonly active: Ref<boolean> = ref(false);
/** 自定义显示模式下的配置信息 */
private config?: IUICustomConfig;
@ -194,6 +191,7 @@ export class UIController
break;
}
this.sysShowBack.value = true;
this.active.value = true;
this.emit('open', ui, ins);
return ins;
@ -230,6 +228,7 @@ export class UIController
}
if (!this.keepBack && this.stack.length === 0) {
this.sysShowBack.value = false;
this.active.value = false;
}
this.keepBack = false;