UNPKG

tedp

Version:

terra dp init

106 lines (85 loc) 2.58 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="./dist/tumap.js"></script> <style> * { margin: 0; padding: 0; } #mapContainer{ position:absolute; width:100%; height:100%; } .control-box{ position:absolute; right:10px; top:5px; background:rgba(0,0,0,.5); border:1px solid rgba(255,255,255,.8); border-radius: 6px; overflow: hidden; color:#fff; font-size:13px; padding: 5px; box-sizing: border-box; } .control-box>select{ height:25px; line-height:25px; width:80px; cursor: pointer; margin-right:10px; } </style> </head> <body> <!--地图容器--> <div id="mapContainer"></div> <div class="control-box"> <input type="button" class="control-button" value="播放" onclick="play()"> <input type="button" class="control-button" value="停止" onclick="stop()"> <input type="button" class="control-button" value="音量+" onclick="upVolume()"> <input type="button" class="control-button" value="音量-" onclick="downVolume()"> <input type="button" class="control-button" value="切换文件" onclick="changeFile()"> </div> <script type="text/javascript"> var map = TUMap.createMap({ //地图容器 id:"mapContainer", //UE4服务地址 必须设置 当前示例以地址栏地址 为服务地址 ,用户需要替换为自己的服务地址 url:window.parent.window.exampleServerUrl ,//"http://localhost:81/", onInit:function(){ play(); } }) ; //当前音量 var currentVolume = 0.5 ; //切换天气特效 function play(){ map.setAudioSwitch(true); } //切换天气特效 function stop(){ map.setAudioSwitch(false); } //调大音量 function upVolume(){ currentVolume = Math.min(currentVolume+0.1,1) ; map.setAudioVolume(currentVolume); } //调小音量 function downVolume(){ currentVolume = Math.max(currentVolume-0.1,0) ; map.setAudioVolume(currentVolume); } //移除效果 function changeFile(){ map.setAudioFile("test.mp3"); } </script> </body> </html>