This commit is contained in:
libccy 2017-04-05 17:38:54 +08:00
parent 4511e83b8f
commit 6d7a13e204
2 changed files with 36 additions and 1 deletions

View File

@ -53,6 +53,8 @@ window.config={
auto_skill:true,
auto_confirm:true,
enable_drag:true,
enable_pressure:true,
pressure_taptic:true,
hover_handcard:true,
hover_all:true,
right_info:true,

View File

@ -160,6 +160,12 @@
intro:'开启后可通过按压执行操作',
unfrequent:true,
},
pressure_taptic:{
name:'触觉反馈',
init:true,
intro:'开启后按压操作执行时将产生震动',
unfrequent:true,
},
pressure_click:{
name:'按压操作',
init:'pause',
@ -411,9 +417,16 @@
}
if(config.enable_pressure){
map.pressure_click.show();
if(lib.device){
map.pressure_taptic.show();
}
else{
map.pressure_taptic.hide();
}
}
else{
map.pressure_click.hide();
map.pressure_taptic.hide();
}
if(lib.config.touchscreen){
map.mousewheel.hide();
@ -36395,7 +36408,7 @@
if(_status.longpressing&&_status.longpressing!=this){
ui.click.longpresscancel.call(_status.longpressing);
}
if(window.ForceTouch&&!_status.paused2&&!_status.forcetouchinterval&&lib.config.enable_pressure){
if(window.ForceTouch&&!_status.forcetouchinterval&&lib.config.enable_pressure){
_status.forcetouchinterval=setInterval(ui.click.forcetouch,30);
}
_status.longpressing=this;
@ -37649,20 +37662,40 @@
var force = parseFloat(ForceTouchData.touches[0].force);
if(force > 0.2){
_status.force=true;
var taptic=false;
if(_status.longpressing){
delete _status.longpressing._waitingfordrag;
ui.click.touchpop();
ui.click.longpresscallback.call(_status.longpressing);
taptic=true;
}
else if(!_status.forceright){
_status.forceright=true;
setTimeout(function(){
_status.forceright=false;
},600);
if(_status.mousedragging){
_status.mousedragging=null;
_status.mouseleft=false;
_status.mousedragorigin=null;
_status.dragstatuschanged=false;
game.uncheck();
game.check();
}
switch(lib.config.pressure_click){
case 'pause':ui.click.pause();break;
case 'auto':ui.click.auto();break;
case 'config':ui.click.config();break;
}
taptic=true;
}
if(taptic&&lib.config.pressure_taptic){
if(window.TapticEngine){
window.TapticEngine.generateTapticFeedback();
}
else{
game.vibrate(50);
}
}
}
}