From 4d35d7b35eaae2b50d7fdb1d2ca791b69c49d587 Mon Sep 17 00:00:00 2001 From: dljgs1 <906348668@qq.com> Date: Mon, 15 Apr 2019 21:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B0=83=E6=95=B4=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E6=96=B9=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/ui.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index 5425c2ad..6764fda6 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -403,9 +403,9 @@ ui.prototype._getPosition = function (content) { py = core.status.event.data.y; } content = content.replace("\b", "\\b") - .replace(/\\b\[(up|center|down)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) { + .replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) { pos = s1; - if (s3 == 'hero') { + if (s3 == 'hero' || s1=='hero') { px = core.status.hero.loc.x; py = core.status.hero.loc.y; } @@ -417,6 +417,9 @@ ui.prototype._getPosition = function (content) { px = parseInt(str[0]); py = parseInt(str[1]); } + if(pos=='hero' || pos=='null'){ + pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down'); + } return ""; }); return {content: content, position: pos, px: px, py: py};