فهرست منبع

3dModeling buildingCreate.js 吉超博 commit at 2021-01-15

吉超博 4 سال پیش
والد
کامیت
cc64b123b7
1فایلهای تغییر یافته به همراه81 افزوده شده و 0 حذف شده
  1. 81 0
      3dModeling/tjby31/buildingCreate.js

+ 81 - 0
3dModeling/tjby31/buildingCreate.js

@@ -397,3 +397,84 @@ function registerEvent() {
             enterFps([pos[0], pos[1] + 2, pos[2]]);
         }
         checkBtnActives(['#mapBg', '#sceneSetting']);
+    });
+    // 进入层级事件,退出第一人称行走
+    app.on(THING.EventType.EnterLevel, function () {
+        if (fpsCtrl != null) {
+            exitFps();
+        }
+    });
+    // 离开层级事件,停止旋转
+    app.on(THING.EventType.LeaveLevel, function () {
+        stopRotate();
+    })
+    // 鼠标滑轮事件,停止旋转
+    app.on(THING.EventType.MouseWheel, function () {
+        stopRotate();
+    })
+    // 场景添加键盘按下事件,当进入第一人称行走时,按下esc键退出第一人称行走
+    app.on(THING.EventType.KeyDown, function (ev) {
+        if (ev.code == 'Escape') {
+            if (box != null) {
+                app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
+                app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
+                box.destroy();
+                box = null;
+                $('#moveByFps').removeClass('active');
+                restarRotate();
+            }
+            if (fpsCtrl != null) {
+                exitFps();
+                restarRotate();
+            }
+            checkBtnActives(['#mapBg', '#sceneSetting']);
+        }
+    });
+    window.onresize = function () {
+        if (!checkFull()) {
+            //要执行的动作
+            if (fullScreenState == true) {
+                $('.btn-full-screen').css('display', 'block');
+                $('.btn-narrow').css('display', 'none');
+                $('#fullScreen span').text('全屏');
+                fullScreenState = false;
+            }
+        }
+    }
+}
+
+
+//====设备闪烁提示====
+function flash(objArray) {
+    objArray.forEach(function (obj) {
+        obj.on('update', function () {
+            obj.style.color = '#FFF000'
+            obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
+        }, '每帧改变透明度');
+    })
+}
+function queryDeviceStatus(evt) {
+    objArray = evt.data;
+    // objArray.forEach(function (deviceobj) {
+    //     obj = app.query("#" + deviceobj.ownerCode)[0];
+    //     obj.on('update', function () {
+    //         obj.style.color = '#FF0000'
+    //         obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
+    //     }, '每帧改变透明度');
+
+
+    // })
+    obj = app.query("#" + objArray)[0];
+    obj.on('update', function () {
+        obj.style.color = '#FF0000'
+        obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
+    }, '每帧改变透明度');
+}
+function reset(objArray) {
+    objArray.forEach(function (obj) {
+        obj.style.opacity = 1.0;
+        obj.style.color = null;
+        obj.off('update', null, '每帧改变透明度');
+    })
+}
+var timer = null;