drawEquipbox

This commit is contained in:
oc 2019-03-30 16:46:02 +08:00
parent 25d0ce95ac
commit 254484541d
8 changed files with 212 additions and 242 deletions

View File

@ -1416,64 +1416,65 @@ actions.prototype._keyUpToolbox = function (keycode) {
////// 装备栏界面时的点击操作 //////
actions.prototype._clickEquipbox = function (x, y) {
// 道具栏
if (x >= 10 && x <= 12 && y == 0) {
if (x >= this.LAST - 2 && y == 0) {
core.ui.closePanel();
core.openToolbox();
return;
}
// 返回
if (x >= 10 && x <= 12 && y == 12) {
if (x >= this.LAST - 2 && y == this.LAST) {
core.ui.closePanel();
return;
}
// 当前页面
var page = core.status.event.data.page;
// 上一页
if ((x == 3 || x == 4) && y == 12) {
if (page > 1) {
if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) {
if (core.status.event.data.page > 1) {
core.status.event.data.page--;
core.ui.drawEquipbox(core.status.event.selection);
}
return;
}
// 下一页
if ((x == 8 || x == 9) && y == 12) {
var lastPage = Math.ceil(Object.keys(core.status.hero.items.equips).length / 12);
if (page < lastPage) {
if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) {
var lastPage = Math.ceil(Object.keys(core.status.hero.items.equips).length / this.LAST);
if (core.status.event.data.page < lastPage) {
core.status.event.data.page++;
core.ui.drawEquipbox(core.status.event.selection);
}
return;
}
var index = parseInt(x / 2);
if (y == 4) index += 0;
else if (y == 6) index += 6;
else if (y == 9) index += 12;
else if (y == 11) index += 18;
else index = -1;
if (index >= 0) {
if (index < 12) index = parseInt(index / 2);
this._clickEquipboxIndex(index);
var per_page = this.HSIZE - 3, v = this.SIZE / per_page;
if (y == this.LAST - 8) {
for (var i = 0; i < per_page; ++i)
if (x >= i * v && x <= (i + 1) * v)
return this._clickEquipboxIndex(i);
}
else if (y == this.LAST - 6) {
for (var i = 0; i < per_page; ++i)
if (x >= i * v && x <= (i + 1) * v)
return this._clickEquipboxIndex(per_page + i);
}
else if (y == this.LAST - 3)
this._clickEquipboxIndex(this.LAST + parseInt(x / 2))
else if (y == this.LAST - 1)
this._clickEquipboxIndex(this.LAST + this.HSIZE + parseInt(x / 2));
}
////// 选择装备栏界面中某个Index后的操作 //////
actions.prototype._clickEquipboxIndex = function (index) {
if (index < 6) {
if (index < this.LAST) {
if (index >= core.status.globalAttribute.equipName.length) return;
if (index == core.status.event.selection && core.status.hero.equipment[index]) {
core.unloadEquip(index);
core.status.route.push("unEquip:" + index);
}
}
else if (index >= 12) {
else {
var equips = Object.keys(core.status.hero.items.equips || {}).sort();
if (index == core.status.event.selection) {
var equipId = equips[index - 12 + (core.status.event.data.page - 1) * 12];
var equipId = equips[index - this.LAST + (core.status.event.data.page - 1) * this.LAST];
core.loadEquip(equipId);
core.status.route.push("equip:" + equipId);
}
@ -1483,21 +1484,23 @@ actions.prototype._clickEquipboxIndex = function (index) {
////// 装备栏界面时,按下某个键的操作 //////
actions.prototype._keyDownEquipbox = function (keycode) {
if (core.status.event.data != null) return;
if (core.status.event.data == null) return;
var last_index = this.LAST - 1;
var per_line = this.HSIZE - 3;
var equipCapacity = core.status.globalAttribute.equipName.length;
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
var index = core.status.event.selection;
var page = core.status.event.data.page;
var totalPage = Math.ceil(ownEquipment.length / 12);
var totalLastIndex = 12 + (page < totalPage ? 11 : (ownEquipment.length + 11) % 12);
var totalPage = Math.ceil(ownEquipment.length / this.LAST);
var totalLastIndex = this.LAST + (page < totalPage ? last_index : (ownEquipment.length + last_index) % this.LAST);
if (keycode == 37) { // left
if (index == 0) return;
if (index == 12) {
if (index == this.LAST) {
if (page > 1) {
core.status.event.data.page--;
index = 23;
index = this.LAST + last_index;
}
else if (page == 1)
index = equipCapacity - 1;
@ -1508,25 +1511,25 @@ actions.prototype._keyDownEquipbox = function (keycode) {
return;
}
if (keycode == 38) { // up
if (index < 3) return;
else if (index < 6) index -= 3;
else if (index < 18) {
index = parseInt((index - 12) / 2);
if (equipCapacity > 3) index = Math.min(equipCapacity - 1, index + 3);
if (index < per_line) return;
else if (index < 2 * per_line) index -= per_line;
else if (index < this.LAST + this.HSIZE) {
index = parseInt((index - this.LAST) / 2);
if (equipCapacity > per_line) index = Math.min(equipCapacity - 1, index + per_line);
else index = Math.min(equipCapacity - 1, index);
}
else index -= 6;
else index -= this.HSIZE;
this._clickEquipboxIndex(index);
return;
}
if (keycode == 39) { // right
if (page < totalPage && index == 23) {
if (page < totalPage && index == this.LAST + last_index) {
core.status.event.data.page++;
index = 12;
index = this.LAST;
}
else if (index == equipCapacity - 1) {
if (totalPage == 0) return;
index = 12;
index = this.LAST;
}
else if (index == totalLastIndex)
return;
@ -1535,19 +1538,19 @@ actions.prototype._keyDownEquipbox = function (keycode) {
return;
}
if (keycode == 40) { // down
if (index < 3) {
if (equipCapacity > 3) index = Math.min(index + 3, equipCapacity - 1);
if (index < per_line) {
if (equipCapacity > per_line) index = Math.min(index + per_line, equipCapacity - 1);
else {
if (totalPage == 0) return;
index = Math.min(2 * index + 1 + 12, totalLastIndex);
index = Math.min(2 * index + 1 + this.LAST, totalLastIndex);
}
}
else if (index < 6) {
else if (index < 2 * per_line) {
if (totalPage == 0) return;
index = Math.min(2 * (index - 3) + 1 + 12, totalLastIndex);
index = Math.min(2 * (index - per_line) + 1 + this.LAST, totalLastIndex);
}
else if (index < 18)
index = Math.min(index + 6, totalLastIndex);
else if (index < this.LAST + this.HSIZE)
index = Math.min(index + this.HSIZE, totalLastIndex);
else return;
this._clickEquipboxIndex(index);
return;

View File

@ -1865,12 +1865,12 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
////// 设置某个属性的增幅值 //////
control.prototype.setBuff = function (name, value) {
this.setFlag('flag:__'+name+'_buff__', value);
this.setFlag('__'+name+'_buff__', value);
}
////// 加减某个属性的增幅值 //////
control.prototype.addBuff = function (name, value) {
this.setFlag('flag:__'+name+'_buff__', this.getBuff(name) + value);
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value);
}
////// 获得某个属性的增幅值 //////

View File

@ -103,7 +103,9 @@ function core() {
"data": null,
"time": 0,
"updated": false,
}
},
"favorite": [],
"favoriteName": {}
}
this.initStatus = {
'played': false,
@ -295,7 +297,7 @@ core.prototype._init_platform = function () {
}
core.prototype._init_checkLocalForage = function () {
core.platform.useLocalForage = core.getLocalStorage('useLocalForage', !core.platform.isIOS);
core.platform.useLocalForage = core.getLocalStorage('useLocalForage', true);
var _error = function (e) {
main.log(e);
core.platform.useLocalForage = false;
@ -384,13 +386,16 @@ core.prototype._forwardFunc = function (name, funcname) {
}
if (core[funcname]) {
console.error("ERROR: Cannot forward function " + funcname + " from " + name + "!");
console.error("ERROR: 无法转发 "+name+" 中的函数 "+funcname+" 到 core 中!同名函数已存在。");
return;
}
var parameterInfo = /^\s*function\s*[\w_$]*\(([\w_,$\s]*)\)\s*\{/.exec(core[name][funcname].toString());
var parameters = (parameterInfo == null ? "" : parameterInfo[1]).replace(/\s*/g, '').replace(/,/g, ', ');
// core[funcname] = new Function(parameters, "return core."+name+"."+funcname+"("+parameters+");");
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
if (name == 'plugin') {
main.log("插件函数转发core."+funcname+" = core.plugin."+funcname);
}
}
core.prototype.doFunc = function (func, _this) {

View File

@ -311,20 +311,17 @@ items.prototype.unloadEquip = function (equipType, callback) {
}
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
var compareAtk = 0, compareDef = 0, compareMdef = 0;
if (compareEquipId) {
var compareEquip = core.material.items[compareEquipId];
compareAtk += (compareEquip.equip || {}).atk || 0;
compareDef += (compareEquip.equip || {}).def || 0;
compareMdef += (compareEquip.equip || {}).mdef || 0;
var result = {};
var first = core.material.items[compareEquipId], second = core.material.items[beComparedEquipId];
for (var name in core.status.hero) {
if (typeof core.status.hero[name] == 'number') {
var ans = 0;
if (first) ans += (first.equip || {})[name] || 0;
if (second) ans -= (second.equip || {})[name] || 0;
if (ans != 0) result[name] = ans;
}
}
if (beComparedEquipId) {
var beComparedEquip = core.material.items[beComparedEquipId];
compareAtk -= (beComparedEquip.equip || {}).atk || 0;
compareDef -= (beComparedEquip.equip || {}).def || 0;
compareMdef -= (beComparedEquip.equip || {}).mdef || 0;
}
return {"atk": compareAtk, "def": compareDef, "mdef": compareMdef};
return result;
}
////// 实际换装的效果 //////
@ -349,7 +346,7 @@ items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) {
var loadPercentage = loadEquip.equip.percentage, unloadPercentage = unloadEquip.equip.percentage;
if (loadPercentage != null && unloadPercentage != null && loadPercentage != unloadPercentage) {
if (loadId && unloadId && (loadPercentage || false) != (unloadPercentage || false)) {
this.unloadEquip(type);
this.loadEquip(loadId);
if (callback) callback();

View File

@ -1733,7 +1733,7 @@ ui.prototype.drawToolbox = function(index) {
core.setTextAlign('ui', 'center');
core.fillText('ui', '[装备栏]', this.PIXEL - 46, 25, '#DDDDDD', this._buildFont(15, true));
core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13,'#DDDDDD');
core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13);
}
ui.prototype._drawToolbox_getInfo = function (index) {
@ -1795,28 +1795,25 @@ ui.prototype._drawToolbox_drawLine = function (yoffset, text) {
}
ui.prototype._drawToolbox_drawDescription = function (info, max_height) {
core.setTextAlign('ui', 'left');
// 描述
if (info.selectId) {
var item=core.material.items[info.selectId];
core.fillText('ui', item.name, 10, 32, '#FFD700', this._buildFont(20, true))
var text = item.text||"该道具暂无描述。";
try {
// 检查能否eval
text = core.replaceText(text);
} catch (e) {}
var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(17, false));
// --- 开始逐行绘制
var curr = 62, line_height = 25;
core.setFillStyle('ui', '#FFFFFF');
for (var i=0;i<lines.length;++i) {
core.fillText('ui', lines[i], 10, curr);
curr += line_height;
if (curr>=max_height) break;
}
if (curr < max_height) {
core.fillText('ui', '<继续点击该道具即可进行使用>', 10, curr, '#CCCCCC', this._buildFont(14, false));
}
if (!info.selectId) return;
var item=core.material.items[info.selectId];
core.fillText('ui', item.name, 10, 32, '#FFD700', this._buildFont(20, true))
var text = item.text||"该道具暂无描述。";
try {
// 检查能否eval
text = core.replaceText(text);
} catch (e) {}
var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(17, false));
// --- 开始逐行绘制
var curr = 62, line_height = 25;
core.setFillStyle('ui', '#FFFFFF');
for (var i=0;i<lines.length;++i) {
core.fillText('ui', lines[i], 10, curr);
curr += line_height;
if (curr>=max_height) break;
}
if (curr < max_height) {
core.fillText('ui', '<继续点击该道具即可进行使用>', 10, curr, '#CCCCCC', this._buildFont(14, false));
}
}
@ -1837,187 +1834,155 @@ ui.prototype._drawToolbox_drawContent = function (info, line, items, page, drawC
////// 绘制装备界面 //////
ui.prototype.drawEquipbox = function(index) {
// 设定eventdata
if (!core.isset(core.status.event.data) || !core.isset(core.status.event.data.page))
core.status.event.data = {"page":1, "selectId":null};
var info = this._drawEquipbox_getInfo(index);
this._drawToolbox_drawBackground();
core.setAlpha('ui', 1);
core.setStrokeStyle('ui', '#DDDDDD');
core.canvas.ui.lineWidth = 2;
core.canvas.ui.strokeWidth = 2;
core.setTextAlign('ui', 'right');
var line1 = this.PIXEL - 306;
this._drawToolbox_drawLine(line1, "当前装备");
var line2 = this.PIXEL - 146;
this._drawToolbox_drawLine(line2, "拥有装备");
this._drawEquipbox_description(info, line1);
this._drawEquipbox_drawEquiped(info, line1);
this._drawToolbox_drawContent(info, line2, info.ownEquipment, info.page, true);
this.drawPagination(info.page, info.totalPage);
core.setTextAlign('ui', 'center');
core.fillText('ui', '[道具栏]', this.PIXEL - 46, 25, '#DDDDDD', this._buildFont(15, true));
core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13);
}
ui.prototype._drawEquipbox_getInfo = function (index) {
if (!core.status.event.data || core.status.event.data.page == null)
core.status.event.data = {"page":1, "selectId":null};
var allEquips = core.status.globalAttribute.equipName;
var equipLength = allEquips.length;
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
if (!core.status.hero.equipment) core.status.hero.equipment = [];
var equipEquipment = core.status.hero.equipment;
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
var page = core.status.event.data.page;
var totalPage = Math.ceil(ownEquipment.length/12);
var totalPage = Math.ceil(ownEquipment.length / this.LAST);
// 处理index
if (!core.isset(index)) {
if (equipLength>0 && core.isset(equipEquipment[0])) index=0;
else if (ownEquipment.length>0) index=12;
else index=0;
if (index == null) {
if (equipLength > 0 && equipEquipment[0]) index = 0;
else if (ownEquipment.length > 0) index = this.LAST;
else index = 0;
}
if (index>=12 && ownEquipment.length==0) index = 0;
if (index >= this.LAST && ownEquipment.length == 0) index = 0;
var selectId=null;
if (index<12) {
if (index < this.LAST) {
if (index >= equipLength) index=Math.max(0, equipLength - 1);
selectId = equipEquipment[index]||null;
selectId = equipEquipment[index] || null;
}
else {
if (page == totalPage) index = Math.min(index, (ownEquipment.length+11)%12+12);
selectId = ownEquipment[index-12 + (page-1)*12];
if (page == totalPage) index = Math.min(index, (ownEquipment.length+this.LAST-1)%this.LAST+this.LAST);
selectId = ownEquipment[index - this.LAST + (page - 1) * this.LAST];
if (!core.hasItem(selectId)) selectId=null;
}
core.status.event.selection=index;
core.status.event.data.selectId=selectId;
return { index: index, selectId: selectId, page: page, totalPage: totalPage, allEquips: allEquips,
equipLength: equipLength, equipEquipment: equipEquipment, ownEquipment: ownEquipment};
}
core.clearMap('ui', 0, 0, 416, 416);
core.setAlpha('ui', 0.85);
core.fillRect('ui', 0, 0, 416, 416, '#000000');
core.setAlpha('ui', 1);
core.setFillStyle('ui', '#DDDDDD');
core.setStrokeStyle('ui', '#DDDDDD');
core.canvas.ui.lineWidth = 2;
core.canvas.ui.strokeWidth = 2;
var ydelta = 20;
// 画线
core.canvas.ui.beginPath();
core.canvas.ui.moveTo(0, 130-ydelta);
core.canvas.ui.lineTo(416, 130-ydelta);
core.canvas.ui.stroke();
core.canvas.ui.beginPath();
core.canvas.ui.moveTo(416,129-ydelta);
core.canvas.ui.lineTo(416,105-ydelta);
core.canvas.ui.lineTo(416-72,105-ydelta);
core.canvas.ui.lineTo(416-102,129-ydelta);
core.canvas.ui.fill();
core.canvas.ui.beginPath();
core.canvas.ui.moveTo(0, 290-ydelta);
core.canvas.ui.lineTo(416, 290-ydelta);
core.canvas.ui.stroke();
core.canvas.ui.beginPath();
core.canvas.ui.moveTo(416,289-ydelta);
core.canvas.ui.lineTo(416,265-ydelta);
core.canvas.ui.lineTo(416-72,265-ydelta);
core.canvas.ui.lineTo(416-102,289-ydelta);
core.canvas.ui.fill();
// 文字
core.setTextAlign('ui', 'right');
var globalFont = core.status.globalAttribute.font;
core.fillText('ui', "当前装备", 411, 124-ydelta, '#333333', "bold 16px "+globalFont);
core.fillText('ui', "拥有装备", 411, 284-ydelta);
ui.prototype._drawEquipbox_description = function (info, max_height) {
core.setTextAlign('ui', 'left');
if (!info.selectId) return;
var equip=core.material.items[info.selectId];
// --- 标题
if (!equip.equip) equip.equip = {"type": 0};
var equipType = equip.equip.type, equipString;
if (typeof equipType === 'string') {
equipString = equipType || "未知部位";
equipType = core.items.getEquipTypeByName(equipType);
}
else equipString = info.allEquips[equipType] || "未知部位";
core.fillText('ui', equip.name + "" + equipString + "", 10, 32, '#FFD700', this._buildFont(20, true))
// --- 描述
var text = equip.text || "该装备暂无描述。";
try {
text = core.replaceText(text);
} catch (e) {}
var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(17, false));
var curr = 62, line_height = 25;
core.setFillStyle('ui', '#FFFFFF');
for (var i = 0; i < lines.length; ++i) {
core.fillText('ui', lines[i], 10, curr);
curr += line_height;
if (curr >= max_height) break;
}
// --- 变化值
if (curr >= max_height) return;
this._drawEquipbox_drawStatusChanged(info, curr, equip, equipType);
}
// 描述
if (core.isset(selectId)) {
var equip=core.material.items[selectId];
if (!core.isset(equip.equip)) equip.equip = {"type": 0};
var equipType = equip.equip.type;
var equipString;
if (typeof equipType === 'string') {
equipString = equipType||"未知部位";
equipType = core.items.getEquipTypeByName(equipType);
}
else equipString = allEquips[equipType]||"未知部位";
core.fillText('ui', equip.name + "" + equipString + "", 10, 32, '#FFD700', "bold 20px "+globalFont)
var text = equip.text||"该装备暂无描述。";
try {
text = core.replaceText(text);
} catch (e) {}
var lines = core.splitLines('ui', text, 406, '17px '+globalFont);
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px '+globalFont);
// 比较属性
if (lines.length==1) {
var compare, differentMode = null;
if (index<12) compare = core.compareEquipment(null, selectId);
else {
if (equipType<0) {
differentMode = '<当前没有该装备的空位,请先卸下装备>';
}
else {
var last = core.material.items[equipEquipment[equipType]]||{};
// 检查是不是数值模式和比例模式之间的切换
if (core.isset(last.equip) && (last.equip.percentage||false) != (equip.equip.percentage||false)) {
differentMode = '<数值和比例模式之间的切换不显示属性变化>';
}
else {
compare = core.compareEquipment(selectId, equipEquipment[equipType]);
}
}
}
if (differentMode != null) {
core.fillText('ui', differentMode, 10, 89, '#CCCCCC', '14px '+globalFont);
}
else {
var drawOffset = 10;
[['攻击','atk'], ['防御','def'], ['魔防','mdef']].forEach(function (t) {
var title = t[0], name = t[1];
if (!core.isset(compare[name]) || compare[name]==0) return;
var color = '#00FF00';
if (compare[name]<0) color = '#FF0000';
var nowValue = core.getStatus(name), newValue = nowValue + compare[name];
if (equip.equip.percentage) {
var nowBuff = core.getBuff(name), newBuff = nowBuff+compare[name]/100;
nowValue = Math.floor(nowBuff*core.getStatus(name));
newValue = Math.floor(newBuff*core.getStatus(name));
}
var content = title + ' ' + nowValue + '->';
core.fillText('ui', content, drawOffset, 89, '#CCCCCC', 'bold 14px '+globalFont);
drawOffset += core.calWidth('ui', content);
core.fillText('ui', newValue, drawOffset, 89, color);
drawOffset += core.calWidth('ui', newValue) + 15;
})
}
}
ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipType) {
var compare, differentMode = null;
if (info.index < this.LAST) compare = core.compareEquipment(null, info.selectId);
else {
if (equipType<0) differentMode = '<当前没有该装备的空位,请先卸下装备>';
else {
var leftText = text.substring(lines[0].length);
core.fillText('ui', leftText, 10, 89, '#FFFFFF', '17px '+globalFont);
var last = core.material.items[info.equipEquipment[equipType]]||{};
if (last.equip && (last.equip.percentage || false) != (equip.equip.percentage || false))
differentMode = '<数值和比例模式之间的切换不显示属性变化>';
else
compare = core.compareEquipment(info.selectId, info.equipEquipment[equipType]);
}
}
if (differentMode != null) {
core.fillText('ui', differentMode, 10, y, '#CCCCCC', this._buildFont(14, false));
return;
}
var drawOffset = 10;
// --- 变化值...
core.setFont('ui', this._buildFont(14, true));
for (var name in compare) {
var img = core.statusBar.icons[name];
if (img) { // 绘制图标
core.drawImage('ui', img, 0, 0, 32, 32, drawOffset, y - 13, 16, 16);
drawOffset += 20;
}
else { // 绘制文字
core.fillText('ui', name + " ", drawOffset, y, '#CCCCCC');
drawOffset += core.calWidth('ui', name + " ");
}
var nowValue = core.getStatus(name) * core.getBuff(name), newValue = (nowValue + compare[name]) * core.getBuff(name);
if (equip.equip.percentage) {
var nowBuff = core.getBuff(name), newBuff = nowBuff + compare[name] / 100;
nowValue = Math.floor(nowBuff * core.getStatus(name));
newValue = Math.floor(newBuff * core.getStatus(name));
}
nowValue = core.formatBigNumber(nowValue);
newValue = core.formatBigNumber(newValue);
core.fillText('ui', nowValue + "->", drawOffset, y, '#CCCCCC');
drawOffset += core.calWidth('ui', nowValue + "->");
core.fillText('ui', newValue, drawOffset, y, compare[name]>0?'#00FF00':'#FF0000');
drawOffset += core.calWidth('ui', newValue) + 8;
}
}
ui.prototype._drawEquipbox_drawEquiped = function (info, line) {
core.setTextAlign('ui', 'right');
var images = core.material.images.items;
var per_line = this.HSIZE - 3, width = Math.floor(this.PIXEL / (per_line + 0.25));
// 当前装备
for (var i = 0 ; i < equipLength ; i++) {
var equipId = equipEquipment[i] || null;
if (core.isset(equipId)) {
for (var i = 0; i < info.equipLength ; i++) {
var equipId = info.equipEquipment[i] || null;
var offset_text = width * (i % per_line) + 56;
var offset_image = width * (i % per_line) + width * 2 / 3;
var y = line + 54 * Math.floor(i / per_line) + 19;
if (equipId) {
var icon = core.material.icons.items[equipId];
core.drawImage('ui', images, 0, icon*32, 32, 32, 16*(8*(i%3)+5)+5, 144+Math.floor(i/3)*54+5-ydelta, 32, 32);
core.drawImage('ui', core.material.images.items, 0, 32 * icon, 32, 32, offset_image, y, 32, 32);
}
core.fillText('ui', allEquips[i]||"未知", 16*(8*(i%3)+1)+40, 144+Math.floor(i/3)*54+32-ydelta, '#FFFFFF', "bold 16px "+globalFont);
core.strokeRect('ui', 16*(8*(i%3)+5)+1, 144+Math.floor(i/3)*54+1-ydelta, 40, 40, index==i?'#FFD700':"#FFFFFF");
core.fillText('ui', info.allEquips[i] || "未知", offset_text, y + 27, '#FFFFFF', this._buildFont(16, true))
core.strokeRect('ui', offset_image - 4, y - 4, 40, 40, info.index==i?'#FFD700':"#FFFFFF");
}
// 现有装备
for (var i=0;i<12;i++) {
var ownEquip=ownEquipment[12*(page-1)+i];
if (!core.isset(ownEquip)) continue;
var icon=core.material.icons.items[ownEquip];
core.drawImage('ui', images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, 304+Math.floor(i/6)*54+5-ydelta, 32, 32)
// 个数
if (core.itemCount(ownEquip)>1)
core.fillText('ui', core.itemCount(ownEquip), 16*(4*(i%6)+1)+40, 304+Math.floor(i/6)*54+38-ydelta, '#FFFFFF', "bold 14px "+globalFont);
if (index>=12 && selectId == ownEquip)
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 304+Math.floor(i/6)*54+1-ydelta, 40, 40, '#FFD700');
}
this.drawPagination(page, totalPage, 12);
// 道具栏
core.setTextAlign('ui', 'center');
core.fillText('ui', '[道具栏]', 370, 25,'#DDDDDD', 'bold 15px '+globalFont);
// 退出按钮
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
}
////// 绘制存档/读档界面 //////

View File

@ -259,7 +259,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"hammer": 48,
"jumpShoes": 49,
"skill1": 30,
"I73": 10
"wand": 10
},
"autotile": {
"autotile": 0,

View File

@ -303,7 +303,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "可以打开或关闭主动技能二倍斩",
"hideInReplay": true
},
"I73": {
"wand": {
"cls": "items",
"name": "新物品"
}

View File

@ -67,7 +67,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"70": {"cls":"items","id":"sword0"},
"71": {"cls":"items","id":"shield0"},
"72": {"cls":"items","id":"skill1"},
"73": {"cls":"items","id":"I73"},
"73": {"cls":"items","id":"wand"},
"81": {"cls":"terrains","id":"yellowDoor","trigger":"openDoor"},
"82": {"cls":"terrains","id":"blueDoor","trigger":"openDoor"},
"83": {"cls":"terrains","id":"redDoor","trigger":"openDoor"},