音量控制
This commit is contained in:
parent
66e278394b
commit
9e017f9ec1
|
@ -172,6 +172,7 @@ window.config={
|
|||
only_fullskin_config:'隐藏非全身皮肤',
|
||||
hide_card_image_config:'隐藏卡牌背景图',
|
||||
show_auto_config:'显示托管按钮',
|
||||
show_volumn_config:'显示音量按钮',
|
||||
show_name_config:'显示角色名称',
|
||||
ui_zoom_config:'界面缩放',
|
||||
show_stat_config:'显示战斗统计',
|
||||
|
@ -207,6 +208,8 @@ window.config={
|
|||
duration:500,
|
||||
hoveration:1000,
|
||||
cheat:false,
|
||||
volumn_background:8,
|
||||
volumn_audio:8,
|
||||
|
||||
auto_skill:true,
|
||||
auto_confirm:true,
|
||||
|
@ -230,6 +233,7 @@ window.config={
|
|||
show_replay:false,
|
||||
show_pause:true,
|
||||
show_auto:true,
|
||||
show_volumn:true,
|
||||
only_fullskin:true,
|
||||
show_wuxie:true,
|
||||
show_stat:true,
|
||||
|
|
136
game/game.js
136
game/game.js
|
@ -37,6 +37,11 @@ window.play={};
|
|||
'游戏操作':'<ul><li>长按/鼠标悬停/右键单击(需在设置中开启)显示信息<li>触屏模式中双指点击切换暂停<li>键盘快捷键<br>'+
|
||||
'<table><tr><td>a<td>切换托管<tr><td>c<td>打开设置<tr><td>w<td>切换不询问无懈<tr><td>▭<td>暂停</ul>'
|
||||
},
|
||||
setPopped:function(node,func,width){
|
||||
node._poppedfunc=func;
|
||||
node._poppedwidth=width;
|
||||
node.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',ui.click.hoverpopped);
|
||||
},
|
||||
placePoppedDialog:function(dialog,e){
|
||||
if(e.touches&&e.touches[0]){
|
||||
e=e.touches[0];
|
||||
|
@ -4873,10 +4878,14 @@ window.play={};
|
|||
}
|
||||
var audio=document.createElement('audio');
|
||||
audio.autoplay=true;
|
||||
audio.volume=lib.config.volumn_audio/8;
|
||||
audio.src='audio'+str+'.mp3';
|
||||
audio.addEventListener('ended',function(){
|
||||
this.remove();
|
||||
});
|
||||
audio.onerror=function(){
|
||||
this.remove();
|
||||
};
|
||||
document.body.appendChild(audio);
|
||||
},
|
||||
playBackgroundMusic:function(){
|
||||
|
@ -6453,11 +6462,14 @@ window.play={};
|
|||
ui.system=ui.create.div("#system.",ui.window);
|
||||
ui.arena=ui.create.div('#arena',ui.window);
|
||||
ui.backgroundMusic=document.createElement('audio');
|
||||
ui.backgroundMusic.volume=lib.config.volumn_background/8;
|
||||
game.playBackgroundMusic();
|
||||
ui.backgroundMusic.autoplay=true;
|
||||
ui.backgroundMusic.addEventListener('ended',game.playBackgroundMusic);
|
||||
ui.window.appendChild(ui.backgroundMusic);
|
||||
|
||||
|
||||
|
||||
ui.sidebar=ui.create.div('#sidebar');
|
||||
ui.canvas=document.createElement('canvas');
|
||||
ui.arena.appendChild(ui.canvas);
|
||||
|
@ -6723,6 +6735,7 @@ window.play={};
|
|||
appearence.push(ui.create.switcher('show_playerids',lib.config.show_playerids,ui.click.sidebar.show_playerids));
|
||||
appearence.push(ui.create.switcher('show_pause',lib.config.show_pause,ui.click.sidebar.show_pause));
|
||||
appearence.push(ui.create.switcher('show_auto',lib.config.show_auto,ui.click.sidebar.show_auto));
|
||||
appearence.push(ui.create.switcher('show_volumn',lib.config.show_volumn,ui.click.sidebar.show_volumn));
|
||||
appearence.push(ui.create.switcher('show_wuxie',lib.config.show_wuxie,ui.click.sidebar.show_wuxie));
|
||||
appearence.push(ui.create.div('.placeholder'));
|
||||
appearence.push(ui.create.switcher('title',lib.config.title,ui.click.sidebar.title));
|
||||
|
@ -7172,8 +7185,13 @@ window.play={};
|
|||
}
|
||||
ui.config2=ui.create.system('选项',ui.click.config);
|
||||
ui.wuxie=ui.create.system('不询问无懈',ui.click.wuxie,true);
|
||||
ui.volumn=ui.create.system('音量');
|
||||
lib.setPopped(ui.volumn,ui.click.volumn,200);
|
||||
ui.auto=ui.create.system('托管',ui.click.auto);
|
||||
if(lib.config.show_pause) ui.auto.style.marginLeft='10px';
|
||||
if(!lib.config.show_volumn){
|
||||
ui.volumn.style.display='none';
|
||||
}
|
||||
if(!lib.config.show_auto){
|
||||
ui.auto.style.display='none';
|
||||
}
|
||||
|
@ -7483,6 +7501,110 @@ window.play={};
|
|||
},
|
||||
},
|
||||
click:{
|
||||
volumn:function(){
|
||||
var uiintro=ui.create.dialog('hidden');
|
||||
uiintro.add('背景音乐');
|
||||
var vol1=ui.create.div('.volumn');
|
||||
uiintro.add(vol1);
|
||||
for(var i=0;i<8;i++){
|
||||
var span=document.createElement('span');
|
||||
span.link=i+1;
|
||||
span.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.volumn_background);
|
||||
if(i<lib.config.volumn_background){
|
||||
span.innerHTML='●';
|
||||
}
|
||||
else{
|
||||
span.innerHTML='○';
|
||||
}
|
||||
vol1.appendChild(span);
|
||||
}
|
||||
uiintro.add('游戏音效');
|
||||
|
||||
var vol2=ui.create.div('.volumn');
|
||||
uiintro.add(vol2);
|
||||
for(var i=0;i<8;i++){
|
||||
var span=document.createElement('span');
|
||||
span.link=i+1;
|
||||
span.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.volumn_audio);
|
||||
if(i<lib.config.volumn_audio){
|
||||
span.innerHTML='●';
|
||||
}
|
||||
else{
|
||||
span.innerHTML='○';
|
||||
}
|
||||
vol2.appendChild(span);
|
||||
}
|
||||
uiintro.add(ui.create.div('.placeholder'));
|
||||
return uiintro;
|
||||
},
|
||||
volumn_background:function(e){
|
||||
if(_status.dragged) return;
|
||||
game.saveConfig('volumn_background',this.link);
|
||||
ui.backgroundMusic.volume=this.link/8;
|
||||
for(var i=0;i<8;i++){
|
||||
if(i<lib.config.volumn_background){
|
||||
this.parentNode.childNodes[i].innerHTML='●';
|
||||
}
|
||||
else{
|
||||
this.parentNode.childNodes[i].innerHTML='○';
|
||||
}
|
||||
}
|
||||
e.stopPropagation();
|
||||
},
|
||||
volumn_audio:function(e){
|
||||
if(_status.dragged) return;
|
||||
game.saveConfig('volumn_audio',this.link);
|
||||
for(var i=0;i<8;i++){
|
||||
if(i<lib.config.volumn_audio){
|
||||
this.parentNode.childNodes[i].innerHTML='●';
|
||||
}
|
||||
else{
|
||||
this.parentNode.childNodes[i].innerHTML='○';
|
||||
}
|
||||
}
|
||||
e.stopPropagation();
|
||||
},
|
||||
hoverpopped:function(){
|
||||
if(this._uiintro){
|
||||
return;
|
||||
}
|
||||
if(!this._poppedfunc){
|
||||
return;
|
||||
}
|
||||
if(ui.currentpopped&&ui.currentpopped._uiintro){
|
||||
ui.currentpopped._uiintro.delete();
|
||||
delete ui.currentpopped._uiintro;
|
||||
}
|
||||
ui.currentpopped=this;
|
||||
var uiintro=this._poppedfunc();
|
||||
uiintro.classList.add('popped');
|
||||
uiintro.classList.add('static');
|
||||
this._uiintro=uiintro;
|
||||
|
||||
ui.window.appendChild(uiintro);
|
||||
var width=this._poppedwidth||330;
|
||||
uiintro.style.width=width+'px';
|
||||
uiintro.style.height=Math.min(ui.window.offsetHeight-260,uiintro.content.scrollHeight)+'px';
|
||||
uiintro.style.top='50px';
|
||||
var left=this.parentNode.offsetLeft+this.offsetLeft+this.offsetWidth/2-width/2;
|
||||
if(left<10){
|
||||
left=10;
|
||||
}
|
||||
else if(left+width>ui.window.offsetWidth-10){
|
||||
left=ui.window.offsetWidth-width-10;
|
||||
}
|
||||
uiintro.style.left=left+'px';
|
||||
uiintro._poppedorigin=this;
|
||||
uiintro.addEventListener(lib.config.touchscreen?'touchend':'mouseleave',ui.click.leavehoverpopped);
|
||||
},
|
||||
leavehoverpopped:function(){
|
||||
if(_status.dragged) return;
|
||||
this.delete();
|
||||
var button=this._poppedorigin
|
||||
setTimeout(function(){
|
||||
delete button._uiintro;
|
||||
},500);
|
||||
},
|
||||
dierevive:function(){
|
||||
if(game.me.isDead()){
|
||||
game.me.revive(1);
|
||||
|
@ -7841,6 +7963,10 @@ window.play={};
|
|||
}
|
||||
}
|
||||
}
|
||||
if(ui.currentpopped&&ui.currentpopped._uiintro){
|
||||
ui.currentpopped._uiintro.delete();
|
||||
delete ui.currentpopped._uiintro;
|
||||
}
|
||||
if(_status.choosing){
|
||||
if(_status.choosing.expand) _status.choosing.expand=false;
|
||||
else{
|
||||
|
@ -8239,6 +8365,7 @@ window.play={};
|
|||
}
|
||||
},
|
||||
wuxie:function(){
|
||||
if(this.classList.contains('hidden')) return;
|
||||
this.classList.toggle('glow');
|
||||
if(this.classList.contains('glow')&&
|
||||
(_status.event.parent.name=='_wuxie1'||_status.event.parent.name=='_wuxie2')&&
|
||||
|
@ -8573,6 +8700,15 @@ window.play={};
|
|||
ui.auto.style.display='none';
|
||||
}
|
||||
},
|
||||
show_volumn:function(bool){
|
||||
game.saveConfig('show_volumn',bool);
|
||||
if(lib.config.show_volumn){
|
||||
ui.volumn.style.display='';
|
||||
}
|
||||
else{
|
||||
ui.volumn.style.display='none';
|
||||
}
|
||||
},
|
||||
show_wuxie:function(bool){
|
||||
game.saveConfig('show_wuxie',bool);
|
||||
if(lib.config.show_wuxie){
|
||||
|
|
|
@ -43,6 +43,7 @@ body>.background.paused{-webkit-filter:blur(3px);}
|
|||
body>.background{z-index:-2}
|
||||
.popup{padding: 5px;}
|
||||
.removing,.hidden{opacity: 0 !important;}
|
||||
#system>div>div.hidden{opacity:0.5 !important;}
|
||||
.transparent{opacity: 0.3 !important;}
|
||||
.out{opacity: 0.3 !important;-webkit-filter:blur(3px)}
|
||||
.blur{-webkit-filter:blur(3px) !important;}
|
||||
|
@ -145,6 +146,13 @@ margin-bottom: 5px;
|
|||
margin-left: 20px;
|
||||
display:inline-block;
|
||||
}
|
||||
.dialog .content>.volumn{
|
||||
margin:0;
|
||||
}
|
||||
.dialog .content>.volumn>span{
|
||||
margin-left:2px;
|
||||
margin-right:2px;
|
||||
}
|
||||
.config{text-align: left;width: 90%;left: 5%;display: block;overflow: hidden;border-radius: 2px;}
|
||||
.config>div{text-align: left;left: 0;}
|
||||
.config>div>div{position: relative;padding-right: 10px;height:20px}
|
||||
|
|
111
mode/versus.js
111
mode/versus.js
|
@ -36,13 +36,17 @@ mode.versus={
|
|||
|
||||
ui.versusreplace=ui.create.system('换人',null,true);
|
||||
ui.versushs=ui.create.system('手牌',null,true);
|
||||
ui.versusreplace.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverReplace);
|
||||
ui.versushs.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverHandcards);
|
||||
lib.setPopped(ui.versusreplace,game.versusHoverReplace);
|
||||
lib.setPopped(ui.versushs,game.versusHoverHandcards);
|
||||
// ui.versusreplace.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverReplace);
|
||||
// ui.versushs.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverHandcards);
|
||||
}
|
||||
_status.friendCount=ui.create.system('我方阵亡:'+get.cnNumber(0),null,true);
|
||||
_status.enemyCount=ui.create.system('敌方阵亡:'+get.cnNumber(0),null,true);
|
||||
_status.friendCount.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverFriend);
|
||||
_status.enemyCount.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverEnemy);
|
||||
lib.setPopped(_status.friendCount,game.versusHoverFriend);
|
||||
lib.setPopped(_status.enemyCount,game.versusHoverEnemy);
|
||||
// _status.friendCount.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverFriend);
|
||||
// _status.enemyCount.addEventListener(lib.config.touchscreen?'touchstart':'mouseenter',game.versusHoverEnemy);
|
||||
|
||||
if(lib.storage.zhu){
|
||||
_status.currentSide=true;
|
||||
|
@ -628,18 +632,7 @@ mode.versus={
|
|||
}
|
||||
},
|
||||
versusHoverEnemy:function(e){
|
||||
if(this._uiintro){
|
||||
return;
|
||||
}
|
||||
if(ui.versushover&&ui.versushover._uiintro){
|
||||
ui.versushover._uiintro.delete();
|
||||
delete ui.versushover._uiintro;
|
||||
}
|
||||
ui.versushover=this;
|
||||
var uiintro=ui.create.dialog('hidden');
|
||||
uiintro.classList.add('popped');
|
||||
uiintro.classList.add('static');
|
||||
this._uiintro=uiintro;
|
||||
|
||||
if(_status.enemyDied.length){
|
||||
uiintro.add('已阵亡');
|
||||
|
@ -654,33 +647,10 @@ mode.versus={
|
|||
uiintro.add('(无)')
|
||||
}
|
||||
|
||||
ui.window.appendChild(uiintro);
|
||||
uiintro.style.width='330px';
|
||||
uiintro.style.height=Math.min(ui.window.offsetHeight-260,uiintro.content.scrollHeight)+'px';
|
||||
uiintro.style.top='50px';
|
||||
uiintro.style.left=(_status.enemyCount.parentNode.offsetLeft+_status.enemyCount.offsetLeft+
|
||||
_status.enemyCount.offsetWidth-330)+'px';
|
||||
uiintro.addEventListener(lib.config.touchscreen?'touchend':'mouseleave',function(){
|
||||
if(_status.dragged) return;
|
||||
this.delete();
|
||||
setTimeout(function(){
|
||||
delete _status.enemyCount._uiintro;
|
||||
},500);
|
||||
})
|
||||
return uiintro;
|
||||
},
|
||||
versusHoverFriend:function(e){
|
||||
if(this._uiintro){
|
||||
return;
|
||||
}
|
||||
if(ui.versushover&&ui.versushover._uiintro){
|
||||
ui.versushover._uiintro.delete();
|
||||
delete ui.versushover._uiintro;
|
||||
}
|
||||
ui.versushover=this;
|
||||
var uiintro=ui.create.dialog('hidden');
|
||||
uiintro.classList.add('popped');
|
||||
uiintro.classList.add('static');
|
||||
this._uiintro=uiintro;
|
||||
|
||||
if(_status.friendDied.length){
|
||||
uiintro.add('已阵亡');
|
||||
|
@ -695,32 +665,10 @@ mode.versus={
|
|||
uiintro.add('(无)')
|
||||
}
|
||||
|
||||
ui.window.appendChild(uiintro);
|
||||
uiintro.style.width='330px';
|
||||
uiintro.style.height=Math.min(ui.window.offsetHeight-260,uiintro.content.scrollHeight)+'px';
|
||||
uiintro.style.top='50px';
|
||||
uiintro.style.left=(_status.friendCount.parentNode.offsetLeft+_status.friendCount.offsetLeft+_status.friendCount.offsetWidth/2-165)+'px';
|
||||
uiintro.addEventListener(lib.config.touchscreen?'touchend':'mouseleave',function(){
|
||||
if(_status.dragged) return;
|
||||
this.delete();
|
||||
setTimeout(function(){
|
||||
delete _status.friendCount._uiintro;
|
||||
},500);
|
||||
})
|
||||
return uiintro;
|
||||
},
|
||||
versusHoverReplace:function(e){
|
||||
if(this._uiintro){
|
||||
return;
|
||||
}
|
||||
if(ui.versushover&&ui.versushover._uiintro){
|
||||
ui.versushover._uiintro.delete();
|
||||
delete ui.versushover._uiintro;
|
||||
}
|
||||
ui.versushover=this;
|
||||
var uiintro=ui.create.dialog('hidden');
|
||||
uiintro.classList.add('popped');
|
||||
uiintro.classList.add('static');
|
||||
this._uiintro=uiintro;
|
||||
|
||||
uiintro.add(ui.autoreplace);
|
||||
var players=[];
|
||||
|
@ -735,32 +683,11 @@ mode.versus={
|
|||
buttons[i].addEventListener(lib.config.touchscreen?'touchend':'click',game.versusClickToSwap);
|
||||
}
|
||||
|
||||
ui.window.appendChild(uiintro);
|
||||
uiintro.style.width='330px';
|
||||
uiintro.style.height=Math.min(ui.window.offsetHeight-260,uiintro.content.scrollHeight)+'px';
|
||||
uiintro.style.top='50px';
|
||||
uiintro.style.left=(ui.versusreplace.parentNode.offsetLeft+ui.versusreplace.offsetLeft+ui.versusreplace.offsetWidth/2-165)+'px';
|
||||
uiintro.addEventListener(lib.config.touchscreen?'touchend':'mouseleave',function(){
|
||||
if(_status.dragged) return;
|
||||
this.delete();
|
||||
setTimeout(function(){
|
||||
delete ui.versusreplace._uiintro;
|
||||
},500);
|
||||
})
|
||||
return uiintro;
|
||||
},
|
||||
versusHoverHandcards:function(e){
|
||||
if(this._uiintro){
|
||||
return;
|
||||
}
|
||||
if(ui.versushover&&ui.versushover._uiintro){
|
||||
ui.versushover._uiintro.delete();
|
||||
delete ui.versushover._uiintro;
|
||||
}
|
||||
ui.versushover=this;
|
||||
var uiintro=ui.create.dialog('hidden');
|
||||
uiintro.classList.add('popped');
|
||||
uiintro.classList.add('static');
|
||||
this._uiintro=uiintro;
|
||||
|
||||
for(var i=0;i<game.players.length;i++){
|
||||
if(game.players[i].side==game.me.side&&game.players[i]!=game.me){
|
||||
uiintro.add(get.translation(game.players[i]));
|
||||
|
@ -773,18 +700,8 @@ mode.versus={
|
|||
}
|
||||
}
|
||||
}
|
||||
ui.window.appendChild(uiintro);
|
||||
uiintro.style.width='330px';
|
||||
uiintro.style.height=Math.min(ui.window.offsetHeight-260,uiintro.content.scrollHeight)+'px';
|
||||
uiintro.style.top='50px';
|
||||
uiintro.style.left=(ui.versushs.parentNode.offsetLeft+ui.versushs.offsetLeft+ui.versushs.offsetWidth/2-165)+'px';
|
||||
uiintro.addEventListener(lib.config.touchscreen?'touchend':'mouseleave',function(){
|
||||
if(_status.dragged) return;
|
||||
this.delete();
|
||||
setTimeout(function(){
|
||||
delete ui.versushs._uiintro;
|
||||
},500);
|
||||
})
|
||||
|
||||
return uiintro;
|
||||
},
|
||||
versusCheckEnemy:function(){
|
||||
_status.clicked=true;
|
||||
|
|
Loading…
Reference in New Issue