mirror of
https://gitee.com/dgflash/oops-framework.git
synced 2026-05-20 01:35:42 +08:00
.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-08-16 09:34:56
|
||||
* @LastEditors: H.Joeson
|
||||
* @LastEditTime: 2021-10-27 11:16:29
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-07-15 18:51:00
|
||||
*/
|
||||
import { Animation, AnimationClip, EventTouch, instantiate, Node, Prefab, Size, UITransform, v3, Vec3 } from "cc";
|
||||
import { resLoader } from "../common/loader/ResLoader";
|
||||
@@ -79,6 +79,21 @@ export class ViewUtil {
|
||||
return n;
|
||||
}
|
||||
|
||||
/** 加载预制并创建预制节点 */
|
||||
public static createPrefabNodeAsync(path: string): Promise<Node> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
resLoader.load(path, Prefab, (err: Error | null, content: Prefab) => {
|
||||
if (err) {
|
||||
console.error(`名为【${path}】的资源加载失败`);
|
||||
return;
|
||||
}
|
||||
|
||||
var node = this.createPrefabNode(path);
|
||||
resolve(node);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 添加节点动画 */
|
||||
public static addNodeAnimation(name: string, node: Node, onlyOne: boolean = true, isDefaultClip: boolean = false) {
|
||||
if (!node || !node.isValid) {
|
||||
|
||||
Reference in New Issue
Block a user