为ResLoader添加命名空间

This commit is contained in:
宝爷
2019-10-24 16:40:41 +08:00
committed by wyb10a10
parent c49e7685e1
commit 48ceb2afde
6 changed files with 338 additions and 310 deletions

View File

@@ -1,4 +1,4 @@
import ResLoader from "../res/ResLoader";
import { kx } from "../res/ResLoader";
const { ccclass, property } = cc._decorator;
@@ -23,7 +23,7 @@ export default class NetExample extends cc.Component {
}
onMyLoadRes() {
ResLoader.getInstance().loadRes("Prefab/HelloWorld", cc.Prefab, (error: Error, prefab: cc.Prefab) => {
kx.loader.loadRes("Prefab/HelloWorld", cc.Prefab, (error: Error, prefab: cc.Prefab) => {
if (!error) {
cc.instantiate(prefab).parent = this.attachNode;
}
@@ -32,7 +32,7 @@ export default class NetExample extends cc.Component {
onMyUnloadRes() {
this.attachNode.removeAllChildren(true);
ResLoader.getInstance().releaseRes("Prefab/HelloWorld");
kx.loader.releaseRes("Prefab/HelloWorld");
}
onDump() {