xushiting 3 yıl önce
ebeveyn
işleme
9506219842
2 değiştirilmiş dosya ile 31 ekleme ve 15 silme
  1. 24 14
      src/XAvatarManager.js
  2. 7 1
      src/util.js

+ 24 - 14
src/XAvatarManager.js

@@ -178,20 +178,30 @@ export default class XAvatarManager {
                 assets: o,
                 status: a
             });
-            if (this.registerAvatar(u),
-            r == 0)
-                this.setMainAvatar(u.id),
-                this.addAvatarToScene(u, 0).then(c=>(logger.debug(`[Engine] avatar ${u.id} has been added to scene`),
-                c ? (this._updateBillboardStatus(c, BillboardStatus.SHOW),
-                setTimeout(()=>{
-                    this.launchProcessLoadingLoop()
-                }
-                , this._delayTime),
-                s(c)) : (u.removeAvatarFromScene(),
-                l(new AvatarAssetLoadingError)))).catch(c=>(u.removeAvatarFromScene(),
-                l(new AvatarAssetLoadingError(c))));
-            else
-                return s(u)
+            this.registerAvatar(u);
+            // if (r == 0)
+            //     this.setMainAvatar(u.id),
+            //     this.addAvatarToScene(u, 0).then(c=>(logger.debug(`[Engine] avatar ${u.id} has been added to scene`),
+            //     c ? (this._updateBillboardStatus(c, BillboardStatus.SHOW),
+            //     setTimeout(()=>{
+            //         this.launchProcessLoadingLoop()
+            //     }
+            //     , this._delayTime),
+            //     s(c)) : (u.removeAvatarFromScene(),
+            //     l(new AvatarAssetLoadingError)))).catch(c=>(u.removeAvatarFromScene(),
+            //     l(new AvatarAssetLoadingError(c))));
+            // else
+            //     return s(u)
+            this.setMainAvatar(u.id),
+            this.addAvatarToScene(u, 0).then(c=>(logger.debug(`[Engine] avatar ${u.id} has been added to scene`),
+            c ? (this._updateBillboardStatus(c, BillboardStatus.SHOW),
+            setTimeout(()=>{
+                this.launchProcessLoadingLoop()
+            }
+            , this._delayTime),
+            s(c)) : (u.removeAvatarFromScene(),
+            l(new AvatarAssetLoadingError)))).catch(c=>(u.removeAvatarFromScene(),
+            l(new AvatarAssetLoadingError(c))));
         }
         )
     }

+ 7 - 1
src/util.js

@@ -88,7 +88,13 @@ var util = {
         e
     },
     getRandomItem(i){
-        i.length === 0 ? null : i[Math.floor(Math.random() * i.length)]
+        if(i.length === 0){
+            return null
+        }
+        else{
+            return i[Math.floor(Math.random() * i.length)]
+        }
+        //i.length === 0 ? null : i[Math.floor(Math.random() * i.length)]
     },
     getErrorByCode(i) {
         if (i === Codes.Success)