zhouenguang 3 rokov pred
rodič
commit
2ebff2b60b
3 zmenil súbory, kde vykonal 21 pridanie a 23 odobranie
  1. 18 20
      src/JoyStick.js
  2. 2 2
      src/XAvatarManager.js
  3. 1 1
      src/XSceneManager.js

+ 18 - 20
src/JoyStick.js

@@ -5,23 +5,22 @@ export default class JoyStick {
         this._room = e
     }
     init(e) {
-        const {interval: t=33, triggerDistance: r=25, style: n={
-            left: 0,
-            bottom: 0
-        }} = e
-          , o = (u,c)=>{
+        const { interval=33, triggerDistance=25, style={left:0, bottom:0} } = e
+
+        const moveFunc = (u,c)=>{
             this._room.actionsHandler.joystick({
                 degree: Math.floor(u),
                 level: Math.floor(c / 5)
             })
         }
-          , a = this._zone;
+        const a = this._zone;
+
         document.body.appendChild(a),
         a.style.position = "absolute",
-        a.style.width = n.width || "200px",
-        a.style.height = n.height || "200px",
-        a.style.left = String(n.left || 0),
-        a.style.bottom = String(n.bottom || 0),
+        a.style.width = style.width || "200px",
+        a.style.height = style.height || "200px",
+        a.style.left = String(style.left || 0),
+        a.style.bottom = String(style.bottom || 0),
         a.style.zIndex = "999",
         a.style.userSelect = "none",
         a.style.webkitUserSelect = "none",
@@ -34,24 +33,23 @@ export default class JoyStick {
             },
             color: "white"
         });
+
         let s, l;
-        return this._joystick.on("move", (u,c)=>{
+        this._joystick.on("move", (u,c)=>{
             s = c
-        }
-        ),
+        })
         this._joystick.on("start", ()=>{
             l = window.setInterval(()=>{
-                s && s.distance > r && o && o(s.angle.degree, s.distance)
+                s && s.distance > triggerDistance && moveFunc && moveFunc(s.angle.degree, s.distance)
             }
-            , t)
-        }
-        ),
+            , interval)
+        })
         this._joystick.on("end", ()=>{
             l && window.clearInterval(l),
             l = void 0
-        }
-        ),
-        this._joystick
+        })
+
+        return this._joystick
     }
     show() {
         if (!this._joystick)

+ 2 - 2
src/XAvatarManager.js

@@ -550,7 +550,7 @@ export default class XAvatarManager {
         return new Promise((n,o)=>avatarLoader.load(this.sceneManager, t, r).then(a=>{
             if (a) {
                 const s = a.instantiateModelsToScene();
-                // 周恩光加 此时body_man缩放已经0.01
+                // zeg 此时body_man缩放已经0.01
                 console.log("body_man缩放", s.rootNodes[0]._children[0]._scaling)
                 a.xReferenceCount++;
                 const l = {
@@ -600,7 +600,7 @@ export default class XAvatarManager {
             if (a) {
                 this._clipContainerRes(a);
                 const s = a.meshes[1].clone(a.meshes[1].name, null);
-                // 周恩光加 装饰模型scale矫正
+                // zeg 装饰模型scale矫正
                 s.scaling = new BABYLON.Vector3(-0.01, 0.01, -0.01)
                 if (!s) {
                     logger.warn("[Engine] decoration does not exist!"),

+ 1 - 1
src/XSceneManager.js

@@ -120,7 +120,7 @@ export default class XSceneManager {
         this.engine.doNotHandleContextLost = !0,
         this.scene.clearCachedVertexData(),
         this.scene.cleanCachedTextureBuffer(),
-        // 周恩光加 调试用工具栏
+        // 调试用工具栏
         this.scene.debugLayer.show({
             embedMode: true,
         })