From d7fac0d53acca2b236ab5f3b3716f8d6f2814d85 Mon Sep 17 00:00:00 2001 From: zhujunjie Date: Wed, 6 Mar 2019 19:19:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=81=A5=E6=84=9F=E6=89=8B=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fc/js/nes-embed.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fc/js/nes-embed.js b/fc/js/nes-embed.js index 33b5d15..ee305be 100644 --- a/fc/js/nes-embed.js +++ b/fc/js/nes-embed.js @@ -122,7 +122,21 @@ window.vm = { }, onCtrlDire: function(t, e) { this.onCtrlDire; - var i = Math.round((t + 180) / 45) % 8; + var i ;//= Math.round((t + 180) / 45) % 8; + if(t>=40&&t<=50){ + i=5 + }else if(t>=-50&&t<=-40){ + i=3 + } + else if(t>=-140&&t<=-130){ + i=1 + } + else if(t>=130&&t<=140){ + i=7 + } + else{ + i = Math.round((t + 180) / 90) % 4*2; + } this.oldDire != i && (e(i, t), this.oldDire = i) }, simulateKeyPress: function(t, e) { From 3d12de99ddab260de5a1d55575d4edde8ba6e861 Mon Sep 17 00:00:00 2001 From: zhujunjie Date: Wed, 6 Mar 2019 19:38:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=8B=E6=84=9F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fc/js/nes-embed.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fc/js/nes-embed.js b/fc/js/nes-embed.js index ee305be..1f30c37 100644 --- a/fc/js/nes-embed.js +++ b/fc/js/nes-embed.js @@ -123,16 +123,9 @@ window.vm = { onCtrlDire: function(t, e) { this.onCtrlDire; var i ;//= Math.round((t + 180) / 45) % 8; - if(t>=40&&t<=50){ - i=5 - }else if(t>=-50&&t<=-40){ - i=3 - } - else if(t>=-140&&t<=-130){ - i=1 - } - else if(t>=130&&t<=140){ - i=7 + var abst = Math.abs(t); + if((abst>=40&&abst<=50)||(abst>=130&&abst<=140)){ + i = Math.round((t + 180) / 45) % 8; } else{ i = Math.round((t + 180) / 90) % 4*2;