feat: 楼传界面额外功能
This commit is contained in:
parent
2960426044
commit
e976931949
@ -1284,6 +1284,30 @@ actions.prototype._clickBookDetail = function () {
|
|||||||
core.status.event.id = 'book';
|
core.status.event.id = 'book';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _hideFly(floorId) {
|
||||||
|
const hideFloors = core.getFlag('hideFloors', {});
|
||||||
|
if (hideFloors.hasOwnProperty(floorId)) {
|
||||||
|
delete hideFloors[floorId];
|
||||||
|
core.setFlag('hideFloors', hideFloors);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Object.keys(hideFloors).length <= 1) {
|
||||||
|
core.drawFailTip('当前无法执行隐藏操作!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hideFloors[floorId] = true;
|
||||||
|
}
|
||||||
|
core.setFlag('hideFloors', hideFloors);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _hideFlyMode() {
|
||||||
|
core.setFlag('noHideFly', !core.hasFlag('noHideFly'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function _isFloorHided(floorId) {
|
||||||
|
return !core.hasFlag('noHideFly') && core.getFlag('hideFloors', {}).hasOwnProperty(floorId);
|
||||||
|
}
|
||||||
|
|
||||||
////// 楼层传送器界面时的点击操作 //////
|
////// 楼层传送器界面时的点击操作 //////
|
||||||
actions.prototype._clickFly = function (x, y) {
|
actions.prototype._clickFly = function (x, y) {
|
||||||
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE + 3) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-1)); }
|
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE + 3) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-1)); }
|
||||||
@ -1291,8 +1315,24 @@ actions.prototype._clickFly = function (x, y) {
|
|||||||
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE + 4) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-10)); }
|
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE + 4) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-10)); }
|
||||||
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE - 2) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(10)); }
|
if ((x == this.SIZE - 2 || x == this.SIZE - 3) && y == this.HSIZE - 2) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(10)); }
|
||||||
if (x >= this.HSIZE - 1 && x <= this.HSIZE + 1 && y == this.LAST) { core.playSound('取消'); core.ui.closePanel(); }
|
if (x >= this.HSIZE - 1 && x <= this.HSIZE + 1 && y == this.LAST) { core.playSound('取消'); core.ui.closePanel(); }
|
||||||
|
const floorId = core.floorIds[core.status.event.data];
|
||||||
if (x >= 0 && x <= this.HSIZE + 3 && y >= 3 && y <= this.LAST - 1)
|
if (x >= 0 && x <= this.HSIZE + 3 && y >= 3 && y <= this.LAST - 1)
|
||||||
core.flyTo(core.floorIds[core.status.event.data]);
|
core.flyTo(floorId);
|
||||||
|
if (x >= 1 && x <= 2 && y === 2) _hideFly(floorId);
|
||||||
|
if (x >= 3 && x <= 6 && y === 2) _hideFlyMode();
|
||||||
|
if (x >= 7 && x <= 8 && y === 2) {
|
||||||
|
core.myprompt("请输入一段笔记,字数不要过多。", null, function (data) {
|
||||||
|
if (data) {
|
||||||
|
const flyNotes = core.getFlag('flyNotes', {});
|
||||||
|
flyNotes[floorId] = data;
|
||||||
|
core.setFlag('flyNotes', flyNotes);
|
||||||
|
core.ui.drawFly(core.status.event.data);
|
||||||
|
core.drawSuccessTip("楼层笔记新增成功!");
|
||||||
|
} else {
|
||||||
|
core.ui.closePanel();
|
||||||
|
}
|
||||||
|
}, () => { });
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1315,7 +1355,8 @@ actions.prototype._getNextFlyFloor = function (delta, index) {
|
|||||||
index += sign;
|
index += sign;
|
||||||
if (index < 0 || index >= core.floorIds.length) break;
|
if (index < 0 || index >= core.floorIds.length) break;
|
||||||
var floorId = core.floorIds[index];
|
var floorId = core.floorIds[index];
|
||||||
if (core.status.maps[floorId].canFlyTo && core.hasVisitedFloor(floorId)) {
|
if (core.status.maps[floorId].canFlyTo && core.hasVisitedFloor(floorId)
|
||||||
|
&& !_isFloorHided(floorId)) {
|
||||||
delta--;
|
delta--;
|
||||||
ans = index;
|
ans = index;
|
||||||
}
|
}
|
||||||
|
|||||||
19
libs/ui.js
19
libs/ui.js
@ -2553,13 +2553,20 @@ ui.prototype.drawFly = function (page) {
|
|||||||
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
|
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setTextAlign('ui', 'center');
|
core.setTextAlign('ui', 'center');
|
||||||
core.fillText('ui', '楼层跳跃', this.HPIXEL, 60, '#FFFFFF', this._buildFont(28, true));
|
core.fillText('ui', '楼层跳跃', this.HPIXEL, 40, '#FFFFFF', this._buildFont(28, true));
|
||||||
core.fillText('ui', '返回游戏', this.HPIXEL, this.PIXEL - 13, null, this._buildFont(15, true))
|
core.fillText('ui', '返回游戏', this.HPIXEL, this.PIXEL - 13, null, this._buildFont(15, true))
|
||||||
core.setTextAlign('ui', 'right');
|
core.setTextAlign('ui', 'right');
|
||||||
core.fillText('ui', '浏览地图时也', this.PIXEL - 10, this.PIXEL - 23, '#aaaaaa', this._buildFont(10, false));
|
core.fillText('ui', '浏览地图时也', this.PIXEL - 10, this.PIXEL - 23, '#aaaaaa', this._buildFont(10, false));
|
||||||
core.fillText('ui', '可楼层跳跃!', this.PIXEL - 10, this.PIXEL - 11, null, this._buildFont(10, false));
|
core.fillText('ui', '可楼层跳跃!', this.PIXEL - 10, this.PIXEL - 11, null, this._buildFont(10, false));
|
||||||
core.setTextAlign('ui', 'center');
|
core.setTextAlign('ui', 'center');
|
||||||
|
|
||||||
|
const isHide = core.getFlag('hideFloors', {}).hasOwnProperty(floorId);
|
||||||
|
const noHideFly = core.hasFlag('noHideFly');
|
||||||
|
|
||||||
|
core.fillText('ui', isHide ? '[显示本层]' : '[隐藏本层]', 60, 80, '#EEEEEE', this._buildFont(12, false));
|
||||||
|
core.fillText('ui', '[显示隐藏层:' + noHideFly ? 'ON' : 'OFF' + ']', 160, 80, '#EEEEEE', this._buildFont(12, false));
|
||||||
|
core.fillText('ui', '[楼层笔记]', 260, 80, '#EEEEEE', this._buildFont(12, false));
|
||||||
|
|
||||||
var middle = this.HPIXEL + 39;
|
var middle = this.HPIXEL + 39;
|
||||||
|
|
||||||
// 换行
|
// 换行
|
||||||
@ -2583,8 +2590,18 @@ ui.prototype.drawFly = function (page) {
|
|||||||
core.fillText('ui', '▼', this.PIXEL - 60, middle + 96 + 7);
|
core.fillText('ui', '▼', this.PIXEL - 60, middle + 96 + 7);
|
||||||
}
|
}
|
||||||
var size = this.PIXEL - 143;
|
var size = this.PIXEL - 143;
|
||||||
|
|
||||||
core.strokeRect('ui', 20, 100, size, size, '#FFFFFF', 2);
|
core.strokeRect('ui', 20, 100, size, size, '#FFFFFF', 2);
|
||||||
|
if (isHide) core.setAlpha('ui', 0.8);
|
||||||
core.drawThumbnail(floorId, null, { ctx: 'ui', x: 20, y: 100, size: size, damage: true });
|
core.drawThumbnail(floorId, null, { ctx: 'ui', x: 20, y: 100, size: size, damage: true });
|
||||||
|
if (isHide) core.setAlpha('ui', 1);
|
||||||
|
|
||||||
|
const flyNotes = core.getFlag('flyNotes', {});
|
||||||
|
if (flyNotes.hasOwnProperty(floorId)) {
|
||||||
|
core.ui.drawTextContent('ui', flyNotes[floorId], {
|
||||||
|
left: 50, top: 120, color: 'white', align: 'center', fontSize: 12, maxWidth: size - 50,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制中心对称飞行器
|
////// 绘制中心对称飞行器
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user