|
@@ -1,23 +1,26 @@
|
|
|
-const log$f = new Logger("model-manager")
|
|
|
-class ModelManager{
|
|
|
+//const log$f = new Logger("model-manager")
|
|
|
+import {logger} from "./Logger.js"
|
|
|
+
|
|
|
+export default class ModelManager{
|
|
|
constructor(e, t) {
|
|
|
- E(this, "avatarModelList", []);
|
|
|
- E(this, "skinList", []);
|
|
|
- E(this, "applicationConfig");
|
|
|
- E(this, "config");
|
|
|
- E(this, "appId");
|
|
|
- E(this, "releaseId");
|
|
|
+ this.avatarModelList = []
|
|
|
+ this.skinList = []
|
|
|
+ this.applicationConfig = null;
|
|
|
+ this.config = null
|
|
|
this.appId = e,
|
|
|
this.releaseId = t
|
|
|
}
|
|
|
static getInstance(e, t) {
|
|
|
- return me.instance || (me.instance = new me(e,t)),
|
|
|
- me.instance
|
|
|
+ //getInstance(e, t) {
|
|
|
+ return this.instance || (this.instance = new ModelManager(e,t)),
|
|
|
+ this.instance
|
|
|
}
|
|
|
static findModels(e, t, r) {
|
|
|
+ //findModels(e, t, r) {
|
|
|
return e.filter(o=>o.typeName === t && o.className === r)
|
|
|
}
|
|
|
static findModel(e, t, r) {
|
|
|
+ //findModel(e, t, r) {
|
|
|
const n = e.filter(o=>o.typeName === t && o.className === r)[0];
|
|
|
return n || null
|
|
|
}
|
|
@@ -37,7 +40,7 @@ class ModelManager{
|
|
|
const o = `find path failed: skinId: ${e}, pathName: ${t}`;
|
|
|
return Promise.reject(new ParamError(o))
|
|
|
}
|
|
|
- return log$f.debug("find route success", n),
|
|
|
+ return logger.debug("find route success", n),
|
|
|
n
|
|
|
}
|
|
|
async findAssetList(e) {
|
|
@@ -46,7 +49,7 @@ class ModelManager{
|
|
|
const n = `find path failed: skinId: ${e}`;
|
|
|
return Promise.reject(new ParamError(n))
|
|
|
}
|
|
|
- return log$f.debug("find route success", r),
|
|
|
+ return logger.debug("find route success", r),
|
|
|
r
|
|
|
}
|
|
|
async findAsset(e, t, r="id") {
|
|
@@ -58,7 +61,7 @@ class ModelManager{
|
|
|
const a = `find asset failed: skinId: ${e}, keyValue: ${t}`;
|
|
|
return Promise.reject(new ParamError(a))
|
|
|
}
|
|
|
- return log$f.debug("find asset success", o),
|
|
|
+ return logger.debug("find asset success", o),
|
|
|
o
|
|
|
}
|
|
|
async findPoint(e, t) {
|
|
@@ -67,7 +70,7 @@ class ModelManager{
|
|
|
const o = `find point failed: skinId: ${e}, id: ${t}`;
|
|
|
return Promise.reject(new ParamError(o))
|
|
|
}
|
|
|
- return log$f.debug("find point success", n),
|
|
|
+ return logger.debug("find point success", n),
|
|
|
n
|
|
|
}
|
|
|
async requestConfig() {
|
|
@@ -90,7 +93,7 @@ class ModelManager{
|
|
|
config: n,
|
|
|
preload: o
|
|
|
},
|
|
|
- log$f.debug("get config success", this.config),
|
|
|
+ logger.debug("get config success", this.config),
|
|
|
this.config
|
|
|
} catch (r) {
|
|
|
return Promise.reject(r)
|
|
@@ -121,7 +124,7 @@ class ModelManager{
|
|
|
})),
|
|
|
this.avatarModelList
|
|
|
} catch (e) {
|
|
|
- return log$f.error(e),
|
|
|
+ return logger.error(e),
|
|
|
[]
|
|
|
}
|
|
|
}
|
|
@@ -184,7 +187,7 @@ class ModelManager{
|
|
|
),
|
|
|
this.skinList
|
|
|
} catch (e) {
|
|
|
- return log$f.error(e),
|
|
|
+ return logger.error(e),
|
|
|
[]
|
|
|
}
|
|
|
}
|
|
@@ -193,5 +196,7 @@ class ModelManager{
|
|
|
url: TEXTURE_URL
|
|
|
}]
|
|
|
}
|
|
|
-}
|
|
|
-;
|
|
|
+};
|
|
|
+
|
|
|
+// const modelManager = new ModelManager();
|
|
|
+// export { modelManager };
|