自动调整对话框方向

This commit is contained in:
dljgs1 2019-04-15 21:15:10 +08:00
parent 5398e02b48
commit 4d35d7b35e

View File

@ -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};