xzw 10 месяцев назад
Родитель
Сommit
41bcea22bc
1 измененных файлов с 156 добавлено и 16 удалено
  1. 156 16
      scene/public/static/js/main_2020_show.js

+ 156 - 16
scene/public/static/js/main_2020_show.js

@@ -4140,7 +4140,7 @@ window.Modernizr = function(n, e, t) {
                           , i = (e.touches[0].clientY - e.touches[1].clientY) / $("#player").height();
                         this.pinchDistance = Math.sqrt(t * t + i * i)
                     }
-                    SoundManager.pause('tour') // 周恩光 点击场景时停止语音
+                    //SoundManager.pause('tour') // 周恩光 点击场景时停止语音
                     this.emit(u.InputStart, "touch")
                 }
             }
@@ -4164,7 +4164,7 @@ window.Modernizr = function(n, e, t) {
                     case c.LEFT:
                         this.startRotationFrom(e.clientX, e.clientY)
                     }
-                    SoundManager.pause('tour') // 周恩光 点击场景时停止语音
+                    //SoundManager.pause('tour') // 周恩光 点击场景时停止语音
                     this.emit(u.InputStart, "mouse")
                 }
             }
@@ -4795,7 +4795,7 @@ window.Modernizr = function(n, e, t) {
                 //音频 
                 var musicInfo = this.model.heroLocations[this.destinationItem[0]].musicInfo
                 // zeg 手动导览不播放音频
-                if(musicInfo && musicInfo.music && !e){
+                /* if(musicInfo && musicInfo.music && !e){
 
                     let musicType = localStorage.getItem('xunirole') || 'male'
 
@@ -4818,13 +4818,9 @@ window.Modernizr = function(n, e, t) {
                     }else{//很可能是该folder的起始
                          
                         SoundManager.play('tour', manage.dealURL(src))
-                    }
-                    
-                     
-                              
-                                                                             
+                    }                                                          
                                               
-                }
+                } */
 
                 let oldPos = this.player.position.clone();
                 let oldPano = this.player.currentPano
@@ -5046,7 +5042,7 @@ window.Modernizr = function(n, e, t) {
 			} */
 			 
             n.prototype.stopTour = function(isAutoStop) {//停止导览        isAutoStop 希望仅在飞完结束自动停止时的stopTour不停止tourSound, 这样才能完整播放tourSound.  不过似乎会在倒数第二个片段点击按钮停止导览时也视作自动结束的(执行this.interrupt() )。
-                SoundManager.pause('tour',true), // zeg 自动导览暂停时同时停止语音
+                //SoundManager.pause('tour',true), // zeg 自动导览暂停时同时停止语音
                 this.isInterrupted() || this.transitionStage === y.Moving && this.checkAndHandleWalkingtourInterruption(this.nextWarpStyle) || (this.tourIsPlaying && (this.player.zoomEnabled = this.wasZoomEnabled),
                 this.tourIsPlaying = !1, 
                 this.interrupt(),
@@ -6625,7 +6621,7 @@ window.Modernizr = function(n, e, t) {
                     t.changeMode(Be)
                 }),
                 $("#gui-modes-floorplan").on("click", function(e) {
-                    SoundManager.pause('tour')
+                    //SoundManager.pause('tour')
                     l(e),
                     i.mode !== _e.FLOORPLAN && (J.track("showcase_gui", {
                         gui_action: "click_floorplan_mode_button"
@@ -6633,7 +6629,7 @@ window.Modernizr = function(n, e, t) {
                     t.changeMode(_e.FLOORPLAN));
                 }),
                 $("#gui-modes-dollhouse").on("click", function(e) {
-                    SoundManager.pause('tour')
+                    //SoundManager.pause('tour')
                     l(e),
                     i.mode !== _e.DOLLHOUSE && (J.track("showcase_gui", {
                         gui_action: "click_dollhouse_mode_button"
@@ -6641,7 +6637,7 @@ window.Modernizr = function(n, e, t) {
                     t.changeMode(_e.DOLLHOUSE));
                 })
                 $("#gui-modes-inside").on("click", function() {
-                    SoundManager.pause('tour')
+                    //SoundManager.pause('tour')
                 })
             }
             function v(e, t) {
@@ -21961,7 +21957,7 @@ window.Modernizr = function(n, e, t) {
                 this.bindEvents(e.container),
                 this.updateModel()
                  
-                this.guider2 = new PanTransGuide(this)
+                //this.guider2 = new PanTransGuide(this)
                 
             }
 			 
@@ -59141,7 +59137,7 @@ window.Modernizr = function(n, e, t) {
 }, {}, [116]);
 
 
-class PanTransGuide{    
+/* class PanTransGuide{    
     constructor(player){
         this.player = player
         this.currentIndex = 0
@@ -59258,7 +59254,151 @@ class PanTransGuide{
         this.currentIndex %= this.nodes.length
         return this.currentIndex
     }
-    
+     
   
+}*/
+
+
+class PanTransGuide{    
+    constructor(player){
+        this.player = player
+        this.currentIndex = 0
+        this.getNodes()
+        
+       
+    }
+    getNodes(){
+        this.nodes = []
+        let path = this.player.path
+        let last
+        
+        let index = this.player.model.heroLocations.findIndex(e=>e.name == '沉浸看展')
+        let locations = this.player.model.heroLocations[index].heroLocations
+        this.player.model.heroLocations.splice(index,1)
+        
+        locations.forEach((e,i)=>{
+            if(e.cameraMode != 'panorama')return
+          
+            if(i>0){   
+                path.setWarpDestination(e)
+                path.setWarpDestPano()
+                let A = path.getHeroPano(last), 
+                    B = path.warpDestPano
+                if(e.momentTour == 'black' && A!=B){
+                    path.nodes = [A.id,B.id];//直接加入
+                }else{ 
+                    path.nodes = path.findShortestPath(A, B)
+                    if(path.nodes == null){//两个点之间不相通
+                        console.log('两个点之间不相通',A.id,B.id)
+                        path.nodes = [A.id,B.id];//直接加入
+                    }
+                }
+                
+                
+                
+                let wholeDis = 0, disSections = []
+                path.nodes.forEach((cur,i)=>{
+                    if(i==0)return
+                    let prePano = this.player.model.panos.get(path.nodes[i-1])
+                    let curPano = this.player.model.panos.get(cur)
+                    let dis = prePano.position.distanceTo(curPano.position)
+                    disSections.push(dis)
+                    wholeDis += dis
+                },0)
+                
+                let quaStart = last.quaternion
+                let quaEnd = e.quaternion
+                
+                path.nodes.forEach((panoId,j)=>{ 
+                    if(j == 0){
+                        if(path.nodes.length == 1)return this.nodes.push({panoId,quaternion:quaEnd})//原地旋转
+                        if(i > 0)return //和上一段末尾重复
+                        return this.nodes.push({panoId,quaternion:quaStart})
+                    }
+                    let r = disSections[j-1] / wholeDis
+                    let quaternion = quaStart.clone()
+                    lerp.quaternion(quaternion, quaEnd)(r) 
+                    this.nodes.push({panoId, quaternion})
+                })
+            }
+            
+            last = e
+        })
+          
+        //path.setWarpDestinationByHeroIndex()
+        
+         
+    }
+    
+    go(axis){
+        if(this.player.flying)return
+        let aimNode
+        let cur = this.nodes[this.currentIndex]
+        if(cur.panoId != this.player.currentPano.id){//已走动
+            let curs = this.nodes.filter(e=>e.panoId == this.player.currentPano)   
+            curs.sort((a,b)=>{      //如果有多个,找到和currentIndex最接近的,可能是刚走过的
+                let indexA = this.nodes.indexOf(a)
+                let indexB = this.nodes.indexOf(b)
+                return Math.abs(indexA - this.currentIndex) < Math.abs(indexB - this.currentIndex)
+            })
+            cur = curs[0]
+            if(!cur){//不在道上 . 找离当前位置最近的node
+                let disMap = new Map
+                this.nodes.forEach(e=>{
+                    disMap.set(e,player.currentPano.position.distanceToSquared(this.player.model.panos.get(e.panoId).position))
+                })
+                let sorted = this.nodes.slice().sort((a,b)=>{     
+                    return disMap.get(a) - disMap.get(b)
+                })
+              
+                this.currentIndex = this.nodes.indexOf(sorted[0])//next
+                if(axis == 'prev'){
+                    this.moveIndex(-1) 
+                }
+                aimNode = this.nodes[this.currentIndex]
+            }
+        }
+        let lastIndex = this.currentIndex
+        if(!aimNode){
+            this.moveIndex(axis == 'prev' ? -1 : 1)
+            aimNode = this.nodes[this.currentIndex]
+        }
+        
+        //let dis = this.player.model.panos.get(aimNode.panoId).position.distanceTo(this.player.position)
+        let moveStyle = (lastIndex == 0 && axis == 'prev' || this.currentIndex == 0 && axis != 'prev') ? "blackToPano" : "flyToPano" 
+        this.player[moveStyle]({pano: this.player.model.panos.get(aimNode.panoId),quaternion:aimNode.quaternion})
+       
+    }
+    
+     
+    moveIndex(step){
+        this.currentIndex += (step + this.nodes.length)
+        this.currentIndex %= this.nodes.length
+        return this.currentIndex
+    }
 }
+
+
+
+//2025新的需求  沉浸看展直接使用导览
+
+window.tourPlayCtl = {
+    go(axis){
+        if(axis == 1){
+            player.director.goNext()
+        }else{
+            player.director.goPrev()
+        }
+        
+        
+    },
+     
+}
+
+
+
+
+
+
+