|
@@ -10,14 +10,31 @@ export default class AB {
|
|
await this.loadPrefab("prefab/hall/PagePlay");
|
|
await this.loadPrefab("prefab/hall/PagePlay");
|
|
await this.loadPrefab("prefab/hall/PageWallet");
|
|
await this.loadPrefab("prefab/hall/PageWallet");
|
|
|
|
|
|
-
|
|
|
|
|
|
+ // load all sprites from texture/hall folder
|
|
|
|
+ let hallTextures = await this.loadDir("texture/hall", SpriteFrame);
|
|
|
|
+ console.warn("hall textures loaded:", hallTextures.length);
|
|
|
|
+
|
|
|
|
+ let rankTextures = await this.loadDir("texture/rank", SpriteFrame);
|
|
|
|
+ console.warn("rank textures loaded:", rankTextures.length);
|
|
|
|
+ let shopTextures = await this.loadDir("texture/shop", SpriteFrame);
|
|
|
|
+ console.warn("shop textures loaded:", shopTextures.length);
|
|
|
|
+ let playTextures = await this.loadDir("texture/play", SpriteFrame);
|
|
|
|
+ console.warn("play textures loaded:", playTextures.length);
|
|
|
|
+
|
|
|
|
+ let walletTextures = await this.loadDir("texture/wallet", SpriteFrame);
|
|
|
|
+ console.warn("wallet textures loaded:", walletTextures.length);
|
|
|
|
+ let commonTextures = await this.loadDir("texture/common", SpriteFrame);
|
|
|
|
+ console.warn("common textures loaded:", commonTextures.length);
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
async loadInLoading(): Promise<boolean> {
|
|
async loadInLoading(): Promise<boolean> {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
resolve(true);
|
|
resolve(true);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
loadRes(path: string, asset: typeof Asset): Promise<Asset> {
|
|
loadRes(path: string, asset: typeof Asset): Promise<Asset> {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
resources.load(path, asset, (err, asset) => {
|
|
resources.load(path, asset, (err, asset) => {
|
|
@@ -29,6 +46,19 @@ export default class AB {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ loadDir(path: string, asset: typeof Asset): Promise<Asset[]> {
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ resources.loadDir(path, asset, (err, assets) => {
|
|
|
|
+ if (err) {
|
|
|
|
+ reject(err);
|
|
|
|
+ } else {
|
|
|
|
+ resolve(assets);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
private static _ins: AB;
|
|
private static _ins: AB;
|
|
|
|
|
|
public static get ins(): AB {
|
|
public static get ins(): AB {
|