Equipment
This commit is contained in:
parent
f95b316ff5
commit
c00ae6e017
@ -321,4 +321,6 @@ HTML5魔塔交流群群号: `539113091`
|
||||
|
||||
[@fux4](https://github.com/fux4) 打通了RM和H5之间的障壁(从而使RM动画导出器和怪物数据导出器成为可能),同时也是部分新功能(如跳跃、跟随、画面震动)等的编写者。
|
||||
|
||||
[@tocque](https://github.com/tocque) 装备栏的编写者。
|
||||
|
||||
以及[百度贴吧魔塔吧](https://tieba.baidu.com/f?kw=%E9%AD%94%E5%A1%94)和H5魔塔交流群`539113091`内的诸位魔塔爱好者们对本样板的大力支持!
|
||||
|
||||
@ -70,7 +70,7 @@ editor.file.editFunctions(["change","['events']['afterChangeLight']","function(x
|
||||
生成表格并绑定事件的函数
|
||||
```javascript
|
||||
editor.mode.loc();
|
||||
editor.mode.emenyitem();
|
||||
editor.mode.enemyitem();
|
||||
editor.mode.floor();
|
||||
editor.mode.tower();
|
||||
editor.mode.functions();
|
||||
@ -83,7 +83,7 @@ editor.mode.onmode('save');//保存
|
||||
editor.mode.onmode('nextChange');//下次onmode时前端进行切换
|
||||
|
||||
editor.mode.onmode('loc');
|
||||
editor.mode.onmode('emenyitem');
|
||||
editor.mode.onmode('enemyitem');
|
||||
editor.mode.onmode('floor');
|
||||
editor.mode.onmode('tower');
|
||||
editor.mode.onmode('functions');
|
||||
|
||||
@ -23,7 +23,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"equips"
|
||||
]
|
||||
},
|
||||
"_data": "只能取keys(钥匙) items(宝石、血瓶) constants(永久物品) tools(消耗道具) equip(装备)"
|
||||
"_data": "只能取keys(钥匙) items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
@ -38,36 +38,9 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_data": "道具在道具栏中显示的描述"
|
||||
},
|
||||
"equip": {
|
||||
"_leaf": false,
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"type": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "如果是装备,其类别,与equipName按顺序对应(从0开始)"
|
||||
},
|
||||
"atk": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "如果是装备,其增加的攻击数值"
|
||||
},
|
||||
"def": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "如果是装备,其增加的防御数值"
|
||||
},
|
||||
"mdef": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "如果是装备,其增加的魔防数值"
|
||||
},
|
||||
"animate": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_data": "如果是装备,其攻击动画,仅对type为0的装备有效"
|
||||
}
|
||||
}
|
||||
"_data": "装备属性设置,仅对cls为equips有效。\n如果此项不为null,需要是一个对象,里面可含\"type\",\"atk\",\"def\",\"mdef\",\"animate\"五项,分别对应装备部位、攻防魔防和动画。\n具体详见文档和已有的几个装备的写法。"
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@ -709,8 +709,8 @@ editor.prototype.listen = function () {
|
||||
}
|
||||
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
||||
editor_mode.onmode('nextChange');
|
||||
editor_mode.onmode('emenyitem');
|
||||
//editor_mode.emenyitem();
|
||||
editor_mode.onmode('enemyitem');
|
||||
//editor_mode.enemyitem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -779,7 +779,7 @@ editor.prototype.listen = function () {
|
||||
dataSelection.style.height = ysize - 6 + 'px';
|
||||
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
||||
editor_mode.onmode('nextChange');
|
||||
editor_mode.onmode('emenyitem');
|
||||
editor_mode.onmode('enemyitem');
|
||||
}
|
||||
|
||||
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||
|
||||
@ -4,7 +4,7 @@ editor_mode = function (editor) {
|
||||
function editor_mode() {
|
||||
this.ids = {
|
||||
'loc': 'left2',
|
||||
'emenyitem': 'left3',
|
||||
'enemyitem': 'left3',
|
||||
'floor': 'left4',
|
||||
'tower': 'left5',
|
||||
'functions': 'left8',
|
||||
@ -208,7 +208,7 @@ editor_mode = function (editor) {
|
||||
editor.drawEventBlock();
|
||||
});
|
||||
break;
|
||||
case 'emenyitem':
|
||||
case 'enemyitem':
|
||||
|
||||
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
|
||||
editor.file.editEnemy(editor_mode.info.id, actionList, function (objs_) {/*console.log(objs_);*/
|
||||
@ -310,7 +310,7 @@ editor_mode = function (editor) {
|
||||
if (Boolean(callback)) callback();
|
||||
}
|
||||
|
||||
editor_mode.prototype.emenyitem = function (callback) {
|
||||
editor_mode.prototype.enemyitem = function (callback) {
|
||||
//editor.info=editor.ids[editor.indexs[201]];
|
||||
if (!core.isset(editor.info)) return;
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem -->
|
||||
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem -->
|
||||
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button>
|
||||
</h3>
|
||||
<div class="leftTabContent">
|
||||
@ -264,7 +264,7 @@
|
||||
<select id="editModeSelect">
|
||||
<option value="map">地图编辑</option>
|
||||
<option value="loc">地图选点</option>
|
||||
<option value="emenyitem">图块属性</option>
|
||||
<option value="enemyitem">图块属性</option>
|
||||
<option value="floor">楼层属性</option>
|
||||
<option value="tower">全塔属性</option>
|
||||
<option value="functions">脚本编辑</option>
|
||||
@ -554,7 +554,7 @@ var editor_mobile_listen=function(){
|
||||
editor.pos = {x: 0, y: 0};
|
||||
editor.mode.loc();
|
||||
editor.info = editor.ids[editor.indexs[201]];
|
||||
editor.mode.emenyitem();
|
||||
editor.mode.enemyitem();
|
||||
editor.mode.floor();
|
||||
editor.mode.tower();
|
||||
editor.mode.functions();
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem -->
|
||||
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem -->
|
||||
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button>
|
||||
</h3>
|
||||
<div class="leftTabContent">
|
||||
@ -236,7 +236,7 @@
|
||||
<select id="editModeSelect">
|
||||
<option value="map">地图编辑</option>
|
||||
<option value="loc">地图选点</option>
|
||||
<option value="emenyitem">图块属性</option>
|
||||
<option value="enemyitem">图块属性</option>
|
||||
<option value="floor">楼层属性</option>
|
||||
<option value="tower">全塔属性</option>
|
||||
<option value="functions">脚本编辑</option>
|
||||
@ -449,7 +449,7 @@ if (location.protocol.indexOf("http")!=0) {
|
||||
editor.pos = {x: 0, y: 0};
|
||||
editor.mode.loc();
|
||||
editor.info = editor.ids[editor.indexs[201]];
|
||||
editor.mode.emenyitem();
|
||||
editor.mode.enemyitem();
|
||||
editor.mode.floor();
|
||||
editor.mode.tower();
|
||||
editor.mode.functions();
|
||||
|
||||
170
libs/actions.js
170
libs/actions.js
@ -1245,24 +1245,28 @@ actions.prototype.clickToolbox = function(x,y) {
|
||||
}
|
||||
*/
|
||||
var toolsPage = core.status.event.data.toolsPage;
|
||||
var constantsPage = core.status.event.data.constantsPage
|
||||
var constantsPage = core.status.event.data.constantsPage;
|
||||
// 上一页
|
||||
if (x == 3 || x == 4) {
|
||||
if ( y == 7 && toolsPage>1)
|
||||
if (y == 7 && toolsPage>1) {
|
||||
core.status.event.data.toolsPage--;
|
||||
if ( y == 12 && constantsPage>1)
|
||||
core.status.event.data.constantsPage--;
|
||||
core.ui.drawToolbox(core.status.event.selection)
|
||||
return;
|
||||
core.ui.drawToolbox(core.status.event.selection);
|
||||
}
|
||||
if (y == 12 && constantsPage>1) {
|
||||
core.status.event.data.toolsPage--;
|
||||
core.ui.drawToolbox(core.status.event.selection);
|
||||
}
|
||||
}
|
||||
// 下一页
|
||||
if ((x == 8 || x == 9)) {
|
||||
if (( y == 7 && toolsPage<Math.ceil(Object.keys(core.status.hero.items.tools).length/12)))
|
||||
if (x == 8 || x == 9) {
|
||||
if (y == 7 && toolsPage<Math.ceil(Object.keys(core.status.hero.items.tools).length/12)) {
|
||||
core.status.event.data.toolsPage++;
|
||||
if ( y == 12 && constantsPage<Math.ceil(Object.keys(core.status.hero.items.constants).length/12))
|
||||
core.ui.drawToolbox(core.status.event.selection);
|
||||
}
|
||||
if (y == 12 && constantsPage<Math.ceil(Object.keys(core.status.hero.items.constants).length/12)) {
|
||||
core.status.event.data.constantsPage++;
|
||||
core.ui.drawToolbox(core.status.event.selection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var index=parseInt(x/2);;
|
||||
@ -1310,30 +1314,37 @@ actions.prototype.keyDownToolbox = function (keycode) {
|
||||
var constantsPage = core.status.event.data.constantsPage;
|
||||
var toolsTotalPage = Math.ceil(tools.length/12);
|
||||
var constantsTotalPage = Math.ceil(constants.length/12);
|
||||
var toolsLastIndex = toolsPage<toolsTotalPage?11:(tools.length+11)%12;
|
||||
var constantsLastIndex = 12+(constantsPage<constantsTotalPage?11:(constants.length+11)%12);
|
||||
|
||||
if (keycode==37) { // left
|
||||
if (index==0) // 处理向前翻页
|
||||
if (toolsPage>1) {
|
||||
if (index==0) { // 处理向前翻页
|
||||
if (toolsPage > 1) {
|
||||
core.status.event.data.toolsPage--;
|
||||
index = 11;
|
||||
}
|
||||
else return; // 第一页不向前翻
|
||||
else if (index==12)
|
||||
if (constantsPage>1) {
|
||||
}
|
||||
else if (index==12) {
|
||||
if (constantsPage == 1) {
|
||||
if (toolsTotalPage==0) return;
|
||||
core.status.event.data.toolsPage = toolsTotalPage;
|
||||
index = (tools.length+11)%12;
|
||||
}
|
||||
else {
|
||||
core.status.event.data.constantsPage--;
|
||||
index = 23;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else index -= 1 ;
|
||||
this.clickToolboxIndex(index);
|
||||
return;
|
||||
}
|
||||
if (keycode==38) { // up
|
||||
if (toolsPage==toolsTotalPage&&index<18&&index>11) { // 进入tools
|
||||
if (index>=12&&index<=17) { // 进入tools
|
||||
if (toolsTotalPage==0) return;
|
||||
if (tools.length%12<=6 && tools.length%12>index%12) index -= 12;
|
||||
else if (tools.length%12>6 && tools.length%6>index%12) index -= 6;
|
||||
else index = tools.length%12-1;
|
||||
if (toolsLastIndex>=6) index = Math.min(toolsLastIndex, index-6);
|
||||
else index = Math.min(toolsLastIndex, index-12);
|
||||
}
|
||||
else if (index<6) return; // 第一行没有向上
|
||||
else index -= 6;
|
||||
@ -1349,28 +1360,33 @@ actions.prototype.keyDownToolbox = function (keycode) {
|
||||
core.status.event.data.constantsPage++;
|
||||
index = 12;
|
||||
}
|
||||
else if((toolsPage==toolsTotalPage && index==tools.length%12-1) ||
|
||||
(constantsPage==constantsTotalPage && index==constants.length%12+11)) // 一个物品无操作
|
||||
else if (index == toolsLastIndex) {
|
||||
if (constantsTotalPage==0) return;
|
||||
core.status.event.data.constantsPage = 1;
|
||||
index = 12;
|
||||
}
|
||||
else if(index==constantsLastIndex) // 一个物品无操作
|
||||
return;
|
||||
else index +=1;
|
||||
else index++;
|
||||
this.clickToolboxIndex(index);
|
||||
return;
|
||||
}
|
||||
if (keycode==40) { // down
|
||||
if ((index>5 || (toolsPage==toolsTotalPage && tools.length%12<=6)) && index<12) {// 进入constant
|
||||
if (constantsTotalPage == 0) return;
|
||||
if (constantsTotalPage == constantsPage && constants.length%12<(index%6+1))
|
||||
index = constants.length%12+11;
|
||||
else if (index<6) index += 12;
|
||||
else index += 6;
|
||||
var nextIndex = null;
|
||||
if (index<=5) {
|
||||
if (toolsLastIndex > 5) nextIndex = Math.min(toolsLastIndex, index + 6);
|
||||
else index+=6;
|
||||
}
|
||||
if (nextIndex==null && index<=11) {
|
||||
if (constantsTotalPage == 0) return;
|
||||
nextIndex = Math.min(index+6, constantsLastIndex);
|
||||
}
|
||||
if (nextIndex==null && index<=17) {
|
||||
if (constantsLastIndex > 17) nextIndex = Math.min(constantsLastIndex, index+6);
|
||||
}
|
||||
if (nextIndex!=null) {
|
||||
this.clickToolboxIndex(nextIndex);
|
||||
}
|
||||
else if (toolsPage==toolsTotalPage && tools.length%12>6 && index > tools.length%6 &&index<6)
|
||||
index = tools.length%12-1;
|
||||
else if (constantsPage==constantsTotalPage && constants.length%12>6 && index>constants.length%6+11 && index<18)
|
||||
index = constants.length%12+11;
|
||||
else if (index>17 || (constantsPage==constantsTotalPage && constants.length%12<=6 && index>11)) return;//最后一行无操作
|
||||
else index += 6;
|
||||
this.clickToolboxIndex(index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1438,43 +1454,39 @@ actions.prototype.clickEquipbox = function(x,y) {
|
||||
// 下一页
|
||||
if ((x == 8 || x == 9) && y == 12) {
|
||||
var lastPage = Math.ceil(Object.keys(core.status.hero.items.equips).length/12);
|
||||
if (page<lastPage)
|
||||
if (page<lastPage) {
|
||||
core.status.event.data.page++;
|
||||
core.ui.drawEquipbox(core.status.event.selection);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var index;
|
||||
index=parseInt(x/2);
|
||||
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>=0) {
|
||||
if (index<12) index = parseInt(index/2);
|
||||
this.clickEquipboxIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
////// 选择装备栏界面中某个Index后的操作 //////
|
||||
actions.prototype.clickEquipboxIndex = function(index) {
|
||||
if (index<12) {
|
||||
if (index>=core.status.hero.equipment.length) return;
|
||||
if (index==core.status.event.selection && core.status.hero.equipment[index] != "blank") {
|
||||
if (index<6) {
|
||||
if (index>=(main.equipName||[]).length) return;
|
||||
if (index==core.status.event.selection && core.isset(core.status.hero.equipment[index])) {
|
||||
core.unloadEquip(index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var equips = null;
|
||||
equips = Object.keys(core.status.hero.items.equips).sort();
|
||||
if (equips==null) return;
|
||||
if (index>=equips.length+12) return;
|
||||
else if (index>=12) {
|
||||
var equips = Object.keys(core.status.hero.items.equips||{}).sort();
|
||||
if (index==core.status.event.selection) {
|
||||
var equipId = equips[index-12];
|
||||
var equipId = equips[index-12 + (core.status.event.data.page-1)*12];
|
||||
core.loadEquip(equipId);
|
||||
equips = Object.keys(core.status.hero.items.equips).sort();
|
||||
if ( equips.length == 0)
|
||||
index = core.status.hero.equipment.length-1;
|
||||
}
|
||||
}
|
||||
core.ui.drawEquipbox(index);
|
||||
@ -1484,35 +1496,36 @@ actions.prototype.clickEquipboxIndex = function(index) {
|
||||
actions.prototype.keyDownEquipbox = function (keycode) {
|
||||
if (!core.isset(core.status.event.data)) return;
|
||||
|
||||
var equipCapacity = core.status.hero.equipment.length;
|
||||
var equipCapacity = (main.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);
|
||||
|
||||
if (keycode==37) { // left
|
||||
if (index==0) return;
|
||||
if (index==12)
|
||||
if (page>1) {
|
||||
if (index==12) {
|
||||
if (page > 1) {
|
||||
core.status.event.data.page--;
|
||||
index = 23;
|
||||
}
|
||||
else if (page==1)
|
||||
index = equipCapacity-1;
|
||||
else if (page == 1)
|
||||
index = equipCapacity - 1;
|
||||
else return;
|
||||
}
|
||||
else index -= 1;
|
||||
this.clickEquipboxIndex(index);
|
||||
return;
|
||||
}
|
||||
if (keycode==38) { // up
|
||||
if (index<18 && index>11) { // 进入当前装备
|
||||
index = Math.ceil((index-12)/2);
|
||||
if (equipCapacity<=3 && equipCapacity>index) index += 0;
|
||||
else if (equipCapacity>3 && equipCapacity>index) index += 3;
|
||||
else index = equipCapacity-1;
|
||||
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);
|
||||
else index = Math.min(equipCapacity-1, index);
|
||||
}
|
||||
else if (index<3) return; // 第一行没有向上
|
||||
else if (index<12) index -= 3;
|
||||
else index -= 6;
|
||||
this.clickEquipboxIndex(index);
|
||||
return;
|
||||
@ -1522,28 +1535,31 @@ actions.prototype.keyDownEquipbox = function (keycode) {
|
||||
core.status.event.data.page++;
|
||||
index = 12;
|
||||
}
|
||||
else if (index==equipCapacity-1 && totalPage>0)
|
||||
else if (index==equipCapacity-1) {
|
||||
if (totalPage==0) return;
|
||||
index = 12;
|
||||
else if (page==totalPage && index==ownEquipment.length%12+11)
|
||||
}
|
||||
else if (index==totalLastIndex)
|
||||
return;
|
||||
else index += 1;
|
||||
else index++;
|
||||
this.clickEquipboxIndex(index);
|
||||
return;
|
||||
}
|
||||
if (keycode==40) { // down
|
||||
if ((index>2 || equipCapacity<=3) && index<12) {// 进入拥有装备
|
||||
index = (index%3)*2+13;
|
||||
if (index<3) {
|
||||
if (equipCapacity>3) index = Math.min(index+3, equipCapacity-1);
|
||||
else {
|
||||
if (totalPage == 0) return;
|
||||
if (totalPage == page && ownEquipment.length%12<(index%6+1))
|
||||
index = ownEquipment.length%12+11;
|
||||
index = Math.min(2*index+1+12, totalLastIndex);
|
||||
}
|
||||
else if (equipCapacity>3 && equipCapacity%3<index &&index<3)
|
||||
index = equipCapacity-1;
|
||||
else if (totalPage == page && ownEquipment.length%12>6 && index>ownEquipment.length%6+11 && index<18)
|
||||
index = ownEquipment.length%12+11;
|
||||
else if (index>17 || (totalPage==page && ownEquipment.length%12<=6 && index>11)) return;//最后一行无操作
|
||||
else if (index<12) index += 3;
|
||||
else index += 6;
|
||||
}
|
||||
else if (index < 6) {
|
||||
if (totalPage == 0) return;
|
||||
index = Math.min(2*(index-3)+1+12, totalLastIndex);
|
||||
}
|
||||
else if (index < 18)
|
||||
index = Math.min(index+6, totalLastIndex);
|
||||
else return;
|
||||
this.clickEquipboxIndex(index);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1857,8 +1857,8 @@ control.prototype.replay = function () {
|
||||
}
|
||||
}
|
||||
else if (action.indexOf("unEquip:")==0) {
|
||||
var unloadEquipId = action.substring(8);
|
||||
var equipType = core.material.items[unloadEquipId].equip.type;
|
||||
var equipType = parseInt(action.substring(8));
|
||||
if (core.isset(equipType)) {
|
||||
core.ui.drawEquipbox(equipType);
|
||||
setTimeout(function () {
|
||||
core.ui.closePanel();
|
||||
@ -1868,6 +1868,7 @@ control.prototype.replay = function () {
|
||||
}, 750 / Math.max(1, core.status.replay.speed));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (action.indexOf("equip:")==0) {
|
||||
var equipId = action.substring(6);
|
||||
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
||||
|
||||
@ -187,7 +187,7 @@ items.prototype.loadEquip = function (equipId, callback) {
|
||||
if (core.isset(unloadEquipId))
|
||||
core.addItem(unloadEquipId, 1);
|
||||
|
||||
core.log("已装备上"+loadEquip.name, core.material.icons.items[equipId]);
|
||||
core.drawTip("已装备上"+loadEquip.name, core.material.icons.items[equipId]);
|
||||
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
@ -217,7 +217,7 @@ items.prototype.unloadEquip = function (equipType, callback) {
|
||||
core.updateStatusBar();
|
||||
|
||||
// 记录路线
|
||||
core.status.route.push("unEquip:"+unloadEquipId);
|
||||
core.status.route.push("unEquip:"+equipType);
|
||||
|
||||
// 装备更换完毕:增加卸下的装备
|
||||
core.addItem(unloadEquipId, 1);
|
||||
|
||||
119
libs/ui.js
119
libs/ui.js
@ -1206,7 +1206,9 @@ ui.prototype.drawReplay = function () {
|
||||
|
||||
////// 绘制分页 //////
|
||||
ui.prototype.drawPagination = function (page, totalPage, top) {
|
||||
if (totalPage <= 1) return;
|
||||
// if (totalPage<page) totalPage=page;
|
||||
if (totalPage<=1) return;
|
||||
if (!core.isset(top)) top=12;
|
||||
|
||||
core.setFont('ui', 'bold 15px Verdana');
|
||||
core.setFillStyle('ui', '#DDDDDD');
|
||||
@ -1583,7 +1585,7 @@ ui.prototype.drawMaps = function (index, x, y) {
|
||||
////// 绘制道具栏 //////
|
||||
ui.prototype.drawToolbox = function(index) {
|
||||
// 设定eventdata
|
||||
if (!core.isset(core.status.event.data))
|
||||
if (!core.isset(core.status.event.data) || !core.isset(core.status.event.data.toolsPage) || !core.isset(core.status.event.data.constantsPage))
|
||||
core.status.event.data = {"toolsPage":1, "constantsPage":1, "selectId":null}
|
||||
|
||||
// 获取物品列表
|
||||
@ -1687,22 +1689,24 @@ ui.prototype.drawToolbox = function(index) {
|
||||
for (var i=0;i<12;i++) {
|
||||
var tool=tools[12*(toolsPage-1)+i];
|
||||
if (!core.isset(tool)) break;
|
||||
var yoffset = 144 + Math.floor(i/6)*54 + 5 - ydelta;
|
||||
var icon=core.material.icons.items[tool];
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, 144+Math.floor(i/6)*64+5-ydelta, 32, 32)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, yoffset, 32, 32)
|
||||
// 个数
|
||||
core.fillText('ui', core.itemCount(tool), 16*(4*(i%6)+1)+40, 144+Math.floor(i/6)*64+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
||||
core.fillText('ui', core.itemCount(tool), 16*(4*(i%6)+1)+40, yoffset+33, '#FFFFFF', "bold 14px Verdana");
|
||||
if (selectId == tool)
|
||||
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 144+Math.floor(i/6)*64+1-ydelta, 40, 40, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*(i%6)+1)+1, yoffset-4, 40, 40, '#FFD700');
|
||||
}
|
||||
|
||||
// 永久道具
|
||||
for (var i=0;i<12;i++) {
|
||||
var constant=constants[12*(constantsPage-1)+i];
|
||||
if (!core.isset(constant)) break;
|
||||
var yoffset = 304+Math.floor(i/6)*54+5-ydelta;
|
||||
var icon=core.material.icons.items[constant];
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, 304+Math.floor(i/6)*64+5-ydelta, 32, 32)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, yoffset, 32, 32)
|
||||
if (selectId == constant)
|
||||
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 304+Math.floor(i/6)*64+1-ydelta, 40, 40, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*(i%6)+1)+1, yoffset-4, 40, 40, '#FFD700');
|
||||
}
|
||||
|
||||
// 分页
|
||||
@ -1713,7 +1717,7 @@ ui.prototype.drawToolbox = function(index) {
|
||||
|
||||
// 装备栏
|
||||
if (core.flags.equipment)
|
||||
core.fillText('ui', '装备栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
||||
core.fillText('ui', '[装备栏]', 370, 25,'#DDDDDD', 'bold 15px Verdana');
|
||||
// core.fillText('ui', '删除道具', 370, 32,'#DDDDDD', 'bold 15px Verdana');
|
||||
// 退出
|
||||
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||
@ -1722,8 +1726,13 @@ ui.prototype.drawToolbox = function(index) {
|
||||
////// 绘制装备界面 //////
|
||||
ui.prototype.drawEquipbox = function(index) {
|
||||
// 设定eventdata
|
||||
if (!core.isset(core.status.event.data))
|
||||
core.status.event.data = {"page":1, "selectId":null}
|
||||
if (!core.isset(core.status.event.data) || !core.isset(core.status.event.data.page))
|
||||
core.status.event.data = {"page":1, "selectId":null};
|
||||
|
||||
var allEquips = main.equipName||[];
|
||||
var equipLength = allEquips.length;
|
||||
|
||||
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
|
||||
|
||||
var equipEquipment = core.status.hero.equipment;
|
||||
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
||||
@ -1733,22 +1742,22 @@ ui.prototype.drawEquipbox = function(index) {
|
||||
|
||||
// 处理index
|
||||
if (!core.isset(index)) {
|
||||
if (equipEquipment.length>0) index=0;
|
||||
if (equipLength>0 && core.isset(equipEquipment[0])) index=0;
|
||||
else if (ownEquipment.length>0) index=12;
|
||||
else index=0;
|
||||
}
|
||||
core.status.event.selection=index;
|
||||
|
||||
var selectId;
|
||||
if (index>=12 && ownEquipment.length==0) index = 0;
|
||||
var selectId=null;
|
||||
if (index<12) {
|
||||
if (index>=equipEquipment.length) index=Math.max(0, equipEquipment.length-1);
|
||||
selectId = equipEquipment[index];
|
||||
if (index >= equipLength) index=Math.max(0, equipLength - 1);
|
||||
selectId = equipEquipment[index]||null;
|
||||
}
|
||||
else {
|
||||
if (index+12*(page-2)>=ownEquipment.length) index=12+Math.max(0, ownEquipment.length%12-1);
|
||||
selectId = ownEquipment[index-12];
|
||||
if (page == totalPage) index = Math.min(index, (ownEquipment.length+11)%12+12);
|
||||
selectId = ownEquipment[index-12 + (page-1)*12];
|
||||
if (!core.hasItem(selectId)) selectId=null;
|
||||
}
|
||||
core.status.event.selection=index;
|
||||
core.status.event.data.selectId=selectId;
|
||||
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
@ -1792,11 +1801,11 @@ ui.prototype.drawEquipbox = function(index) {
|
||||
|
||||
core.canvas.ui.textAlign = 'left';
|
||||
|
||||
console.log(equipEquipment[0]);
|
||||
// 描述
|
||||
if (core.isset(selectId)) {
|
||||
var equip=core.material.items[selectId];
|
||||
core.fillText('ui', equip.name, 10, 32, '#FFD700', "bold 20px Verdana")
|
||||
var equipType = (equip.equip||{}).type || 0;
|
||||
core.fillText('ui', equip.name + "(" + (allEquips[equipType]||"未知部位") + ")", 10, 32, '#FFD700', "bold 20px Verdana")
|
||||
|
||||
var text = equip.text||"该装备暂无描述。";
|
||||
var lines = core.splitLines('ui', text, 406, '17px Verdana');
|
||||
@ -1810,43 +1819,20 @@ ui.prototype.drawEquipbox = function(index) {
|
||||
else {
|
||||
compare = core.compareEquipment(selectId, equipEquipment[equip.equip.type]);
|
||||
}
|
||||
// 绘制
|
||||
var drawList; //= [['攻击',atk],['防御',def],['魔防',mdef]];
|
||||
var drawPointer = 0;
|
||||
var color;
|
||||
if (compare.atk!=0) {
|
||||
if (compare.atk>0) color = '#00FF00';
|
||||
else color = '#FF0000';
|
||||
drawList = '攻击 '+core.status.hero.atk+'->';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, '#CCCCCC', 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
var drawOffset = 10;
|
||||
|
||||
drawList = (core.status.hero.atk+compare.atk)+' ';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, color, 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
}
|
||||
if (compare.def!=0) {
|
||||
if (compare.def>0) color = '#00FF00';
|
||||
else color = '#FF0000';
|
||||
drawList = '防御 '+core.status.hero.atk+'->';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, '#CCCCCC', 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
|
||||
drawList = (core.status.hero.atk+compare.def)+' ';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, color, 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
}
|
||||
if (compare.mdef!=0) {
|
||||
if (compare.mdef>0) color = '#00FF00';
|
||||
else color = '#FF0000';
|
||||
drawList = '魔防 '+core.status.hero.atk+'->';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, '#CCCCCC', 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
|
||||
drawList = (core.status.hero.atk+compare.mdef)+' ';
|
||||
core.fillText('ui', drawList, 10+drawPointer, 89, color, 'bold 14px Verdana');
|
||||
drawPointer += core.canvas.ui.measureText(drawList).width;
|
||||
}
|
||||
[['攻击','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 content = title + ' ' + core.getStatus(name) + '->';
|
||||
core.fillText('ui', content, drawOffset, 89, '#CCCCCC', 'bold 14px Verdana');
|
||||
drawOffset += core.canvas.ui.measureText(content).width;
|
||||
var newValue = core.getStatus(name) + compare[name] + "";
|
||||
core.fillText('ui', newValue, drawOffset, 89, color);
|
||||
drawOffset += core.canvas.ui.measureText(newValue).width + 15;
|
||||
})
|
||||
}
|
||||
else {
|
||||
var leftText = text.substring(lines[0].length);
|
||||
@ -1858,34 +1844,33 @@ ui.prototype.drawEquipbox = function(index) {
|
||||
var images = core.material.images.items;
|
||||
|
||||
// 当前装备
|
||||
for (var i = 0 ; i < core.status.hero.equipment.length ; i++) {
|
||||
var equipId = core.status.hero.equipment[i];
|
||||
for (var i = 0 ; i < equipLength ; i++) {
|
||||
var equipId = equipEquipment[i] || null;
|
||||
if (core.isset(equipId)) {
|
||||
var icon = core.material.icons.items[equipId];
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(8*(i%3)+5)+5, 144+Math.floor(i/3)*64+5-ydelta, 32, 32);
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(8*(i%3)+5)+5, 144+Math.floor(i/3)*54+5-ydelta, 32, 32);
|
||||
}
|
||||
core.fillText('ui', main.equipName[i], 16*(8*(i%3)+1)+40, 144+Math.floor(i/3)*64+32-ydelta, '#FFFFFF', "bold 16px Verdana");
|
||||
if (index == i)
|
||||
core.strokeRect('ui', 16*(8*(i%3)+5)+1, 144+Math.floor(i/3)*64+1-ydelta, 40, 40, '#FFD700');
|
||||
core.fillText('ui', allEquips[i]||"未知", 16*(8*(i%3)+1)+40, 144+Math.floor(i/3)*54+32-ydelta, '#FFFFFF', "bold 16px Verdana");
|
||||
core.strokeRect('ui', 16*(8*(i%3)+5)+1, 144+Math.floor(i/3)*54+1-ydelta, 40, 40, index==i?'#FFD700':"#FFFFFF");
|
||||
}
|
||||
|
||||
// 现有装备
|
||||
for (var i=0;i<12;i++) {
|
||||
var ownEquip=ownEquipment[12*(page-1)+i];
|
||||
if (!core.isset(ownEquip)) break;
|
||||
if (!core.isset(ownEquip)) continue;
|
||||
var icon=core.material.icons.items[ownEquip];
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, 304+Math.floor(i/6)*64+5-ydelta, 32, 32)
|
||||
core.canvas.ui.drawImage(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)*64+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
||||
core.fillText('ui', core.itemCount(ownEquip), 16*(4*(i%6)+1)+40, 304+Math.floor(i/6)*54+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
||||
if (selectId == ownEquip)
|
||||
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 304+Math.floor(i/6)*64+1-ydelta, 40, 40, '#FFD700');
|
||||
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.canvas.ui.textAlign = 'center';
|
||||
core.fillText('ui', '道具栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
||||
core.fillText('ui', '[道具栏]', 370, 25,'#DDDDDD', 'bold 15px Verdana');
|
||||
// 退出按钮
|
||||
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ utils.prototype.encodeRoute = function (route) {
|
||||
if (t.indexOf('item:')==0)
|
||||
ans+="I"+t.substring(5)+":";
|
||||
else if (t.indexOf('unEquip:')==0)
|
||||
ans+="u"+t.substring(8)+":";
|
||||
ans+="u"+t.substring(8);
|
||||
else if (t.indexOf('equip:')==0)
|
||||
ans+="e"+t.substring(6)+":";
|
||||
else if (t.indexOf('fly:')==0)
|
||||
@ -387,7 +387,7 @@ utils.prototype.decodeRoute = function (route) {
|
||||
|
||||
while (index<route.length) {
|
||||
var c=route.charAt(index++);
|
||||
var nxt=(c=='I'|| c=='u' || c=='e' ||c=='F'||c=='S'||c=='Q'||c=='t')?getString():getNumber();
|
||||
var nxt=(c=='I'|| c=='e' ||c=='F'||c=='S'||c=='Q'||c=='t')?getString():getNumber();
|
||||
|
||||
var mp = {
|
||||
"U": "up",
|
||||
|
||||
15
更新说明.txt
15
更新说明.txt
@ -1,4 +1,17 @@
|
||||
HTML5魔塔样板V2.4
|
||||
HTML5魔塔样板V2.4.1
|
||||
|
||||
可叠加的三图层绘制图块
|
||||
专门的装备页面;装备系统大改造
|
||||
将状态栏更新和阻激夹域的计算移动到脚本编辑中
|
||||
增加控制免疫阻激夹域的flag:no_zone等
|
||||
打字机效果时点击显示全部文字
|
||||
修复更改画面色调的Bug
|
||||
修复更改剧情文本属性后读档恢复原样的问题
|
||||
部分细节优化
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
HTML5魔塔样板V2.4
|
||||
|
||||
大地图的支持
|
||||
突破了5M的存档空间大小限制
|
||||
|
||||
Loading…
Reference in New Issue
Block a user