Browse Source

tourInterlude

xzw 1 year ago
parent
commit
3db8a4019f
1 changed files with 41 additions and 1 deletions
  1. 41 1
      scene/public/static/js/main_2020_show.js

+ 41 - 1
scene/public/static/js/main_2020_show.js

@@ -24060,7 +24060,7 @@ window.Modernizr = function(n, e, t) {
                 this.path.setWarpDestinationByHeroIndex(e) && this.path.brushToWarpPano(x.STD, x.BLACK)
             }
             ,
-            n.prototype.tourInterlude = function(e, t) {
+            /* n.prototype.tourInterlude = function(e, t) {
                 this.history.invalidate();
                 this.path.discardSlow();
 				//xzw:  
@@ -24093,6 +24093,46 @@ window.Modernizr = function(n, e, t) {
                 this.path.waitNextStep(e, function() {
                     t && t()
                 }.bind(this), rotTime)
+            } */
+            
+            n.prototype.tourInterlude = function(e, t) {
+                this.history.invalidate();
+                this.path.discardSlow();
+				//xzw:  
+                var defaultRotTime = DATA.tourRotTime * 1000
+                var timeEachItem = 2e3 / (DATA.tourWalkSpeed + DATA.tourBlackSpeed) * 200 //预估时间假设每个item飞的时间(如果距离远就少了)
+                 
+             
+                var currentLocation = this.model.getHeroDescriptorByIndex(this.director.currentItem)
+                var currentLocation0 = this.model.heroLocations[this.director.currentItem[0]] 
+                //zeg 标注一下
+                //var currentLocation = this.model.heroLocations[this.director.currentItem[0]] 
+                
+                var rotTime
+                if(currentLocation.rotTime == void 0 || currentLocation.rotTime == ''){
+                    var restChildCount = currentLocation0.heroLocations ? (currentLocation0.heroLocations.length-this.director.currentItem[1]-1) : 0
+                    var hasMusic = currentLocation0 && currentLocation0.musicInfo.music
+                    if(hasMusic){
+                        var audioObj = SoundManager.list.find(e=>e.name == 'tour') 
+                        var current = audioObj.audio.currentTime * 1e3 // || 0  //g_tourAudio ? 1e3 * g_tourAudio.currentTime : 0
+                        rotTime = currentLocation0.musicInfo.time - current
+                        if(restChildCount){//如果当前folder中还有剩下的item,平分一下时间
+                            rotTime = (rotTime-timeEachItem*restChildCount) / (restChildCount+1);   
+                        }  
+                    }else{
+                        rotTime = defaultRotTime
+                    } 
+                    rotTime = Math.max(0, rotTime)
+                    Log("rotTime "+rotTime +" at item "+this.director.currentItem + (hasMusic ? (",musicCurrentTime:"+current+'音乐总长:'+currentLocation0.musicInfo.time) : ''),"#E8E") 
+                }else{
+                    rotTime = currentLocation.rotTime * 1000
+                    Log("rotTime "+rotTime +" at item "+this.director.currentItem,"#E8E") 
+                }
+                 
+
+                this.path.waitNextStep(e, function() {
+                    t && t()
+                }.bind(this), rotTime)
             }
             ,
             n.prototype.stopInterlude = function() {