xzw 4 yıl önce
ebeveyn
işleme
df19e2084f
2 değiştirilmiş dosya ile 189 ekleme ve 10 silme
  1. 77 10
      public/SuperTwo/js/main_2020_show.js
  2. 112 0
      public/SuperTwo/js/manage.js

+ 77 - 10
public/SuperTwo/js/main_2020_show.js

@@ -1,6 +1,18 @@
 
  window.position = getQueryVariable("position");
  console.log(window.position)
+ 
+var getTransformSid = function(){
+    var name
+    if(player.mode == 'panorama'){
+        name = player.currentPano ? player.currentPano.id : 'outside'
+    }else{
+        name = 'outside'
+    }
+    return name
+} 
+ 
+ 
  var list = {
      "0":{
          
@@ -15782,7 +15794,7 @@ window.Modernizr = function(n, e, t) {
             }else{
                 u.texture1.value = defaultTex1;
                 u.texture2.value = defaultTex2;
-                console.log(this.sid)
+                 
             }  
         }
         
@@ -18049,6 +18061,7 @@ window.Modernizr = function(n, e, t) {
                 overlays && overlays.forEach((info)=>{ 
                     new Overlay(info)  
                 })
+                Overlay.load()
             }
             
                 
@@ -22360,7 +22373,7 @@ window.Modernizr = function(n, e, t) {
                 //add
                 this.transitionPos({type:"beforeFlytopano", pano:this.currentPano, dur:0})
                 this.updateHotVisible()
-                
+                Overlay.updateVisibles([this.currentPano])
                 
                 return this.mode = u.PANORAMA,
                 e.floor.enter(this.mode),
@@ -23237,7 +23250,7 @@ window.Modernizr = function(n, e, t) {
                      //---------before fly--------------- add
                     this.updateHotVisible(i); //更新热点显示
                     this.transitionPos({type:"beforeFlytopano", pano:i, dur:I})//add 
-                    
+                    Overlay.updateVisibles([this.currentPano, i])
                     
                     //地标变化
                     if(this.model.floorLogos){
@@ -23276,12 +23289,18 @@ window.Modernizr = function(n, e, t) {
                         C(e)
                         
                          //add:
-                        if(this.mode == "panorama" && this.model.floorLogos){
-                            this.model.floorLogos[0].position.copy(this.model.floorLogos[1].position)
-                            //this.model.adjustfloorLogoHeight()
-                            this.model.changefloorLogoOpa({index:0,opa:1,dur:0});//this.model.floorLogos[0].material.uniforms.opacity.value = 1;
-                            this.model.floorLogos[1].visible = false;
+                        if(this.mode == "panorama" ){
+                            if(this.model.floorLogos){
+                                this.model.floorLogos[0].position.copy(this.model.floorLogos[1].position)
+                                //this.model.adjustfloorLogoHeight()
+                                this.model.changefloorLogoOpa({index:0,opa:1,dur:0});//this.model.floorLogos[0].material.uniforms.opacity.value = 1;
+                                this.model.floorLogos[1].visible = false;
+                            }
+                            
+                             
+                            Overlay.updateVisibles([this.currentPano])//add
                         }
+                        
                     }
                     .bind(this), 0, B, "camFly", V.FlyToPano)
                 }
@@ -23759,6 +23778,17 @@ window.Modernizr = function(n, e, t) {
                         this.model.floorLogos[0].visible = true
                     )
                     
+                    if(this.mode == u.PANORAMA){ 
+                        Overlay.updateVisibles([this.currentPano])
+                    }else{ 
+                        Overlay.updateVisibles(true)
+                        this.overlayGroup.children.forEach(overlay=>{
+                            if(overlay.animateInfo){ 
+                                GifTexDeal.start(overlay.animation)
+                            }
+                        })
+                    }
+                    
                     
                     h && p !== u.PANORAMA && i === u.PANORAMA ? this.startWarp(b.Retain, E.Retain, x.BLACK, null, null, s) : (s && s(),
                     t.resolve())
@@ -30740,11 +30770,47 @@ window.Modernizr = function(n, e, t) {
             extend: function(e, t) {
                 for (var i in t.prototype)
                     e.prototype[i] = t.prototype[i]
-            }
+            },
+            
+            getVisiblePano : function(position, options={}){//add
+                var visiblePanos = []; 
+                var B = position.clone(); 
+                var panos = options.panos ||  player.model.panos.list;
+                 
+                panos.forEach((pano)=>{
+                    if(!pano.isAligned())return;
+                    var A = pano.position.clone();
+                      
+                    var ray = new THREE.Raycaster(A.clone(), B.clone().sub(A).normalize(), 0, A.distanceTo(B) - (options.tolerance||0) ) 
+                    var o = ray.intersectObjects(options.model || player.model.colliders, true);
+                     
+                     
+                    if (!o || !o.length)visiblePanos.push(pano );
+                     
+                    
+                })  	  
+             
+                return visiblePanos
+            } 
+            ,
+            sortByScore : function(list, request, rank) {
+                var i = this.filterAll(list, request);
+                return 0 === i.length ? null : i = i.map(function(e) {
+                    return {
+                        item: e,
+                        score: rank.reduce(function(t, i) {
+                            return t + i(e);
+                        }, 0)
+                    };
+                }).sort(function(e, t) {
+                    return t.score - e.score;
+                });
+            } 
         },
         Math.sign = function(e) {
             return e < 0 ? -1 : 1
         }
+        window.common = t.exports
     }
     , {
         three: 217
@@ -31238,6 +31304,7 @@ window.Modernizr = function(n, e, t) {
          
             
         }
+        window.math = t.exports
     }
     , {
         "../constants": 8,
@@ -31532,7 +31599,7 @@ window.Modernizr = function(n, e, t) {
     195: [function(e, t, i) {
         "use strict";
         var n = e("./easing");
-        t.exports = {
+        window.transitions = t.exports = {
             globalDone: null,
             funcs: [],
             counter: 0,

+ 112 - 0
public/SuperTwo/js/manage.js

@@ -416,6 +416,118 @@ function hotMatcher(data){
     return data;
 }
 
+var GifTexDeal = {
+    
+    animateObjects : [], 
+     
+    addAnimation : function(texture, owner, info, id){
+        var object = {
+            texture,
+            owner,
+            info,
+            id 
+        }
+        this.setRepeart(object)
+        this.animateObjects.push(object)
+        return object
+    },
+    remove : function(object){
+        var index = this.animateObjects.indexOf(object) 
+        if(index>-1){
+            this.stop(object)
+            object.texture.repeat.set(1,1) 
+            this.animateObjects.splice(index, 1)
+        }
+    },
+    setRepeart : function(object){
+        object.texture.repeat.set(1/object.info.cellXcount, 1/object.info.cellYcount)
+    },
+    start: function(object){ 
+        /* var b = this
+          , offset = this.cursor.material.map.offset
+          , f = function(a) {
+            return Math.floor(17 * a) / 17   //对应17个精灵图片段
+        };
+        b.canStartAnimation = !1,
+        this.cursorAnimate = new TWEEN.Tween(offset).to({
+            x: 1    //100%
+        }, 1e3).onStart(function() {
+            b.canStartAnimation = !1
+        }).onStop(function() {
+            b.canStartAnimation = !0,
+            this.x = 0,
+            offset.x = 0
+        }).onUpdate(function() {}).onComplete(function() {
+            done(),
+            offset.x = 0,
+            setTimeout(function() {
+                b.canStartAnimation = !0
+            }, 1500)
+        }),
+        this.cursorAnimate.easing(f),
+        this.cursorAnimate.start()
+ */ 
+          
+        if(!object || object.started)return;
+        var count = object.info.cellXcount * object.info.cellYcount
+        
+        if(count == 1 )return;
+        
+        transitions.start( (progress)=>{
+            var index = Math.floor(count * progress);
+            var indexX =  index % object.info.cellXcount
+            var indexY =  object.info.cellYcount - Math.floor(index / object.info.cellXcount ) - 1;  //uv.offset.y是从下到上的
+            object.texture.offset.x = indexX / object.info.cellXcount;
+            object.texture.offset.y = indexY / object.info.cellYcount;
+            
+            //console.log(object.id + " : "+ object.texture.offset.toArray())
+        } , object.info.duration, ()=>{//done
+            object.started = false
+            object.texture.offset.x = 0;
+            object.texture.offset.y = 0;
+            this.start(object)
+        }, 0 ,null, object.id, "gif_"+object.id); 
+
+        object.started = true
+
+    },
+    
+    startAnimations : function(o={}){
+        this.animateObjects.forEach(e=>{this.start(e)})
+
+    }
+    ,
+    stop: function(object){ 
+        if(!object || !object.started)return;
+        transitions.cancelById("gif_"+object.id);
+        object.texture.offset.set(0,0)    
+        object.started = false
+    }
+}
+
+var CloneObject = function(copyObj, result, isSimpleCopy) {
+    //isSimpleCopy只复制最外层
+    //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
+    if(!copyObj)return null
+    result = result || {};
+    if (copyObj instanceof Array) {
+        if (copyObj[0]instanceof Object) {
+            //不支持含有 [[Object]] 这样二级数组里面还是复杂数据的,普通和复杂的数据混合可能也不支持
+            console.error("不支持含有 [[Object]] 这样二级数组里面还是复杂数据的...")
+        }
+        return copyObj.slice(0);
+        //如果是数组,直接复制返回(排除数组内是object
+    }
+    for (var key in copyObj) {
+        if (copyObj[key]instanceof Object && !isSimpleCopy)
+            result[key] = CloneObject(copyObj[key]);
+        else
+            result[key] = copyObj[key];
+        //如果是函数类同基本数据,即复制引用
+    }
+    return result;
+}
+;