zhouenguang 3 年之前
父节点
当前提交
d8941eb42c
共有 6 个文件被更改,包括 9 次插入7 次删除
  1. 3 1
      dist/index.html
  2. 1 1
      src/BreathPoint.js
  3. 2 1
      src/Logger.js
  4. 1 2
      src/XAvatarLoader.js
  5. 1 1
      src/XLightManager.js
  6. 1 1
      src/XSceneManager.js

+ 3 - 1
dist/index.html

@@ -79,6 +79,7 @@
   
     const COMPONENT_LIST_PREFIX = "/component_list.json";
 
+    const debugMode = location.href.indexOf("debug") > -1  // true
     
 
     // 角色相关设置
@@ -796,7 +797,8 @@
             // toast("\u5F00\u59CB\u5F55\u5236");
         }
 
-
+        // 只在调试时显示control面板
+        debugMode || (document.querySelector(".debug_control_btns").style.display = "none")
     </script>
 
     <script src="js/index.js"></script>

+ 1 - 1
src/BreathPoint.js

@@ -20,7 +20,7 @@ export default class BreathPoint {
         this._skinInfo = skinInfo;
         this._isInScene = !0;
 
-        if(location.href.indexOf("debug") > -1) {
+        if(debugMode) {
             var textureBPNum = new BABYLON.DynamicTexture("dynamic texture", {width:350, height:300}, this._scene);  
             textureBPNum.drawText(id, 0, 200, "bold 200px monospace", "red", "white", true, true); 
             var materialBPNum = new BABYLON.StandardMaterial("MatBPNum", this._scene);

+ 2 - 1
src/Logger.js

@@ -77,7 +77,8 @@ export default class Logger{
     error(...e) {
         return this.print("error", 4, ...e)
     }
+    // console前缀
     prefix(e) {
-        return `[${this.module}] ${util.getFormattedDate(new Date)}:`
+        return `[${this.module}] [${util.getFormattedDate(new Date)}]`
     }
 };

+ 1 - 2
src/XAvatarLoader.js

@@ -243,8 +243,7 @@ export default class XAvatarLoader {
     }
     _loadGlbFromBlob(sceneManager, i, aniModelPath) {
         return sceneManager.urlTransformer(aniModelPath)
-        .then(path=>BABYLON.SceneLoader.LoadAssetContainerAsync("", path, sceneManager.Scene, null, ".glb")
-        .then(model => {
+        .then(path=>BABYLON.SceneLoader.LoadAssetContainerAsync("", path, sceneManager.Scene, null, ".glb").then(model => {
             if (model) {
                 if (this.containers.get(aniModelPath))
                     return model.dispose(),

+ 1 - 1
src/XLightManager.js

@@ -25,7 +25,7 @@ export default class XLightManager {
         this._avatarShadowMeshMap = new Map,
         this._cullingShadowObservers = new Map
 
-        if(location.href.indexOf("debug") > -1) {
+        if(debugMode) {
             this.bpNumlight = new BABYLON.HemisphericLight("BreathPointNumLight", new BABYLON.Vector3(0, 1, 0), this._scene);
         }
     }

+ 1 - 1
src/XSceneManager.js

@@ -59,7 +59,7 @@ export default class XSceneManager {
         this.engine.doNotHandleContextLost = !0,
         this.scene.clearCachedVertexData(),
         this.scene.cleanCachedTextureBuffer(),
-        location.href.indexOf("debug") > -1 && this.scene.debugLayer.show({ embedMode: true, }),    // BABYLON调试工具栏
+        debugMode && this.scene.debugLayer.show({ embedMode: true, }),    // BABYLON调试工具栏
 
         this.urlTransformer = options.urlTransformer || (s=>Promise.resolve(s)),
         options.logger && defaultLog.setLogger(options.logger),