mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-03 18:49:23 +08:00
优化
This commit is contained in:
@@ -21,6 +21,23 @@ export class ModuleUtil {
|
||||
oops.gui.open(uiId, uiArgs, uic);
|
||||
}
|
||||
|
||||
public static addViewAsync<T extends CCVMParentComp | CCComp>(
|
||||
ent: ecs.Entity,
|
||||
ctor: __private._types_globals__Constructor<T> | __private._types_globals__AbstractedConstructor<T>,
|
||||
uiId: number,
|
||||
uiArgs: any = null): Promise<Node | null> {
|
||||
return new Promise<Node | null>((resolve, reject) => {
|
||||
var uic: UICallbacks = {
|
||||
onAdded: (node: Node, params: any) => {
|
||||
var comp = node.getComponent(ctor) as ecs.Comp;
|
||||
ent.add(comp);
|
||||
resolve(node);
|
||||
}
|
||||
};
|
||||
oops.gui.open(uiId, uiArgs, uic);
|
||||
});
|
||||
}
|
||||
|
||||
public static removeView(ent: ecs.Entity, ctor: CompType<ecs.IComp>, uiId: number, isDestroy: boolean = true) {
|
||||
ent.remove(ctor);
|
||||
oops.gui.remove(uiId, isDestroy);
|
||||
|
||||
Reference in New Issue
Block a user