@cc-component/cc-core 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { js } from "cc";
|
|
2
|
+
import { ecs } from "../lib/ecs/ECS";
|
|
1
3
|
|
|
2
4
|
|
|
3
5
|
export class BaseModuleConfig {
|
|
@@ -5,6 +7,8 @@ export class BaseModuleConfig {
|
|
|
5
7
|
public getModule<T>(name: string, factory: () => T): T {
|
|
6
8
|
if (!this.modules.has(name)) {
|
|
7
9
|
this.modules.set(name, factory());
|
|
10
|
+
const comp: any = js.getClassByName(`${name}Manager`)
|
|
11
|
+
if (comp) ecs.getSingleton(comp)
|
|
8
12
|
}
|
|
9
13
|
return this.modules.get(name);
|
|
10
14
|
}
|
|
@@ -219,6 +219,7 @@ export class App {
|
|
|
219
219
|
if (!param) {
|
|
220
220
|
param = {}
|
|
221
221
|
}
|
|
222
|
+
//界面回调方法
|
|
222
223
|
const call = param?.callBack;
|
|
223
224
|
const backCallback = (arg1: any, arg2: any) => {
|
|
224
225
|
call?.(arg1, arg2)
|
|
@@ -323,7 +324,14 @@ export class App {
|
|
|
323
324
|
});
|
|
324
325
|
destroyPromises.push(destroyPromise); // 将 Promise 添加到集合中
|
|
325
326
|
if (view && view.node && isValid(view.node, true)) {
|
|
326
|
-
|
|
327
|
+
/**关闭事件-当系统级关闭所有打开的界面时。如果关闭界面时需要执行自己的业务逻辑,使用此属性
|
|
328
|
+
* eventName:关闭方法名称
|
|
329
|
+
* param:参数
|
|
330
|
+
*/
|
|
331
|
+
const closeEvent: { eventName: string, param?: any } = view.closeEvent
|
|
332
|
+
const close: Function = view[closeEvent.eventName]
|
|
333
|
+
if (close) { close.call(view, closeEvent.param) }
|
|
334
|
+
if (view && view.node && view.node.isValid) view.node.destroy(); // 关闭窗口
|
|
327
335
|
}
|
|
328
336
|
}
|
|
329
337
|
})
|