mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-03 18:49:23 +08:00
优化
This commit is contained in:
@@ -118,14 +118,14 @@ oops.res.load("spine_path", sp.SkeletonData, (err: Error | null, sd: sp.Skeleton
|
||||
this.loadByArgs(args);
|
||||
}
|
||||
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], type: AssetType<T> | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], onComplete?: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], type: AssetType<T> | null, onComplete?: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], type: AssetType<T> | null, onProgress: ProgressCallback | null, onComplete: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], onProgress: ProgressCallback | null, onComplete: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], onComplete?: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], type: AssetType<T> | null, onComplete?: CompleteCallback<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], type: AssetType<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[]): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[]): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths: string | string[], type: AssetType<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], type: AssetType<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[]): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[]): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(paths: string | string[], type: AssetType<T> | null): Promise<Asset>;
|
||||
loadAsync<T extends Asset>(bundleName: string, paths?: string | string[] | AssetType<T> | ProgressCallback | CompleteCallback | null, type?: AssetType<T> | ProgressCallback | CompleteCallback | null): Promise<Asset> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.load(bundleName, paths, type, (err: Error | null, asset: Asset) => {
|
||||
|
||||
28
assets/module/common/ModuleUtil.ts
Normal file
28
assets/module/common/ModuleUtil.ts
Normal file
@@ -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<T extends CCVMParentComp | CCComp>(
|
||||
ent: ecs.Entity,
|
||||
ctor: __private._types_globals__Constructor<T> | __private._types_globals__AbstractedConstructor<T>,
|
||||
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<ecs.IComp>, uiId: number, isDestroy: boolean = true) {
|
||||
ent.remove(ctor);
|
||||
oops.gui.remove(uiId, isDestroy);
|
||||
}
|
||||
}
|
||||
9
assets/module/common/ModuleUtil.ts.meta
Normal file
9
assets/module/common/ModuleUtil.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "52a6c740-3b9b-46c5-a784-d53a6b67954a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user