diff --git a/assets/core/common/loader/ResLoader.ts b/assets/core/common/loader/ResLoader.ts index 8df42a0..6342ca6 100644 --- a/assets/core/common/loader/ResLoader.ts +++ b/assets/core/common/loader/ResLoader.ts @@ -118,14 +118,14 @@ oops.res.load("spine_path", sp.SkeletonData, (err: Error | null, sd: sp.Skeleton this.loadByArgs(args); } - loadAsync(bundleName: string, paths: string | string[], type: AssetType | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): Promise; - loadAsync(bundleName: string, paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): Promise; - loadAsync(bundleName: string, paths: string | string[], onComplete?: CompleteCallback | null): Promise; - loadAsync(bundleName: string, paths: string | string[], type: AssetType | null, onComplete?: CompleteCallback | null): Promise; - loadAsync(paths: string | string[], type: AssetType | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): Promise; - loadAsync(paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback | null): Promise; - loadAsync(paths: string | string[], onComplete?: CompleteCallback | null): Promise; - loadAsync(paths: string | string[], type: AssetType | null, onComplete?: CompleteCallback | null): Promise; + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null): Promise; + loadAsync(bundleName: string, paths: string | string[]): Promise; + loadAsync(bundleName: string, paths: string | string[]): Promise; + loadAsync(bundleName: string, paths: string | string[], type: AssetType | null): Promise; + loadAsync(paths: string | string[], type: AssetType | null): Promise; + loadAsync(paths: string | string[]): Promise; + loadAsync(paths: string | string[]): Promise; + loadAsync(paths: string | string[], type: AssetType | null): Promise; loadAsync(bundleName: string, paths?: string | string[] | AssetType | ProgressCallback | CompleteCallback | null, type?: AssetType | ProgressCallback | CompleteCallback | null): Promise { return new Promise((resolve, reject) => { this.load(bundleName, paths, type, (err: Error | null, asset: Asset) => { diff --git a/assets/module/common/ModuleUtil.ts b/assets/module/common/ModuleUtil.ts new file mode 100644 index 0000000..b79875e --- /dev/null +++ b/assets/module/common/ModuleUtil.ts @@ -0,0 +1,28 @@ +import { Node, __private } from "cc"; +import { oops } from "../../core/Oops"; +import { UICallbacks } from "../../core/gui/layer/Defines"; +import { ecs } from "../../libs/ecs/ECS"; +import { CCComp } from "./CCComp"; +import { CCVMParentComp } from "./CCVMParentComp"; +import { CompType } from "../../libs/ecs/ECSModel"; + +export class ModuleUtil { + public static addView( + ent: ecs.Entity, + ctor: __private._types_globals__Constructor | __private._types_globals__AbstractedConstructor, + uiId: number, + uiArgs: any = null) { + var uic: UICallbacks = { + onAdded: (node: Node, params: any) => { + var comp = node.getComponent(ctor) as ecs.Comp; + ent.add(comp); + } + }; + oops.gui.open(uiId, uiArgs, uic); + } + + public static removeView(ent: ecs.Entity, ctor: CompType, uiId: number, isDestroy: boolean = true) { + ent.remove(ctor); + oops.gui.remove(uiId, isDestroy); + } +} \ No newline at end of file diff --git a/assets/module/common/ModuleUtil.ts.meta b/assets/module/common/ModuleUtil.ts.meta new file mode 100644 index 0000000..533e417 --- /dev/null +++ b/assets/module/common/ModuleUtil.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "52a6c740-3b9b-46c5-a784-d53a6b67954a", + "files": [], + "subMetas": {}, + "userData": {} +}