状态栏增设绿钥匙

This commit is contained in:
ckcz123 2020-05-10 12:09:26 +08:00
parent c71aac1fa9
commit 046aaa71e6
17 changed files with 73 additions and 42 deletions

View File

@ -1 +1 @@
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample1","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}

View File

@ -19,14 +19,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "select",
"_select": {
"values": [
"keys",
"items",
"constants",
"tools",
"equips"
]
},
"_data": "只能取keys(钥匙) items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
"_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
},
"name": {
"_leaf": true,
@ -40,6 +39,11 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_string": true,
"_data": "道具在道具栏中显示的描述"
},
"hideInToolbox": {
"_leaf": true,
"_type": "checkbox",
"_data": "是否不显示在道具栏中"
},
"equip": {
"_leaf": true,
"_type": "textarea",
@ -48,7 +52,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"hideInReplay": {
"_leaf": true,
"_type": "checkbox",
"_data": "是否回放时绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启如开启技能或者《镜子》那样的镜像切换等等"
"_data": "是否回放时绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启如开启技能或者《镜子》那样的镜像切换等等"
}
}
},

View File

@ -243,12 +243,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"items": {
"_type": "object",
"_data": {
"keys": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_data": "初始三种钥匙个数"
},
"constants": {
"_leaf": true,
"_type": "textarea",
@ -488,6 +482,11 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "checkbox",
"_data": "是否在状态栏显示三色钥匙数量"
},
"enableGreenKey": {
"_leaf": true,
"_type": "checkbox",
"_data": "是否在状态栏显示绿钥匙"
},
"enablePZF": {
"_leaf": true,
"_type": "checkbox",

View File

@ -487,6 +487,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>

View File

@ -469,6 +469,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>

View File

@ -127,6 +127,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>

View File

@ -1362,6 +1362,11 @@ actions.prototype._keyUpQuickShop = function (keycode) {
////// 工具栏界面时的点击操作 //////
actions.prototype._clickToolbox = function (x, y) {
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
// 装备栏
if (x >= this.LAST - 2 && y == 0) {
core.ui.closePanel();
@ -1391,11 +1396,11 @@ actions.prototype._clickToolbox = function (x, y) {
}
// 下一页
if (x == this.HSIZE+2 || x == this.HSIZE+3) {
if (y == this.LAST - 5 && toolsPage < Math.ceil(Object.keys(core.status.hero.items.tools).length / this.LAST)) {
if (y == this.LAST - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) {
core.status.event.data.toolsPage++;
core.ui.drawToolbox(core.status.event.selection);
}
if (y == this.LAST && constantsPage < Math.ceil(Object.keys(core.status.hero.items.constants).length / this.LAST)) {
if (y == this.LAST && constantsPage < Math.ceil(constants.length / this.LAST)) {
core.status.event.data.constantsPage++;
core.ui.drawToolbox(core.status.event.selection);
}
@ -1413,15 +1418,20 @@ actions.prototype._clickToolbox = function (x, y) {
////// 选择工具栏界面中某个Index后的操作 //////
actions.prototype._clickToolboxIndex = function (index) {
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var items = null;
var select;
if (index < this.LAST) {
select = index + this.LAST * (core.status.event.data.toolsPage - 1);
items = Object.keys(core.status.hero.items.tools).sort();
items = tools;
}
else {
select = index % this.LAST + this.LAST * (core.status.event.data.constantsPage - 1);
items = Object.keys(core.status.hero.items.constants).sort();
items = constants;
}
if (items == null) return;
if (select >= items.length) return;
@ -1441,8 +1451,10 @@ actions.prototype._keyDownToolbox = function (keycode) {
var last_index = this.LAST - 1;
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var index = core.status.event.selection;
var toolsPage = core.status.event.data.toolsPage;
var constantsPage = core.status.event.data.constantsPage;

View File

@ -1439,8 +1439,10 @@ control.prototype._replayAction_item = function (action) {
core.useItem(itemId, false, core.replay);
return true;
}
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var index, per = core.__SIZE__-1;
if ((index=tools.indexOf(itemId))>=0) {
core.status.event.data = {"toolsPage": Math.floor(index/per)+1, "constantsPage":1};
@ -2828,6 +2830,14 @@ control.prototype._resize_status = function (obj) {
for (var i = 0; i < core.dom.statusTexts.length; ++i) {
core.dom.statusTexts[i].style.color = obj.globalAttribute.statusBarColor;
}
// keys
if (core.flags.enableGreenKey) {
core.dom.keyCol.style.fontSize = '0.75em';
core.statusBar.greenKey.style.display = '';
} else {
core.dom.keyCol.style.fontSize = '';
core.statusBar.greenKey.style.display = 'none';
}
}
control.prototype._resize_toolBar = function (obj) {

View File

@ -503,7 +503,7 @@ events.prototype.getItem = function (id, num, x, y, callback) {
} catch (e) {}
if (!core.status.event.id || core.status.event.id=='action') {
core.insertAction("\t["+core.material.items[id].name+","+id+"]" + hint + "\n"
+ (itemCls == 'keys' || id == 'greenKey' || id == 'steelKey' ? "(钥匙类道具,遇到对应的门时自动打开)"
+ (id.endsWith('Key') ? "(钥匙类道具,遇到对应的门时自动打开)"
: itemCls == 'tools' ? "消耗类道具请按T在道具栏使用"
: itemCls == 'constants' ? "永久类道具请按T在道具栏使用"
: itemCls == 'equips' ? "装备类道具请按Q在装备栏进行装备" : ""));

View File

@ -202,8 +202,7 @@ items.prototype.setItem = function (itemId, itemNum) {
core.status.hero.items[itemCls][itemId] = itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
core.updateStatusBar();
}
@ -219,8 +218,7 @@ items.prototype.addItem = function (itemId, itemNum) {
}
core.status.hero.items[itemCls][itemId] += itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
// 永久道具只能有一个
if (itemCls == 'constants' && core.status.hero.items[itemCls][itemId] > 1)
@ -235,8 +233,7 @@ items.prototype.removeItem = function (itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
core.status.hero.items[itemCls][itemId] -= itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
core.updateStatusBar();
return true;

View File

@ -2171,8 +2171,10 @@ ui.prototype._drawToolbox_getInfo = function (index) {
if (!core.status.event.data || core.status.event.data.toolsPage == null)
core.status.event.data = {"toolsPage":1, "constantsPage":1, "selectId":null}
// 获取物品列表
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
// 处理页数
var toolsPage = core.status.event.data.toolsPage;
var constantsPage = core.status.event.data.constantsPage;
@ -2675,7 +2677,7 @@ ui.prototype._drawStatistics_buildObj = function () {
else cls[e] = core.material.items[e].cls;
cnt[e] = 0;
})
var order = ["doors", "keys", "items", "tools", "constants", "equips"];
var order = ["doors", "items", "tools", "constants", "equips"];
ids.sort(function (a, b) {
var c1 = order.indexOf(cls[a]), c2 = order.indexOf(cls[b]);
if (c1==c2) return ori.indexOf(a)-ori.indexOf(b);

View File

@ -63,6 +63,7 @@ utils.prototype._init = function () {
////// 将文字中的${和}(表达式)进行替换 //////
utils.prototype.replaceText = function (text, prefix, need, times) {
if (typeof text != 'string') return text;
return text.replace(/\${(.*?)}/g, function (word, value) {
return core.calValue(value, prefix, need, times);
});

View File

@ -174,6 +174,7 @@ function main() {
'yellowKey': document.getElementById("yellowKey"),
'blueKey': document.getElementById("blueKey"),
'redKey': document.getElementById("redKey"),
'greenKey': document.getElementById("greenKey"),
'poison': document.getElementById('poison'),
'weak':document.getElementById('weak'),
'curse': document.getElementById('curse'),

View File

@ -94,11 +94,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"experience": 0,
"equipment": [],
"items": {
"keys": {
"yellowKey": 0,
"blueKey": 0,
"redKey": 0
},
"constants": {},
"tools": {},
"equips": {}
@ -429,6 +424,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"enableLevelUp": false,
"levelUpLeftMode": false,
"enableKeys": true,
"enableGreenKey": false,
"enablePZF": false,
"enableDebuff": false,
"enableSkill": false,

View File

@ -1066,7 +1066,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} else core.setStatusBarInnerHTML('up', "");
// 钥匙
var keys = ['yellowKey', 'blueKey', 'redKey'];
var keys = ['yellowKey', 'blueKey', 'redKey', 'greenKey'];
keys.forEach(function (key) {
core.setStatusBarInnerHTML(key, core.setTwoDigits(core.itemCount(key)));
});

View File

@ -2,19 +2,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
{
"items": {
"yellowKey": {
"cls": "keys",
"cls": "tools",
"name": "黄钥匙",
"text": "可以打开一扇黄门"
"text": "可以打开一扇黄门",
"hideInToolbox": true
},
"blueKey": {
"cls": "keys",
"cls": "tools",
"name": "蓝钥匙",
"text": "可以打开一扇蓝门"
"text": "可以打开一扇蓝门",
"hideInToolbox": true
},
"redKey": {
"cls": "keys",
"cls": "tools",
"name": "红钥匙",
"text": "可以打开一扇红门"
"text": "可以打开一扇红门",
"hideInToolbox": true
},
"redJewel": {
"cls": "items",
@ -182,13 +185,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"book": {
"cls": "constants",
"name": "怪物手册",
"text": "可以查看当前楼层各怪物属性"
"text": "可以查看当前楼层各怪物属性",
"hideInToolbox": true
},
"fly": {
"cls": "constants",
"name": "楼层传送器",
"text": "可以自由往来去过的楼层",
"hideInReplay": true
"hideInReplay": true,
"hideInToolbox": true
},
"coin": {
"cls": "constants",

View File

@ -219,6 +219,7 @@
}
#statusBar span{
font: bold italic 1.1em Verdana;
display: inline;
}
#statusBar p {
display: inline-block;