Jelajahi Sumber

音频绑定

xzw 3 tahun lalu
induk
melakukan
8434f5bd9e

+ 2 - 1
SuperTwo762/css/main.css

@@ -2534,7 +2534,8 @@ body, html {
     white-space: nowrap;
     border-radius: 2px;
     cursor: default;
-    user-select: none
+    pointer-events:none;
+    user-select: none;
 }
 
 .gui-floorplan-label-text {

+ 96 - 62
SuperTwo762/js/main_2020_show.js

@@ -32,6 +32,60 @@ g_tourAudio.oncanplaythrough = function() {
 }
 
 
+
+
+var musicList = {
+    "0102cp":'3458d3c7ca764ecaa13c88aaa8e0a1a8, 1107bf848a6146059249cc109c6d1472, 8c0e5bcc4a69470aa5f189edde162973, 2d00ef76d93f4a578b356c593da889b0, 61afb8aaf45046be865b1b30d0357754, 0a73cf23993d4f4cbb48337708f8c7b7, 9a32f7d9b29f427182b453b1a8009efc, 58ea5816c49b4c759c26b262f403eab1, 6c455875e3834d53b43a2beaba11aa4d'.split(','),
+    "04CP":'48930ada7d02438a846f6f6cf5a8693f, d3e00453736549e392ca91e9bd31ee72, b99ae9d8d19144f7866d49ed863a4b84, 14f349b0dd3d4646b2bd98c2ebfeb643'.split(','),
+    "03cp":'d9b104d7df9244fca5ad5af4d5fca8f7, 2860b361da9246949ab6f57cbb8ce82d, 491d8cce5dfa441db5a52eb248bf4a63'.split(','),
+    "19CP":'73a354895dc74c30beeb02a8d8bfe328, 256aedca55d6417fb696156279424d42, 10210bebd78b4d33ad05e0bef22cf0a3'.split(','),
+    "2021cp":'10793e907fa7493c83f73fdcfd7df706, 2e2da10199634b5188c5469c0f52f9f6, 449196f2aa014f9db6a6cda675df7b70'.split(','),
+    "22cp":'cf2d9fa92e8443aabbcc1a01736a052e, 08967bbdacec4ecf8ff44b219408ac9a, 8d20c6dd62c04564a172430705ba0295, a8a7d94bb9b84e8cb45556bbd548961d'.split(','),
+    "23cp":'90197f7926e2466498135ef053147aaa, 6138d5511fe546e396a51408dfc9f6c5'.split(','),
+
+    "0506CP":'6cee9744a41942f384ca0a9130f65ae8, a1f9e4436ea24f99a360ac327979e555, 8d216c8512264564bcde41c544fdfc69, f8769828fe9f4dda8449cd5d9506eeb4, 12142ab7fbb74122ba0df52eaa5a5363, fb3b381371d04864ab99dfd30a08fe89, 0921140bde3f428180b2d6b603775f51'.split(','),
+    "07cp":'8902a763387040b2ad15a6325508cfca, 5adf5343a38340de998a0210cc97c00f'.split(','),
+    "08CP":'f9e6d48c697f455f9b294523a5222624, 4f912bc6dc2848ce924064d025635b81, 518612bb1c884d9bb7aff8d431904f8d'.split(','),
+    "09cp":'cb5887f7f3da43bf9ce383fbe4bae99b, d236fb56ac954bb29b3a6d0bdbe85588'.split(','),
+    "10cp":'dca81dee239e4f7e9d8b69c3af629f00, 69ef058f04474e3fbfd4cd22bb440934, 42fe939bbf7c42058f9c32356a08f319'.split(','),
+    "11cp":'fd62c35e2572460b88fb934e56888a2d, 4836763c382a45dcba1210f616e9e3be'.split(','),
+    "1213CP":'06fcab3ccc204198ba04bc226d6a049a, c72fe82506234db6bd75919ac0e61ec5, 884d594255f54a88b36f078ec2842669, 921eaf2a769c4f069e9588b0fa99f170, 02abef88316e482b9d4c4f3cb2a34c64'.split(','),
+    "15cp":'6e4c35329ba1470c8ebdf2ad3f1e92cd'.split(','),
+    "14cp":'0b168caa5f1848e1b614e97b3cc22923, a05cc1124331484c9d852f4918a3248d'.split(','),
+    "16cp":'506d2f805551425d938f488746730060, 21fbd2534bc840ebac3a5fac50e54cf5'.split(','),
+    "17cp":'d756e9288311440599eab62bde2e017e'.split(','),
+    "18cp":'11bb3c4c831a4151b8c7086f39086878'.split(','),
+     
+    
+    
+    
+}
+
+var playMusic = function(pano){
+    var shouldplayMusic
+    for(let i in musicList){
+        if(musicList[i].find(e=>e.includes(pano.id))){
+            shouldplayMusic = i;
+            break
+        }
+    }
+    if(shouldplayMusic){
+        if(!g_bgAudio.src.includes(shouldplayMusic)){
+            g_bgAudio.src = "music/"+shouldplayMusic+'.mp3'
+            manage.switchBgmState(true)
+        }
+    }else{
+        g_bgAudio.src = ''
+        
+    }
+    
+    
+}
+
+
+
+
+
 var dealMap = (map)=>{//使不resize  when   image is not power of two
     map.wrapS = map.wrapT = THREE.ClampToEdgeWrapping;
     map.minFilter = THREE.LinearFilter;
@@ -238,16 +292,7 @@ var videoPosInfo = {
 
         "9a32f7d9b29f427182b453b1a8009efc":[0.03080183370988987, -0.26776671083073333, 0.2265850992680396],
     "988a92b36f544326896b101b54a69290":[-0.034905996796551514, -0.26776671083073333, 0.3680810776239348],
-
-                                 
-            
-                                  
-                                                                     
-          
-                        
-     
-               
-  
+ 
     
     "a812006399af4c73b6b19941485597a2":[-0.06490599679655151, -0.26776671083073333, 0.3380810776239347],
     "9438aaa08cc94456a432ee3a7fa3378f":[-0.06490599679655151, -0.26776671083073333, 0.3380810776239347],
@@ -318,46 +363,9 @@ var loadVideo = ()=>{
     var btn = addSoundBtn(video)
     window.videoPlane.add(btn)
     video.btn = btn;  btn.video = video
-                                 
-                              
-                               
-               
-                                                                                      
-                                         
-                                                           
-                                 
-                              
-                               
                
-                               
-                                      
-    
     btn.position.set(-11.6,1.02,-8.5);
-    btn.rotation.y = -0.4
-    
-         
-    
-                       
-    
-                                      
-    
-                                           
-                                                                                            
-                                                               
-                                      
-    
-    
-                                            
-                                                          
-    
-                                             
-                            
-                                                              
-                                                             
-                                                                                                  
-                                                                                                
-                                      
-    
+    btn.rotation.y = -0.4 
     
 }
                                                   
@@ -18144,8 +18152,12 @@ window.Modernizr = function(n, e, t) {
             n.parseRoomIndexFromWorkshopRoomId = function(e) {
                 var t = -1;
                 if (e) {
-                    var i = e.split("_");
-                    t = parseInt(i[0])
+                    if(typeof e == 'number'){
+                        t = parseInt(e)
+                    }else{
+                        var i =  e.split("_");
+                        t = parseInt(i[0])
+                    }
                 }
                 return t
             }
@@ -18911,15 +18923,13 @@ window.Modernizr = function(n, e, t) {
                 this.labels = new x(this);
                 var e = $.Deferred();
                 //加载俯视图的标签  注释这个备注就会加载
-                /* window.MP_PREFETCHED_MODELDATA.model.player_options.labels ? this.showingLabels = true : '';
-                if (!this.showingLabels) */
-                    return e.resolve();
-                    
-                    
-                    
-               // var t = this.options.urlBase + "/api/v1/jsonstore/model/labels/" + this.sid;
+                //原先是labels, 改为showLabels,因为之前的somedata写的labels都是true
+                //window.MP_PREFETCHED_MODELDATA.showingLabels ? this.showingLabels = true : '';
+                /* if (!this.showingLabels)  
+                    return e.resolve();  */
+                // var t = this.options.urlBase + "/api/v1/jsonstore/model/labels/" + this.sid;
                 var t = g_Prefix + "data/" + this.sid + "/labels.json";
-                console.log(t);
+                 
                 return this.labels.load(t, !this.isPublic).done(e.resolve.bind(e)).fail(function() {
                     O.warn("Getting labels failed, not displaying labels."),
                     e.resolve()
@@ -19743,6 +19753,9 @@ window.Modernizr = function(n, e, t) {
                         newPano: this
                     }),
                     e = this
+                    
+                    
+                    playMusic(this)
                 }
             }(),
             n.prototype.exit = function() {
@@ -23035,7 +23048,7 @@ window.Modernizr = function(n, e, t) {
                         for(var i in this.model.hots){
                             this.model.hots[i].update(this.camera)
                         } 
-                        if(this.mode == 'panorama')this.overlayGroup.children.forEach(overlay=>{
+                        /* if(this.mode == 'panorama')this.overlayGroup.children.forEach(overlay=>{
                             if(overlay.overlayType == "video"){
                                 if(overlay.visible && overlay.inSight()){
                                     overlay.videoControl(true) 
@@ -23043,7 +23056,7 @@ window.Modernizr = function(n, e, t) {
                                     overlay.videoControl(false) 
                                 }
                             }
-                        })
+                        }) */
                         
                     }
                 
@@ -23379,7 +23392,17 @@ window.Modernizr = function(n, e, t) {
             
             n.prototype.clickOverlay = function(overlay){
                 if(this.openOverlay && !overlay)return;
+                
+                if(overlay == window.videoPlane){
+                    if(overlay.material.map.image.paused) playVideo(true)
+                    else playVideo(false)
+                    return  
+                }
+                
+                
+                
                 var plane = overlay.plane;
+                 
                 
                 if(overlay.overlayType == "video"){
                     if(plane.material.map.image.paused) plane.material.map.image.play()
@@ -23719,7 +23742,7 @@ window.Modernizr = function(n, e, t) {
                             .bind(this), a, C, 0, A[f.transition.movementEasing], null, V.LookTransition)
                         }
                     }
-                    if (i === this.currentPano )
+                    if (i === this.currentPano  || this.flying)
                         return void C();
                     this.flying = !0;
                     var L = this.position.clone()
@@ -23754,7 +23777,18 @@ window.Modernizr = function(n, e, t) {
                     }
                     .bind(this), I, null, 0, A[f.transition.movementEasing], null, V.LookTransition);
                     var B = c ? null : A[f.transition.movementEasing];
-                    this.nextPano = i,
+                    this.nextPano = i 
+                    
+                    
+                    //===========================
+                    updateVideo({type:"beforeFlytopano", pano:i, dur:I})//add        
+                    
+                    //===========================
+                    
+                    
+                    
+                    
+                    
                     y.start(v.uniform(this.model.skybox, "progress", 1), I, null, 0, A[f.transition.blendEasing], "skyFly", V.FlyToPano),
                     y.start(v.allUniforms(this.model.chunks, "progress", 1), I, null, 0, A[f.transition.blendEasing], "chunkFly", V.FlyToPano),
                     y.start(v.vector(this.cameraControls.cameras[u.PANORAMA].position, i.position), I, function(e) {

+ 1 - 1
SuperTwo762/js/manage.js

@@ -158,7 +158,7 @@ Manage.prototype.switchBgmState = function(state,fun){
     if(!g_bgAudio || !g_bgAudio.src) return;
     
     var played = function(){
-        console.log('begin play bgm');
+        console.log('begin play bgm '+ g_bgAudio.src);
         g_play = 1; 
         g_playAudio = g_bgAudio;
         $("#volume a img").attr("src", "./images/Volume btn_off.png")

+ 23 - 0
edit-backstage/edit_zh.html

@@ -103,6 +103,10 @@
                         <span class="panoVisible"></span>
                         <label>小地图</label>
                     </li>
+                    <li data-name="panoLog">
+                        <span class="panoVisible"></span>
+                        <label>漫游点位</label>
+                    </li>
                 </ul>
             </div>
             <div class="toolMid">
@@ -1599,6 +1603,25 @@
                         </li>
                     </ul>
                 </div>
+                <div class="panoLog content hide">
+                    <ul class="view-setting">
+                        <li>
+                            <!-- <div class="itemTitle"><span>漫游点位</span></div> -->
+                            <div class="remark">此面板会展示选中的漫游点id</div> 
+                            <textarea placeholder="请选择漫游点" id="panosIdShow" readonly="readonly" class="editText"></textarea>
+                            
+                             
+                        </li>
+                        <li>
+                        <div class="itemTitle"><span>点位标签颜色</span></div>
+                            <ul class="clearfix  colorWrap">
+                                <input id="panoIdColorTex" class="color-text" type="text"  />
+                                <input id="panoIdColor" type="color" />
+                            </ul>
+                        
+                        </li>
+                    </ul>
+                </div>
                 <div class="overlay content hide">
                     <ul>
                         <li class="addBtn">

+ 94 - 2
edit-backstage/js/edit.js

@@ -101,6 +101,9 @@ EditTools.prototype.active = function() {
         case "panoVisible":
             VisiSet.finishSetPanoVisible()
             break;
+        case "panoLog":
+            VisiSet.finishSetPanoLog()
+            break;    
         case "screen":
             confirmSnap.addClass("hide").removeClass("unable");
             snapshotGui.hide();
@@ -119,6 +122,11 @@ EditTools.prototype.active = function() {
             VisiSet.enterSet(VisiSet.beginSetPanoVisible.bind(VisiSet))
 
             break;
+        case "panoLog":
+            $(".toolLeft").addClass("unable")
+            VisiSet.enterSet(VisiSet.beginSetPanoLog.bind(VisiSet))
+
+            break;    
         case "screen":
             confirmSnap.removeClass("hide");
             $('#camera-start').text("点此设置为初始画面")
@@ -527,6 +535,16 @@ function initColorElem(data, elem) {
     if (data.showCad) {
         $('input[name="show-cad"]').trigger('change')
     }
+    $('#panoIdColor').on('change', function(e) {
+        $('#panoIdColorTex').val(e.target.value)
+        VisiSet.changePanoIdColor(e.target.value)
+    })
+    $('#panoIdColorTex').on('blur keydown', function(e) {
+        (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $('#panoIdColor'), this);
+        VisiSet.changePanoIdColor(e.target.value)
+    })
+    $('#panoIdColor').val('#c13e3e')//初始颜色
+    $('#panoIdColorTex').val('#c13e3e')
 }
 
 
@@ -3913,6 +3931,7 @@ var VisiSet = {
         green: "#00c8ae"
     },
     init: function() {
+        this.footIconSizeRatio =  Math.max(player.model.size.x, player.model.size.z)  / 30; 
         this.meshGroup = new THREE.Object3D;
         this.meshGroup.name = "setVisible-group"
         player.model.add(this.meshGroup)
@@ -4003,6 +4022,79 @@ var VisiSet = {
             enter()
 
     },
+    beginSetPanoLog: function() {
+        player.flying || $(".toolLeft").removeClass("unable")
+        if (this.setPanoLog)
+            return; 
+        this.setPanoLog = true
+        this.panosSelect = []
+        this.updateFootIconSize()
+        this.showFootIcons(null, true);
+        
+        for(let i in player.model.hots){
+            player.model.hots[i].visi_ = player.model.hots[i].mesh.visible;
+            player.model.hots[i].mesh.visible = false
+        } 
+        
+        
+        player.model.panos.forEach(e=>{
+            e.addTextSprite(e.id, $('#panoIdColorTex').val())
+        })
+    },
+    
+    finishSetPanoLog: function() {
+        //结束 退出这个设置
+        if (!this.setPanoLog)
+            return;
+        //否则会加多个侦听 
+        this.setPanoLog = false;
+
+        this.hideFootIcons();
+    
+        this.recoverAllState2(); 
+        this.panosSelect = null
+        player.flyoutType = null
+        
+        permitTranMode(true)
+        
+        
+        for(let i in player.model.hots){ 
+            player.model.hots[i].mesh.visible = player.model.hots[i].visi_
+        } 
+
+        $("#panosIdShow").val('')
+        
+        player.model.panos.forEach(e=>{
+            e.removeTextSprite()
+        })
+        
+        
+        
+    },
+    dealPanoLogClick: function(id) {
+        var panos = player.model.panos; 
+        
+        var index = this.panosSelect.indexOf(id)
+        if (index==-1) { 
+            this.changeFIconState(panos.index[id].footIcon, "linked" )
+            this.panosSelect.push(id)
+        }else{
+            this.changeFIconState(panos.index[id].footIcon,  false)
+            this.panosSelect.splice(index,1)
+        }
+        
+        
+        $("#panosIdShow").val(this.panosSelect.join(', '));         
+        
+    }
+    ,
+    changePanoIdColor:function(color){ 
+        player.model.panos.forEach(e=>{
+            e.removeTextSprite();
+            e.addTextSprite(e.id,color)
+        })  
+    }
+    ,
     beginSetPanoVisible: function() {
         player.flying || $(".toolLeft").removeClass("unable")
         if (this.setPanoVisible)
@@ -4602,8 +4694,8 @@ var VisiSet = {
         //根据相机位置 改变footIcon大小,使在范围内看到的热点大小一致,防止太小点击不到
         if (!this.footIcons)
             return;
-        var s = player.cameraControls.controls.floorplan.absoluteScale * 2.8;
-        s = THREE.Math.clamp(s, 0.5, 1.4);
+        var s = player.cameraControls.controls.floorplan.absoluteScale *  2.8
+        s = THREE.Math.clamp(s, 0.5 * this.footIconSizeRatio, 1.4 * this.footIconSizeRatio);
         this.footIcons.forEach(function(f) {
             try {
 

+ 15 - 7
edit-backstage/js/main_2020_edit.js

@@ -17176,8 +17176,12 @@ function o(a, s, l) {
             n.parseRoomIndexFromWorkshopRoomId = function(e) {
                 var t = -1;
                 if (e) {
-                    var i = e.split("_");
-                    t = parseInt(i[0])
+                    if(typeof e == 'number'){
+                        t = parseInt(e)
+                    }else{
+                        var i =  e.split("_");
+                        t = parseInt(i[0])
+                    }
                 }
                 return t
             }
@@ -21406,7 +21410,10 @@ function o(a, s, l) {
                         VisiSet.tagVsetting && this.intersect && this.intersect.object.visible && VisiSet.dealTagVisible(VisiSet.tagVsetting, this.intersect.object.name);
                         return;
                     }
-
+                    if (window.VisiSet && VisiSet.setPanoLog ) { 
+                        this.intersect && this.intersect.object.visible && VisiSet.dealPanoLogClick( this.intersect.object.name);
+                        return;
+                    }
                     
                     if(this.hoveringPlane){
                         this.clickOverlay(this.hoveringPlane)
@@ -21693,7 +21700,7 @@ function o(a, s, l) {
                     !this.mouseDown && this.containsMouse && this.updateIntersect()  
                     this.emit(W.ViewChanged)
                     //add:
-                    if (window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible)) VisiSet.updateFootIconSize();
+                    if (window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)) VisiSet.updateFootIconSize();
                     this.intersectHot && this.intersectHot.showTitle()
                     
                     editTool.hotpoint.showTitileSpots && editTool.hotpoint.showTitileSpots.forEach(e=>e.showTitle())
@@ -21855,7 +21862,7 @@ function o(a, s, l) {
                 e || t || this.isTouchEvent || i.length && i[0].running;
                 
                 
-                if (window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible)) {
+                if (window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)) {
                     this.intersect = this.getMouseIntersect(null, VisiSet.footIcons);
                     if (this.intersect && this.intersect.object.visible )
                         $("#player").css("cursor", "pointer");
@@ -22112,7 +22119,7 @@ function o(a, s, l) {
             }
             ,
             t.prototype.updateHotVisible = function(pano){  
-                if (window.VisiSet && (VisiSet.setPanoVisible ))return
+                if (window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setPanoLog))return
             
                 var hots = this.model.hots;
                 pano = pano || this.currentPano; 
@@ -22694,9 +22701,10 @@ function o(a, s, l) {
                 
                 
                 this.modeTran = this.mode + "-" + i;
-                if(this.mode == "floorplan" && window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible)){
+                if(this.mode == "floorplan" && window.VisiSet && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)){
                     VisiSet.finishSetPanoVisible()
                     VisiSet.finishSetTagVisible()
+                    VisiSet.finishSetPanoLog()
                 }
                 
                 if(editTool.atPanel == "screen"){