mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-22 08:36:41 +08:00
GUI框架添加一个可获取到已显示界面节点对象的API,方便特殊需求可自定义逻辑
This commit is contained in:
@@ -187,7 +187,7 @@ export class LayerManager {
|
||||
has(uiId: number): boolean {
|
||||
var config = this.configs[uiId];
|
||||
if (config == null) {
|
||||
warn(`编号为【${uiId}】的界面失败,配置信息不存在`);
|
||||
warn(`编号为【${uiId}】的界面配置不存在,配置信息不存在`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -209,6 +209,37 @@ export class LayerManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存中是否存在指定标识的窗口
|
||||
* @param uiId 窗口唯一标识
|
||||
* @example
|
||||
* oops.gui.has(UIID.Loading);
|
||||
*/
|
||||
get(uiId: number): Node {
|
||||
var config = this.configs[uiId];
|
||||
if (config == null) {
|
||||
warn(`编号为【${uiId}】的界面配置不存在,配置信息不存在`);
|
||||
return null!;
|
||||
}
|
||||
|
||||
var result: Node = null!;
|
||||
switch (config.layer) {
|
||||
case LayerType.UI:
|
||||
result = this.ui.getByPrefabPath(config.prefab);
|
||||
break;
|
||||
case LayerType.PopUp:
|
||||
result = this.popup.getByPrefabPath(config.prefab);
|
||||
break;
|
||||
case LayerType.Dialog:
|
||||
result = this.dialog.getByPrefabPath(config.prefab);
|
||||
break;
|
||||
case LayerType.System:
|
||||
result = this.system.getByPrefabPath(config.prefab);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除指定标识的窗口
|
||||
* @param uiId 窗口唯一标识
|
||||
|
||||
@@ -177,6 +177,15 @@ export class LayerUI extends Node {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据预制路径获取已打开界面的节点对象
|
||||
* @param prefabPath 预制路径
|
||||
*/
|
||||
getByPrefabPath(prefabPath: string): Node {
|
||||
var uuid = this.getUuid(prefabPath);
|
||||
return this.getByUuid(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据唯一标识获取节点,如果节点不存在或者还在队列中,则返回null
|
||||
* @param uuid 唯一标识
|
||||
|
||||
Reference in New Issue
Block a user