Переглянути джерело

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/lyys

tremble 3 роки тому
батько
коміт
515b55c89e

+ 3 - 1
public/SuperTwo/index.html

@@ -806,11 +806,13 @@
     <script src="js/myShow.js"></script>
     <script src="js/SpecialScene.js"></script>
     <script src="js/manage.js"></script>
-    <script src="js/overlay.js"></script>
+    <script src="js/Hot.js"></script>  
     <script src="js/main_2020_show.js"></script>
+    <script src="js/lib/OBJLoader.js"></script>
     <!-- <script src="/CAD/bundle.js"></script>
 
     <script src="js/loadCAD.js"></script> -->
+    
     <script>
         
     </script>

Різницю між файлами не показано, бо вона завелика
+ 1611 - 0
public/SuperTwo/js/Hot.js


Різницю між файлами не показано, бо вона завелика
+ 1370 - 0
public/SuperTwo/js/lib/OBJLoader.js


Різницю між файлами не показано, бо вона завелика
+ 1365 - 618
public/SuperTwo/js/main_2020_show.js


+ 237 - 88
public/SuperTwo/js/manage.js

@@ -116,7 +116,9 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \  g_playAudio
     var play = function(){
         //if(window.tourAudioSta) return;
          
-        this.switchBgmState(true)
+        if(this.bgmShouldPlay){
+            this.switchBgmState(true)
+        }
         
         document.removeEventListener("touchstart",play);
         document.removeEventListener("click",play);
@@ -156,6 +158,7 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \  g_playAudio
 }   
 Manage.prototype.switchBgmState = function(state){
     if(!g_bgAudio || !g_bgAudio.src) return;
+    this.bgmShouldPlay = state
     
     var played = function(){
         console.log('begin play bgm');
@@ -203,10 +206,9 @@ Manage.prototype.weixinShare = function() {
     $.ajax({    
         url: 'https://www.4dage.com/wechat/jssdk/share/',
         type: "post",
-        data: {
-            'uri': location.href.split('#')[0],   //当前页面地址
-            'name': "四维5号"             //哪个公众号,对应上方的名称
-          }, 
+        data : {
+            'url' : location.href.split('#')[0]
+        }, 
         dataType:"jsonp",     
         jsonpCallback:"success_jsonp",         
         success:function(data,textStatus){
@@ -323,16 +325,17 @@ Manage.prototype.dealURL = function(src, type){
     
    
     if(window.isLocal && settings.localPrefix!=void 0){//本地将线上的前缀替换
-        var oldPrefixs = ["https://super.4dage.com/", "http://super.4dage.com/", "///super.4dage.com/"]
-        for(let i=0;i<oldPrefixs.length;i++){
-            if(src.includes(oldPrefixs[i])){
-                return src.replace(oldPrefixs[i], settings.localPrefix)
-                break;
-            }
+        var oldPrefix = 'super.4dage.com/';  //最简单的地址写一个,如果有其他完全不一样的地址就用数组逐个判断
+        var index = src.indexOf(oldPrefix);
+        if(index>-1){
+            var wholeOldPrefix = src.slice(0, index+oldPrefix.length);
+            return src.replace(wholeOldPrefix, settings.localPrefix)
         }
-        console.error("没有找到合适的本地链接")
+        
+        console.error("没有找到合适的本地链接") 
         return src
     }else{
+        //add https://
         var prefix = g_Prefix.replace('https://','').replace('http://','') 
         if(!src.includes('http:/') && !src.includes('https:/') && src.includes(prefix)){
             src = 'https://'+src
@@ -344,6 +347,61 @@ Manage.prototype.dealURL = function(src, type){
 }
 
 
+Manage.prototype.removeSrcPostMark = function(url){//去除texture.load时自动加上的'?'
+    var index = url.indexOf('?')
+    if(index>-1){
+        return url.slice(0, index)
+    }else return url 
+}
+
+
+Manage.prototype.showInfo = function (o) { // ({result:true, title:"发布成功"}); 
+	 
+	var box = $(".resultBox");
+	
+	var title = o.title || o || i18n.get('保存成功');
+	box.children().eq(0).html(title) 
+	
+	
+	//var time = o.time || THREE.Math.clamp((Config.lang=='en') ? title.length*50 : title.length*130 ,1300,5000);
+	var time = o.time ||  THREE.Math.clamp(title.length*130 ,1300,  5000);
+    o.time || console.log("showtime  " + time)
+	
+	//实际有一半的时间在渐变透明度
+	this.showInfoTimer && clearTimeout(this.showInfoTimer) 
+	box.removeClass("animate");//如果之后不久又要showinfo一个的话,先停止前面的animate
+	setTimeout(function () {
+		box.css(
+			{
+				'-webkit-animation-duration': time + 'ms',
+				'animation-duration': time + 'ms'
+			}
+		)
+        if(o.top){
+            box.children().css('top', o.top + "%");
+        }else{
+            box.children().css('top', '' )
+        }
+		box.removeClass("hide");
+		box.addClass("animate");
+		if (o.dontInteract) {//遮挡对屏幕的操作
+			box.css('pointer-events', 'auto')
+		} else {
+			box.css('pointer-events', 'none')
+		}
+		 
+
+		this.showInfoTimer = setTimeout(function () {
+			box.removeClass("animate");
+			box.addClass("hide");
+			this.showInfoTimer = null; 
+		}.bind(this), time + 20)
+
+	}.bind(this), 50)//这个数字太小的话后面触发的没有重新animate的效果 应该要比帧率大吧
+
+
+}//like:  manage.showInfo({title:'a', top:20})
+
 
 
 var manage = new Manage();
@@ -371,7 +429,7 @@ function showLogo(){
 //czj 添加随机的时间
 function randomTime(){
     return new Date()
-}
+};
 function matcher(data){
     if(!data || !g_version ) return data;
     delete data.model.vision_version;
@@ -410,116 +468,135 @@ function matcher(data){
     return data;
 }
 
-function hotMatcher(data){
-    if(!data || !g_version) return data;
-    data.tourAudio = data.audio;
+function hotMatcher(data={}){
+    //if(!data || !g_version) return data; 
+    if(g_version) {
+        data.tourAudio = data.audio || {};
+    }else{
+        data.tourAudio = {}
+    }
     return data;
 }
 
+
 var GifTexDeal = {
     
     animateObjects : [], 
-     
+    animateTexs : [] ,
     addAnimation : function(texture, owner, info, id){
+        /* if(this.animateObjects.find(e=> 
+            e.texture == texture && !ifSame(info, e.info) 
+        )) */ 
+        
+        var animation
+        var tex = this.animateTexs.find(e=>e.texture == texture)
+        if(tex){
+            animation = tex
+        }else{
+            animation = {texture,info }
+            this.animateTexs.push(animation)
+            this.setRepeart(animation)
+        }
+        
         var object = {
-            texture,
-            owner,
-            info,
-            id 
+            animation, //默认相同的texture对应的info是一样的, 对应一个animation
+            owner,        
         }
-        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)
+            
+            if(!this.animateObjects.find(e=>e.animation == object.animation)){
+                let i = this.animateTexs.indexOf(object.animation)
+                this.animateTexs.splice(i, 1)
+                object.animation.texture.repeat.set(1,1) 
+            }
+            
+            this.stop(object) 
+            
         }
     },
-    setRepeart : function(object){
-        object.texture.repeat.set(1/object.info.cellXcount, 1/object.info.cellYcount)
+    setRepeart : function(animation){
+        animation.texture.repeat.set(1/animation.info.cellXcount, 1/animation.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(!object || object.started )return;
+        object.started = true
+        if(object.animation.started)return;
+        object.animation.started = true
         
-        if(count == 1 )return;
+        var info = object.animation.info
+        var count = info.cellXcount * info.cellYcount - (info.voidCount || 0)
+     
+        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;
+            var indexX =  index % info.cellXcount
+            var indexY =  info.cellYcount - Math.floor(index /info.cellXcount ) - 1;  //uv.offset.y是从下到上的
+            object.animation.texture.offset.x = indexX / info.cellXcount;
+            object.animation.texture.offset.y = indexY / info.cellYcount;
             
             //console.log(object.id + " : "+ object.texture.offset.toArray())
-        } , object.info.duration, ()=>{//done
+        } , info.duration * (-1), null,/* ()=>{//done  (-1):循环
             object.started = false
             object.texture.offset.x = 0;
             object.texture.offset.y = 0;
             this.start(object)
-        }, 0 ,null, object.id, "gif_"+object.id); 
+        }, */ 0 ,null, object.id, "gif_"+object.animation.texture.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
+        //只有该object对应的texture对应的所有object都停止了,才能真的停止动画:
+        if(this.animateObjects.find(e=>e.animation == object.animation && e.started)) return;
+        
+         
+        transitions.cancelById("gif_"+object.animation.texture.id);
+        object.animation.texture.offset.set(0,0)
+        object.animation.started = false     
+        
     }
 }
 
-var CloneObject = function(copyObj, result, isSimpleCopy) {
+var CloneObject = function(copyObj, result, isSimpleCopy, extraReplace) {
     //isSimpleCopy只复制最外层
     //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
-    if(!copyObj)return null
+    if(!copyObj)return copyObj //0 null undefined ''
     result = result || {};
     if (copyObj instanceof Array) {
-        if (copyObj[0]instanceof Object) {
+        /*  if (copyObj[0]instanceof Object) {
             //不支持含有 [[Object]] 这样二级数组里面还是复杂数据的,普通和复杂的数据混合可能也不支持
             console.error("不支持含有 [[Object]] 这样二级数组里面还是复杂数据的...")
+        }  
+        
+        return copyObj.slice(0);*/ //如果是数组,直接复制返回(排除数组内是object 
+        return copyObj.map(e=>{
+            if(e instanceof Object){
+                return CloneObject(e)
+            }else return e 
+        })
+       
+    }else{
+        if(copyObj.clone instanceof Function ){ //解决一部分
+            return copyObj.clone()
         }
-        return copyObj.slice(0);
-        //如果是数组,直接复制返回(排除数组内是object
     }
     for (var key in copyObj) {
-        if (copyObj[key]instanceof Object && !isSimpleCopy)
+        if (copyObj[key] instanceof Object && !isSimpleCopy)
             result[key] = CloneObject(copyObj[key]);
         else
             result[key] = copyObj[key];
@@ -528,23 +605,95 @@ var CloneObject = function(copyObj, result, isSimpleCopy) {
     return result;
 }
 ;
-
-$('.bch').click(()=>{
-    window.parent.postMessage({
-            source: "backhome",
-            data: true,
-    },'*')
-})
-
-window.addEventListener('message',(res)=>{
-if (Object.prototype.toString.call(res.data) == "[object Object]") {
-    if (res.data.source === "palytour") {
-        window.startAndPlay()
-    }
+var ifSame = function(object1, object2){
+    if(object1 == object2  )return true // 0 != undefined  , 0 == ''
+    else if(!object1 || !object2) return false
+    else if(object1.constructor != object2.constructor){
+        return false
+    }else if(object1 instanceof Array ) {
+        if(object1.length != object2.length)return false;
+        var _object2 = object2.slice(0);
+        
+        for(let i=0;i<object1.length;i++){ 
+            var u = _object2.find(e=>ifSame(object1[i], e));
+            if(u == void 0 && !_object2.includes(u) && !object1.includes(u))return false;
+            else{
+                let index = _object2.indexOf(u);
+                _object2.splice(index,1);
+            }
+        }
+        
+        return true
+    }else if(object1.equals instanceof Function ){//复杂数据仅支持这种,其他的可能卡住?
+        
+        return object1.equals(object2)
+          
+    }else if(typeof object1 == 'number' ||  typeof object1 == 'string'){
+        if(isNaN(object1) && isNaN(object2))return true
+        else return object1 == object2
+        
+    }else if(typeof object1 == "object"){
+        var keys1 = Object.keys(object1)
+        var keys2 = Object.keys(object2)
+        if(!ifSame(keys1,keys2))return false;
+        
+        for(let i in object1){
+            var same = ifSame(object1[i], object2[i]);
+            if(!same)return false
+        }
+        return true
+    }else{
+        console.log('isSame出现例外')
     }
-})
+    
+    
+    
+    
+    
+}
+
+
 
 
+var SoundPriority = {//暂不支持同时播放
+    currentPlay:null,//当前正在播放list中的哪一个
+    list:[
+        {
+            name:"bg", 
+            level : 0,//越大优先级越高
+            canBeInterrupted : true ,
+            
+        },
+        {
+            name:"boxVideo", 
+            level : 1, 
+            canBeInterrupted : true,
+            checkIfNeedPlay:function(){
+                
+                
+            }
+        },
+        {
+            name:"hot", 
+            level : 2, 
+            canBeInterrupted : true
+        },
+        {
+            name:"tour", 
+            level : 3, 
+            canBeInterrupted : true
+        },
+        
+        
+    ],
+    register:function(){
+        
+        
+        
+    }
+    
+    
+}
 
 //兼容一代的場景
 //請求地址統一管理

+ 18 - 3
public/SuperTwo/js/myShow.js

@@ -60,9 +60,24 @@ var g_weixinObj = {
 }
 
 var settings = {
-    overlay:{
-		width:1, height:0.5, depth:0.02
-	}  
+    hotClickEvent:{
+        video:{
+            playAndPause:true,
+            examine:false,
+            openHot:false 
+        },
+        photo:{
+            examine:false,
+            openHot:false 
+        },
+        shine:{
+            examine:true,
+            openHot:true  
+        }
+    },
+    //dontExamHot:true  
+    transparentBg: false,
+    bgImg:  null 
 }
 if(window.number == '725'||window.number == '724'){
     settings.mobileNavHigh = true