修改了throwEmotion及其一系列函数,新增一个rotate参数让投掷表情旋转

This commit is contained in:
BauxiteAl 2023-10-19 13:21:33 +08:00
parent 9123425a7c
commit c923e846db
1 changed files with 8 additions and 7 deletions

View File

@ -21605,7 +21605,7 @@
next.setContent('chooseToGuanxing'); next.setContent('chooseToGuanxing');
return next; return next;
} }
$throwEmotion(target,name){ $throwEmotion(target,name,rotate){
game.addVideo('throwEmotion',this,[target.dataset.position,name]); game.addVideo('throwEmotion',this,[target.dataset.position,name]);
var getLeft=function(player){ var getLeft=function(player){
if(player==game.me&&!ui.fakeme&&!ui.chess) return player.getLeft()+player.node.avatar.offsetWidth/2; if(player==game.me&&!ui.fakeme&&!ui.chess) return player.getLeft()+player.node.avatar.offsetWidth/2;
@ -21626,6 +21626,7 @@
var top2=target.getTop()+target.offsetHeight/3-height; var top2=target.getTop()+target.offsetHeight/3-height;
emotion.style['z-index']=10; emotion.style['z-index']=10;
emotion.style.transform='translateY('+(top2-top)+'px) translateX('+(left2-left)+'px)'; emotion.style.transform='translateY('+(top2-top)+'px) translateX('+(left2-left)+'px)';
if(['egg','flower','shoe'].contains(name)||rotate) emotion.firstElementChild.style.transform='rotate(1440deg)';
if(lib.config.background_audio) game.playAudio('effect','throw_'+name+get.rand(1,2)); if(lib.config.background_audio) game.playAudio('effect','throw_'+name+get.rand(1,2));
setTimeout(function(){ setTimeout(function(){
emotion.innerHTML=('<div style="text-align:center"> <img src="'+lib.assetURL+'image/emotion/throw_emotion/'+name+'2.png"> </div>'); emotion.innerHTML=('<div style="text-align:center"> <img src="'+lib.assetURL+'image/emotion/throw_emotion/'+name+'2.png"> </div>');
@ -22379,10 +22380,10 @@
game.playerMap[this.playerid]=this; game.playerMap[this.playerid]=this;
return this; return this;
} }
throwEmotion(target,emotion){ throwEmotion(target,emotion,rotate){
game.broadcastAll(function(player,target,emotion){ game.broadcastAll(function(player,target,emotion,rotate){
player.$throwEmotion(target,emotion); player.$throwEmotion(target,emotion,rotate);
},this,target,emotion); },this,target,emotion,rotate);
} }
emotion(pack,id){ emotion(pack,id){
var str='<img src="##assetURL##image/emotion/'+pack+'/'+id+'.gif" width="50" height="50">'; var str='<img src="##assetURL##image/emotion/'+pack+'/'+id+'.gif" width="50" height="50">';
@ -33813,11 +33814,11 @@
} }
} }
}, },
throwEmotion:function(target,emotion){ throwEmotion:function(target,emotion,rotate){
if(lib.node.observing.contains(this)) return; if(lib.node.observing.contains(this)) return;
var player=lib.playerOL[this.id]; var player=lib.playerOL[this.id];
if(player){ if(player){
player.throwEmotion(target,emotion); player.throwEmotion(target,emotion,rotate);
} }
}, },
emotion:function(id,pack,emotion){ emotion:function(id,pack,emotion){