From 83ec7bd803e9d76eeb41f49e07037c6124d4c1c7 Mon Sep 17 00:00:00 2001 From: StageGuard <1355416608@qq.com> Date: Thu, 1 Jul 2021 16:33:36 +0800 Subject: [PATCH] optimize play thread. --- source/SkyAutoplayer.js | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/source/SkyAutoplayer.js b/source/SkyAutoplayer.js index 2064588..a36b679 100644 --- a/source/SkyAutoplayer.js +++ b/source/SkyAutoplayer.js @@ -1,3 +1,5 @@ +// noinspection JSUnresolvedVariable + "ui"; "use strict"; /* @@ -283,8 +285,7 @@ sheetplayer = { delay += config.values.chordDelay; gestureMap.push([delay, 25, keyCoordinates, keyCoordinates]); }); - gestureMap = sheetplayer.toSource(gestureMap); - eval("gestures(" + gestureMap.slice(1, gestureMap.length - 1) + ");"); + gestures.apply(null, gestureMap); } }); while(sheetplayer.playing && sheetplayer.currentNote < sheetplayer.noteCount) { @@ -364,24 +365,7 @@ sheetplayer = { this.bpm = j.bpm; this.noteCount = this.notes.length; this.keyCount = j.keyCount; - }, - - toSource: function(obj) { - var _toJSON = function toJSON(x, lev) { - var p = "", r, i; - if (typeof x == "string") { - return x; - } else if (Array.isArray(x)) { - r = new Array(); - for (i = 0; i < x.length; i++) r.push(toJSON(x[i], lev - 1)); - p = "[" + r.join(",") + "]"; - } else { - p = String(x); - } - return p; - } - return _toJSON(obj, 32); - }, + } } config = {