correct some mistakes
This commit is contained in:
parent
eedbd3d457
commit
59976bbb0c
@ -91,14 +91,14 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_string": true,
|
"_string": true,
|
||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_data": "cls为tools或contants时的使用物品效果。"
|
"_data": "cls为tools或constants时的使用物品效果。"
|
||||||
},
|
},
|
||||||
"canUseItemEffect": {
|
"canUseItemEffect": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_string": true,
|
"_string": true,
|
||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_data": "cls为tools或contants时对当前能否使用该物品的判断。"
|
"_data": "cls为tools或constants时对当前能否使用该物品的判断。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
251
libs/actions.js
251
libs/actions.js
@ -1244,36 +1244,33 @@ actions.prototype.clickToolbox = function(x,y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
var toolsPage = core.status.event.data.toolsPage;
|
||||||
// 当前页面
|
var constantsPage = core.status.event.data.constantsPage
|
||||||
var page = parseInt((core.status.event.selection%1000)/12)+1;
|
|
||||||
|
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if (x == 3 || x == 4) {
|
||||||
if (page>1) {
|
if ( y == 7 && toolsPage>1)
|
||||||
core.ui.drawToolbox(core.status.event.selection-12);
|
core.status.event.data.toolsPage--;
|
||||||
}
|
if ( y == 12 && constantsPage>1)
|
||||||
|
core.status.event.data.constantsPage--;
|
||||||
|
core.ui.drawToolbox(core.status.event.selection)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == 8 || x == 9)) {
|
||||||
var toolPage = Math.ceil(Object.keys(core.status.hero.items.tools).length/12),
|
if (( y == 7 && toolsPage<Math.ceil(Object.keys(core.status.hero.items.tools).length/12)))
|
||||||
constantPage = Math.ceil(Object.keys(core.status.hero.items.constants).length/12);
|
core.status.event.data.toolsPage++;
|
||||||
if (page<toolPage) {
|
if ( y == 12 && constantsPage<Math.ceil(Object.keys(core.status.hero.items.constants).length/12))
|
||||||
core.ui.drawToolbox(12*page);
|
core.status.event.data.constantsPage++;
|
||||||
}
|
core.ui.drawToolbox(core.status.event.selection);
|
||||||
else if (page<constantPage) {
|
|
||||||
core.ui.drawToolbox(1000+12*page);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index=parseInt(12*(page-1)+x/2);
|
var index=parseInt(x/2);;
|
||||||
if (y==4) index+=0;
|
if (y==4) index+=0;
|
||||||
else if (y==6) index+=6;
|
else if (y==6) index+=6;
|
||||||
else if (y==9) index+=1000;
|
else if (y==9) index+=12;
|
||||||
else if (y==11) index+=1006;
|
else if (y==11) index+=18;
|
||||||
else index=-1;
|
else index =-1;
|
||||||
|
|
||||||
if (index>=0)
|
if (index>=0)
|
||||||
this.clickToolboxIndex(index);
|
this.clickToolboxIndex(index);
|
||||||
@ -1282,17 +1279,19 @@ actions.prototype.clickToolbox = function(x,y) {
|
|||||||
////// 选择工具栏界面中某个Index后的操作 //////
|
////// 选择工具栏界面中某个Index后的操作 //////
|
||||||
actions.prototype.clickToolboxIndex = function(index) {
|
actions.prototype.clickToolboxIndex = function(index) {
|
||||||
var items = null;
|
var items = null;
|
||||||
var ii=index;
|
var select;
|
||||||
if (ii<1000)
|
if (index<12) {
|
||||||
|
select = index + 12 * (core.status.event.data.toolsPage-1);
|
||||||
items = Object.keys(core.status.hero.items.tools).sort();
|
items = Object.keys(core.status.hero.items.tools).sort();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ii-=1000;
|
select = index%12 + 12 * (core.status.event.data.constantsPage-1);
|
||||||
items = Object.keys(core.status.hero.items.constants).sort();
|
items = Object.keys(core.status.hero.items.constants).sort();
|
||||||
}
|
}
|
||||||
if (items==null) return;
|
if (items==null) return;
|
||||||
if (ii>=items.length) return;
|
if (select>=items.length) return;
|
||||||
var itemId=items[ii];
|
var itemId=items[select];
|
||||||
if (itemId==core.status.event.data) {
|
if (itemId==core.status.event.data.selectId) {
|
||||||
core.events.useItem(itemId);
|
core.events.useItem(itemId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1306,67 +1305,83 @@ actions.prototype.keyDownToolbox = function (keycode) {
|
|||||||
|
|
||||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||||
var constants = Object.keys(core.status.hero.items.constants).sort();
|
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||||
var index=core.status.event.selection;
|
var index = core.status.event.selection;
|
||||||
var page=parseInt(index%1000/12), offset=12*page;
|
var toolsPage = core.status.event.data.toolsPage;
|
||||||
|
var constantsPage = core.status.event.data.constantsPage;
|
||||||
|
var toolsTotalPage = Math.ceil(tools.length/12);
|
||||||
|
var constantsTotalPage = Math.ceil(constants.length/12);
|
||||||
|
|
||||||
if (keycode==37) { // left
|
if (keycode==37) { // left
|
||||||
if ((index>0 && index<1000) || index>1000) {
|
if (index==0) // 处理向前翻页
|
||||||
this.clickToolboxIndex(index-1);
|
if (toolsPage>1) {
|
||||||
return;
|
core.status.event.data.toolsPage--;
|
||||||
}
|
index = 11;
|
||||||
if (index==1000 && tools.length>0) {
|
}
|
||||||
this.clickToolboxIndex(tools.length-1);
|
else return; // 第一页不向前翻
|
||||||
return;
|
else if (index==12)
|
||||||
}
|
if (constantsPage>1) {
|
||||||
|
core.status.event.data.constantsPage--;
|
||||||
|
index = 23;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
else index -= 1 ;
|
||||||
|
this.clickToolboxIndex(index);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (keycode==38) { // up
|
if (keycode==38) { // up
|
||||||
if ((index>offset+5 && index<1000) || index>offset+1005) {
|
if (toolsPage==toolsTotalPage&&index<18&&index>11) { // 进入tools
|
||||||
this.clickToolboxIndex(index-6);
|
if (toolsTotalPage==0) return;
|
||||||
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;
|
||||||
if (index>=offset+1000 && index<=offset+1005) {
|
else index = tools.length%12-1;
|
||||||
if (tools.length>offset+6) {
|
|
||||||
this.clickToolboxIndex(Math.min(tools.length-1, index-1000+6));
|
|
||||||
}
|
|
||||||
else if (tools.length>offset) {
|
|
||||||
this.clickToolboxIndex(Math.min(tools.length-1, index-1000));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (index<6) return; // 第一行没有向上
|
||||||
|
else index -= 6;
|
||||||
|
this.clickToolboxIndex(index);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (keycode==39) { // right
|
if (keycode==39) { // right
|
||||||
if ((index<tools.length-1) || (index>=1000 && index<constants.length+1000)) {
|
if (toolsPage<toolsTotalPage && index==11) {
|
||||||
this.clickToolboxIndex(index+1);
|
core.status.event.data.toolsPage++;
|
||||||
return;
|
index = 0;
|
||||||
}
|
}
|
||||||
if (index==tools.length-1 && constants.length>0) {
|
else if (constantsPage<constantsTotalPage && index==23) {
|
||||||
this.clickToolboxIndex(1000);
|
core.status.event.data.constantsPage++;
|
||||||
return;
|
index = 12;
|
||||||
}
|
}
|
||||||
|
else if((toolsPage==toolsTotalPage && index==tools.length%12-1) ||
|
||||||
|
(constantsPage==constantsTotalPage && index==constants.length%12+11)) // 一个物品无操作
|
||||||
|
return;
|
||||||
|
else index +=1;
|
||||||
|
this.clickToolboxIndex(index);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (keycode==40) { // down
|
if (keycode==40) { // down
|
||||||
if (index<=offset+5) {
|
if ((index>5 || (toolsPage==toolsTotalPage && tools.length%12<=6)) && index<12) {// 进入constant
|
||||||
if (tools.length>offset+6) {
|
if (constantsTotalPage == 0) return;
|
||||||
this.clickToolboxIndex(Math.min(tools.length-1, index+6));
|
if (constantsTotalPage == constantsPage && constants.length%12<(index%6+1))
|
||||||
}
|
index = constants.length%12+11;
|
||||||
else if (constants.length>offset) {
|
else if (index<6) index += 12;
|
||||||
this.clickToolboxIndex(1000+Math.min(constants.length-1, index));
|
else index += 6;
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (index>offset+5 && index<offset+1000 && constants.length>offset) {
|
|
||||||
this.clickToolboxIndex(1000+Math.min(constants.length-1, index-6));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (index>=offset+1000 && index<=offset+1005 && constants.length>offset+6) {
|
|
||||||
this.clickToolboxIndex(Math.min(1000+constants.length-1, index+6));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 工具栏界面时,放开某个键的操作 //////
|
////// 工具栏界面时,放开某个键的操作 //////
|
||||||
actions.prototype.keyUpToolbox = function (keycode) {
|
actions.prototype.keyUpToolbox = function (keycode) {
|
||||||
|
if (keycode==81){
|
||||||
|
core.ui.closePanel();
|
||||||
|
core.openEquipbox();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (keycode==84 || keycode==27 || keycode==88) {
|
if (keycode==84 || keycode==27 || keycode==88) {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return;
|
return;
|
||||||
@ -1410,12 +1425,13 @@ actions.prototype.clickEquipbox = function(x,y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 当前页面
|
// 当前页面
|
||||||
var page = parseInt((core.status.event.selection%1000)/12)+1;
|
var page = core.status.event.data.page;
|
||||||
|
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if ((x == 3 || x == 4) && y == 12) {
|
||||||
if (page>1) {
|
if (page>1) {
|
||||||
core.ui.drawEquipbox(core.status.event.selection-12);
|
core.status.event.data.page--;
|
||||||
|
core.ui.drawEquipbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1423,17 +1439,17 @@ actions.prototype.clickEquipbox = function(x,y) {
|
|||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == 8 || x == 9) && y == 12) {
|
||||||
var lastPage = Math.ceil(Object.keys(core.status.hero.items.equips).length/12);
|
var lastPage = Math.ceil(Object.keys(core.status.hero.items.equips).length/12);
|
||||||
if (page<lastPage)
|
if (page<lastPage)
|
||||||
core.ui.drawEquipbox(1000+12*page);
|
core.status.event.data.page++;
|
||||||
|
core.ui.drawEquipbox(core.status.event.selection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index;
|
var index;
|
||||||
if (y<7) index=parseInt(x/4);
|
index=parseInt(x/2);
|
||||||
else index=parseInt(12*(page-1)+x/2);
|
|
||||||
if (y==4) index+=0;
|
if (y==4) index+=0;
|
||||||
else if (y==6) index+=3;
|
else if (y==6) index+=6;
|
||||||
else if (y==9) index+=1000;
|
else if (y==9) index+=12;
|
||||||
else if (y==11) index+=1006;
|
else if (y==11) index+=18;
|
||||||
else index=-1;
|
else index=-1;
|
||||||
|
|
||||||
if (index>=0)
|
if (index>=0)
|
||||||
@ -1442,7 +1458,7 @@ actions.prototype.clickEquipbox = function(x,y) {
|
|||||||
|
|
||||||
////// 选择装备栏界面中某个Index后的操作 //////
|
////// 选择装备栏界面中某个Index后的操作 //////
|
||||||
actions.prototype.clickEquipboxIndex = function(index) {
|
actions.prototype.clickEquipboxIndex = function(index) {
|
||||||
if (index<1000) {
|
if (index<12) {
|
||||||
if (index>=core.status.hero.equipment.length) return;
|
if (index>=core.status.hero.equipment.length) return;
|
||||||
if (index==core.status.event.selection && core.status.hero.equipment[index] != "blank") {
|
if (index==core.status.event.selection && core.status.hero.equipment[index] != "blank") {
|
||||||
core.unloadEquip(index);
|
core.unloadEquip(index);
|
||||||
@ -1452,9 +1468,9 @@ actions.prototype.clickEquipboxIndex = function(index) {
|
|||||||
var equips = null;
|
var equips = null;
|
||||||
equips = Object.keys(core.status.hero.items.equips).sort();
|
equips = Object.keys(core.status.hero.items.equips).sort();
|
||||||
if (equips==null) return;
|
if (equips==null) return;
|
||||||
if (index>=equips.length+1000) return;
|
if (index>=equips.length+12) return;
|
||||||
if (index==core.status.event.selection) {
|
if (index==core.status.event.selection) {
|
||||||
var equipId = equips[index-1000];
|
var equipId = equips[index-12];
|
||||||
core.loadEquip(equipId);
|
core.loadEquip(equipId);
|
||||||
equips = Object.keys(core.status.hero.items.equips).sort();
|
equips = Object.keys(core.status.hero.items.equips).sort();
|
||||||
if ( equips.length == 0)
|
if ( equips.length == 0)
|
||||||
@ -1468,10 +1484,75 @@ actions.prototype.clickEquipboxIndex = function(index) {
|
|||||||
actions.prototype.keyDownEquipbox = function (keycode) {
|
actions.prototype.keyDownEquipbox = function (keycode) {
|
||||||
if (!core.isset(core.status.event.data)) return;
|
if (!core.isset(core.status.event.data)) return;
|
||||||
|
|
||||||
|
var equipCapacity = core.status.hero.equipment.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);
|
||||||
|
|
||||||
|
if (keycode==37) { // left
|
||||||
|
if (index==0) return;
|
||||||
|
if (index==12)
|
||||||
|
if (page>1) {
|
||||||
|
core.status.event.data.page--;
|
||||||
|
index = 23;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
else if (index<3) return; // 第一行没有向上
|
||||||
|
else if (index<12) index -= 3;
|
||||||
|
else index -= 6;
|
||||||
|
this.clickEquipboxIndex(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==39) { // right
|
||||||
|
if (page<totalPage && index==23) {
|
||||||
|
core.status.event.data.page++;
|
||||||
|
index = 12;
|
||||||
|
}
|
||||||
|
else if (index==equipCapacity-1 && totalPage>0)
|
||||||
|
index = 12;
|
||||||
|
else if (page==totalPage && index==ownEquipment.length%12+11)
|
||||||
|
return;
|
||||||
|
else index += 1;
|
||||||
|
this.clickEquipboxIndex(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==40) { // down
|
||||||
|
if ((index>2 || equipCapacity<=3) && index<12) {// 进入拥有装备
|
||||||
|
index = (index%3)*2+13;
|
||||||
|
if (totalPage == 0) return;
|
||||||
|
if (totalPage == page && ownEquipment.length%12<(index%6+1))
|
||||||
|
index = ownEquipment.length%12+11;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
this.clickEquipboxIndex(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*if (!core.isset(core.status.event.data)) return;
|
||||||
|
|
||||||
var equipCapacity = core.status.hero.equipment.length;
|
var equipCapacity = core.status.hero.equipment.length;
|
||||||
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
||||||
var index=core.status.event.selection;
|
var index=core.status.event.selection;
|
||||||
var page=parseInt(index%1000/12), offset=12*page;
|
var offset=12*(core.status.event.data.page-1);
|
||||||
|
|
||||||
if (keycode==37) { // left
|
if (keycode==37) { // left
|
||||||
if ((index>0 && index<1000) || index>1000) {
|
if ((index>0 && index<1000) || index>1000) {
|
||||||
@ -1535,7 +1616,7 @@ actions.prototype.keyDownEquipbox = function (keycode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 装备栏界面时,放开某个键的操作 //////
|
////// 装备栏界面时,放开某个键的操作 //////
|
||||||
@ -1549,7 +1630,7 @@ actions.prototype.keyUpEquipbox = function (keycode) {
|
|||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!core.isset(core.status.event.data)) return;
|
if (!core.isset(core.status.event.data.selectId)) return;
|
||||||
|
|
||||||
if (keycode==13 || keycode==32 || keycode==67) {
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
this.clickEquipboxIndex(core.status.event.selection);
|
this.clickEquipboxIndex(core.status.event.selection);
|
||||||
|
|||||||
@ -1945,35 +1945,49 @@ control.prototype.replay = function () {
|
|||||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||||
var constants = Object.keys(core.status.hero.items.constants).sort();
|
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||||
var index;
|
var index;
|
||||||
if ((index=tools.indexOf(itemId))>=0 || (index=constants.indexOf(itemId)+1000)>=1000) {
|
if ((index=tools.indexOf(itemId))>=0) {
|
||||||
core.ui.drawToolbox(index);
|
core.status.event.data = {"toolsPage":Math.floor(index/12)+1, "constantsPage":1, "selectId":null}
|
||||||
|
index = index%12;
|
||||||
|
}
|
||||||
|
else if (index=constants.indexOf(itemId)>=0) {
|
||||||
|
core.status.event.data = {"toolsPage":1, "constantsPage":Math.floor(index/12)+1, "selectId":null}
|
||||||
|
index = index%12+12;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
core.ui.drawToolbox(index);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.useItem(itemId, function () {
|
core.useItem(itemId, function () {
|
||||||
core.replay();
|
core.replay();
|
||||||
});
|
});
|
||||||
}, 750 / Math.max(1, core.status.replay.speed));
|
}, 750 / Math.max(1, core.status.replay.speed));
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action.indexOf("unEquip:")==0) {
|
else if (action.indexOf("unEquip:")==0) {
|
||||||
var equipId = action.substring(8);
|
var unloadEquipId = action.substring(8);
|
||||||
|
var equipType = core.material.items[unloadEquipId].equipType;
|
||||||
|
core.ui.drawEquipbox(equipType);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.unloadEquip(equipId, function () {
|
core.unloadEquip(equipType, function () {
|
||||||
core.replay();
|
core.replay();
|
||||||
});
|
});
|
||||||
}, 750 / Math.max(1, core.status.replay.speed));
|
}, 750 / Math.max(1, core.status.replay.speed));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (action.indexOf("equip:")==0) {
|
else if (action.indexOf("equip:")==0) {
|
||||||
var equipType = action.substring(6);
|
var equipId = action.substring(6);
|
||||||
|
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
||||||
|
var index = ownEquipment.indexOf(equipId);
|
||||||
|
core.status.event.data = {"page":Math.floor(index/12)+1, "selectId":null}
|
||||||
|
index = index%12+12;
|
||||||
|
core.ui.drawEquipbox(index);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.loadEquip(equipType, function () {
|
core.loadEquip(equipId, function () {
|
||||||
core.replay();
|
core.replay();
|
||||||
});
|
});
|
||||||
}, 750 / Math.max(1, core.status.replay.speed));
|
}, 750 / Math.max(1, core.status.replay.speed));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -829,8 +829,8 @@ core.prototype.hasItem = function (itemId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 是否装备某件装备 //////
|
////// 是否装备某件装备 //////
|
||||||
core.prototype.hasEquipment = function (itemId) {
|
core.prototype.hasEquip = function (equipId) {
|
||||||
return core.items.hasEquipment(itemId);
|
return core.items.hasEquip(equipId);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 设置某个物品的个数 //////
|
////// 设置某个物品的个数 //////
|
||||||
@ -863,6 +863,11 @@ core.prototype.unloadEquip = function (equipType, callback) {
|
|||||||
core.items.unloadEquip(equipType,callback);
|
core.items.unloadEquip(equipType,callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 比较某件装备与当前装备 //////
|
||||||
|
core.prototype.compareEquipment = function (equipId, beComparedEquipId) {
|
||||||
|
return core.items.compareEquipment(equipId, beComparedEquipId);
|
||||||
|
}
|
||||||
|
|
||||||
////// 增加某个物品的个数 //////
|
////// 增加某个物品的个数 //////
|
||||||
core.prototype.addItem = function (itemId, itemNum) {
|
core.prototype.addItem = function (itemId, itemNum) {
|
||||||
core.items.addItem(itemId, itemNum);
|
core.items.addItem(itemId, itemNum);
|
||||||
|
|||||||
@ -97,9 +97,8 @@ items.prototype.hasItem = function (itemId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 是否装备某件装备 //////
|
////// 是否装备某件装备 //////
|
||||||
items.prototype.hasEquipment = function (itemId) {
|
items.prototype.hasEquip = function (equipId) {
|
||||||
var equiptype = core.material.items[itemId].equiptype;
|
return core.status.hero.equipment.indexOf(equipId) != -1 ;
|
||||||
return core.status.hero.equipment[equiptype] == itemId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 设置某个物品的个数 //////
|
////// 设置某个物品的个数 //////
|
||||||
@ -151,27 +150,17 @@ items.prototype.addItem = function (itemId, itemNum) {
|
|||||||
items.prototype.loadEquip = function (equipId, callback) {
|
items.prototype.loadEquip = function (equipId, callback) {
|
||||||
|
|
||||||
core.playSound('equip.mp3');
|
core.playSound('equip.mp3');
|
||||||
|
|
||||||
var loadEquip = core.material.items[equipId];
|
var loadEquip = core.material.items[equipId];
|
||||||
var loadEquipType = loadEquip.equipType;
|
var loadEquipType = loadEquip.equipType;
|
||||||
var unloadEquipId = core.status.hero.equipment[loadEquipType];
|
var unloadEquipId = core.status.hero.equipment[loadEquipType];
|
||||||
var unloadEquip = core.material.items[unloadEquipId];
|
|
||||||
|
// 比较能力值
|
||||||
// 处理能力值改变
|
var result = core.compareEquipment(equipId,unloadEquipId);
|
||||||
if (core.isset(loadEquip.equipEffect.atk))
|
|
||||||
core.status.hero.atk += loadEquip.equipEffect.atk
|
core.status.hero.atk += result.atk;
|
||||||
if (core.isset(loadEquip.equipEffect.def))
|
core.status.hero.def += result.def;
|
||||||
core.status.hero.def += loadEquip.equipEffect.def
|
core.status.hero.mdef += result.mdef;
|
||||||
if (core.isset(loadEquip.equipEffect.mdef))
|
|
||||||
core.status.hero.mdef += loadEquip.equipEffect.mdef
|
|
||||||
if (unloadEquip.cls != "blank") {
|
|
||||||
if (core.isset(unloadEquip.equipEffect.atk))
|
|
||||||
core.status.hero.atk -= unloadEquip.equipEffect.atk
|
|
||||||
if (core.isset(unloadEquip.equipEffect.def))
|
|
||||||
core.status.hero.def -= unloadEquip.equipEffect.def
|
|
||||||
if (core.isset(unloadEquip.equipEffect.mdef))
|
|
||||||
core.status.hero.mdef -= unloadEquip.equipEffect.mdef
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新装备状态
|
// 更新装备状态
|
||||||
core.status.hero.equipment[loadEquipType] = equipId;
|
core.status.hero.equipment[loadEquipType] = equipId;
|
||||||
@ -215,10 +204,29 @@ items.prototype.unloadEquip = function (equipType, callback) {
|
|||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
|
|
||||||
// 记录路线
|
// 记录路线
|
||||||
core.status.route.push("unEquip:"+equipType);
|
core.status.route.push("unEquip:"+unloadEquipId);
|
||||||
|
|
||||||
// 装备更换完毕:增加卸下的装备
|
// 装备更换完毕:增加卸下的装备
|
||||||
core.addItem(unloadEquipId, 1);
|
core.addItem(unloadEquipId, 1);
|
||||||
|
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
|
||||||
|
var compareEquip = core.material.items[compareEquipId];
|
||||||
|
var beComparedEquip = core.material.items[beComparedEquipId];
|
||||||
|
var compareAtk = 0, compareDef = 0, compareMdef = 0;
|
||||||
|
if (core.isset(compareEquip.equipEffect.atk))
|
||||||
|
compareAtk += compareEquip.equipEffect.atk;
|
||||||
|
if (core.isset(compareEquip.equipEffect.def))
|
||||||
|
compareDef += compareEquip.equipEffect.def;
|
||||||
|
if (core.isset(compareEquip.equipEffect.mdef))
|
||||||
|
compareMdef += compareEquip.equipEffect.mdef;
|
||||||
|
if (core.isset(beComparedEquip.equipEffect.atk))
|
||||||
|
compareAtk -= beComparedEquip.equipEffect.atk;
|
||||||
|
if (core.isset(beComparedEquip.equipEffect.def))
|
||||||
|
compareDef -= beComparedEquip.equipEffect.def;
|
||||||
|
if (core.isset(beComparedEquip.equipEffect.mdef))
|
||||||
|
compareMdef -= beComparedEquip.equipEffect.mdef;
|
||||||
|
return {"atk":compareAtk,"def":compareDef,"mdef":compareMdef};
|
||||||
}
|
}
|
||||||
205
libs/ui.js
205
libs/ui.js
@ -1205,7 +1205,8 @@ ui.prototype.drawReplay = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制分页 //////
|
////// 绘制分页 //////
|
||||||
ui.prototype.drawPagination = function (page, totalPage) {
|
ui.prototype.drawPagination = function (page, totalPage, top) {
|
||||||
|
if (totalPage <= 1) return;
|
||||||
|
|
||||||
core.setFont('ui', 'bold 15px Verdana');
|
core.setFont('ui', 'bold 15px Verdana');
|
||||||
core.setFillStyle('ui', '#DDDDDD');
|
core.setFillStyle('ui', '#DDDDDD');
|
||||||
@ -1213,17 +1214,13 @@ ui.prototype.drawPagination = function (page, totalPage) {
|
|||||||
var length = core.canvas.ui.measureText(page + " / " + page).width;
|
var length = core.canvas.ui.measureText(page + " / " + page).width;
|
||||||
|
|
||||||
core.canvas.ui.textAlign = 'left';
|
core.canvas.ui.textAlign = 'left';
|
||||||
core.fillText('ui', page + " / " + totalPage, parseInt((416 - length) / 2), 403);
|
core.fillText('ui', page + " / " + totalPage, parseInt((416 - length) / 2), top*32+19);
|
||||||
|
|
||||||
core.canvas.ui.textAlign = 'center';
|
core.canvas.ui.textAlign = 'center';
|
||||||
if (page > 1)
|
if (page > 1)
|
||||||
core.fillText('ui', '上一页', 208 - 80, 403);
|
core.fillText('ui', '上一页', 208 - 80, top*32+19);
|
||||||
if (page < totalPage)
|
if (page < totalPage)
|
||||||
core.fillText('ui', '下一页', 208 + 80, 403);
|
core.fillText('ui', '下一页', 208 + 80, top*32+19);
|
||||||
|
|
||||||
// 退出
|
|
||||||
core.fillText('ui', '返回游戏', 370, 403);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制键盘光标 //////
|
////// 绘制键盘光标 //////
|
||||||
@ -1391,7 +1388,9 @@ ui.prototype.drawBook = function (index) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
core.drawBoxAnimate();
|
core.drawBoxAnimate();
|
||||||
this.drawPagination(page, totalPage);
|
this.drawPagination(page, totalPage, 12);
|
||||||
|
// 退出
|
||||||
|
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制怪物属性的详细信息 //////
|
////// 绘制怪物属性的详细信息 //////
|
||||||
@ -1583,35 +1582,45 @@ ui.prototype.drawMaps = function (index, x, y) {
|
|||||||
|
|
||||||
////// 绘制道具栏 //////
|
////// 绘制道具栏 //////
|
||||||
ui.prototype.drawToolbox = function(index) {
|
ui.prototype.drawToolbox = function(index) {
|
||||||
|
// 设定eventdata
|
||||||
|
if (!core.isset(core.status.event.data))
|
||||||
|
core.status.event.data = {"toolsPage":1, "constantsPage":1, "selectId":null}
|
||||||
|
|
||||||
|
// 获取物品列表
|
||||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||||
var constants = Object.keys(core.status.hero.items.constants).sort();
|
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||||
|
|
||||||
|
// 处理页数
|
||||||
|
var toolsPage = core.status.event.data.toolsPage;
|
||||||
|
var constantsPage = core.status.event.data.constantsPage;
|
||||||
|
var toolsTotalPage = Math.ceil(tools.length/12);
|
||||||
|
var constantsTotalPage = Math.ceil(constants.length/12);
|
||||||
|
|
||||||
|
// 处理index
|
||||||
if (!core.isset(index)) {
|
if (!core.isset(index)) {
|
||||||
if (tools.length>0) index=0;
|
if (tools.length>0) index=0;
|
||||||
else if (constants.length>0) index=1000;
|
else if (constants.length>0) index=12;
|
||||||
else index=0;
|
else index=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.status.event.selection=index;
|
core.status.event.selection=index;
|
||||||
|
|
||||||
|
// 确认选择对象
|
||||||
|
var select;
|
||||||
var selectId;
|
var selectId;
|
||||||
if (index<1000) {
|
if (index<12) {
|
||||||
if (index>=tools.length) index=Math.max(0, tools.length-1);
|
select = index + (toolsPage-1)*12;
|
||||||
selectId = tools[index];
|
if (select>=tools.length) select=Math.max(0, tools.length-1);
|
||||||
|
selectId = tools[select];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (index-1000>=constants.length) index=1000+Math.max(0, constants.length-1);
|
select = index%12 + (constantsPage-1)*12;
|
||||||
selectId = constants[index-1000];
|
if (select>=constants.length) select=Math.max(0, constants.length-1);
|
||||||
|
selectId = constants[select];
|
||||||
}
|
}
|
||||||
|
|
||||||
var page = parseInt((index%1000)/12)+1;
|
|
||||||
var totalPage = Math.ceil(Math.max(tools.length, constants.length)/12);
|
|
||||||
|
|
||||||
if (!core.hasItem(selectId)) selectId=null;
|
if (!core.hasItem(selectId)) selectId=null;
|
||||||
|
core.status.event.data.selectId=selectId;
|
||||||
|
|
||||||
core.status.event.data=selectId;
|
// 绘制
|
||||||
|
|
||||||
core.clearMap('ui');
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
@ -1673,52 +1682,38 @@ ui.prototype.drawToolbox = function(index) {
|
|||||||
|
|
||||||
core.canvas.ui.textAlign = 'right';
|
core.canvas.ui.textAlign = 'right';
|
||||||
var images = core.material.images.items;
|
var images = core.material.images.items;
|
||||||
// 消耗道具
|
|
||||||
|
|
||||||
|
// 消耗道具
|
||||||
for (var i=0;i<12;i++) {
|
for (var i=0;i<12;i++) {
|
||||||
var tool=tools[12*(page-1)+i];
|
var tool=tools[12*(toolsPage-1)+i];
|
||||||
if (!core.isset(tool)) break;
|
if (!core.isset(tool)) break;
|
||||||
var icon=core.material.icons.items[tool];
|
var icon=core.material.icons.items[tool];
|
||||||
if (i<6) {
|
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+1)+5, 144+5-ydelta, 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+1)+40, 144+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
if (selectId == tool)
|
||||||
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+1)+1, 144+1-ydelta, 40, 40, '#FFD700');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i-6)+1)+5, 144+64+5-ydelta, 32, 32)
|
|
||||||
// 个数
|
|
||||||
core.fillText('ui', core.itemCount(tool), 16*(4*(i-6)+1)+40, 144+64+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
|
||||||
if (selectId == tool)
|
|
||||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 144+64+1-ydelta, 40, 40, '#FFD700');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 永久道具
|
// 永久道具
|
||||||
for (var i=0;i<12;i++) {
|
for (var i=0;i<12;i++) {
|
||||||
var constant=constants[12*(page-1)+i];
|
var constant=constants[12*(constantsPage-1)+i];
|
||||||
if (!core.isset(constant)) break;
|
if (!core.isset(constant)) break;
|
||||||
var icon=core.material.icons.items[constant];
|
var icon=core.material.icons.items[constant];
|
||||||
if (i<6) {
|
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+1)+5, 304+5-ydelta, 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');
|
||||||
if (selectId == constant)
|
|
||||||
core.strokeRect('ui', 16*(4*i+1)+1, 304+1-ydelta, 40, 40, '#FFD700');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i-6)+1)+5, 304+64+5-ydelta, 32, 32)
|
|
||||||
if (selectId == constant)
|
|
||||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 304+64+1-ydelta, 40, 40, '#FFD700');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawPagination(page, totalPage);
|
// 分页
|
||||||
|
this.drawPagination(toolsPage, toolsTotalPage, 7);
|
||||||
|
this.drawPagination(constantsPage, constantsTotalPage, 12);
|
||||||
|
|
||||||
core.canvas.ui.textAlign = 'center';
|
core.canvas.ui.textAlign = 'center';
|
||||||
// 道具栏
|
|
||||||
|
// 装备栏
|
||||||
if (core.flags.equipment)
|
if (core.flags.equipment)
|
||||||
core.fillText('ui', '装备栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
core.fillText('ui', '装备栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
||||||
// core.fillText('ui', '删除道具', 370, 32,'#DDDDDD', 'bold 15px Verdana');
|
// core.fillText('ui', '删除道具', 370, 32,'#DDDDDD', 'bold 15px Verdana');
|
||||||
// 退出
|
// 退出
|
||||||
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||||
@ -1726,33 +1721,35 @@ ui.prototype.drawToolbox = function(index) {
|
|||||||
|
|
||||||
////// 绘制装备界面 //////
|
////// 绘制装备界面 //////
|
||||||
ui.prototype.drawEquipbox = function(index) {
|
ui.prototype.drawEquipbox = function(index) {
|
||||||
|
// 设定eventdata
|
||||||
|
if (!core.isset(core.status.event.data))
|
||||||
|
core.status.event.data = {"page":1, "selectId":null}
|
||||||
|
|
||||||
var equipEquipment = core.status.hero.equipment;
|
var equipEquipment = core.status.hero.equipment;
|
||||||
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
|
||||||
|
|
||||||
|
var page = core.status.event.data.page;
|
||||||
|
var totalPage = Math.ceil(ownEquipment.length/12);
|
||||||
|
|
||||||
|
// 处理index
|
||||||
if (!core.isset(index)) {
|
if (!core.isset(index)) {
|
||||||
if (equipEquipment.length>0) index=0;
|
if (equipEquipment.length>0) index=0;
|
||||||
else if (ownEquipment.length>0) index=1000;
|
else if (ownEquipment.length>0) index=12;
|
||||||
else index=0;
|
else index=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.status.event.selection=index;
|
core.status.event.selection=index;
|
||||||
|
|
||||||
var selectId;
|
var selectId;
|
||||||
if (index<1000) {
|
if (index<12) {
|
||||||
if (index>=equipEquipment.length) index=Math.max(0, equipEquipment.length-1);
|
if (index>=equipEquipment.length) index=Math.max(0, equipEquipment.length-1);
|
||||||
selectId = equipEquipment[index];
|
selectId = equipEquipment[index];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (index-1000>=ownEquipment.length) index=1000+Math.max(0, ownEquipment.length-1);
|
if (index-12>=ownEquipment.length) index=12+Math.max(0, ownEquipment.length-1);
|
||||||
selectId = ownEquipment[index-1000];
|
selectId = ownEquipment[index-12];
|
||||||
if (!core.hasItem(selectId)) selectId=null;
|
if (!core.hasItem(selectId)) selectId=null;
|
||||||
}
|
}
|
||||||
|
core.status.event.data.selectId=selectId;
|
||||||
var page = parseInt((index%1000)/12)+1;
|
|
||||||
var totalPage = Math.ceil(ownEquipment.length/12);
|
|
||||||
|
|
||||||
core.status.event.data=selectId;
|
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui', 0, 0, 416, 416);
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
@ -1804,14 +1801,60 @@ ui.prototype.drawEquipbox = function(index) {
|
|||||||
var text = equip.text||"该装备暂无描述。";
|
var text = equip.text||"该装备暂无描述。";
|
||||||
var lines = core.splitLines('ui', text, 406, '17px Verdana');
|
var lines = core.splitLines('ui', text, 406, '17px Verdana');
|
||||||
|
|
||||||
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');
|
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');
|
||||||
|
|
||||||
|
// 比较属性
|
||||||
if (lines.length==1) {
|
if (lines.length==1) {
|
||||||
if (index<1000) {
|
var compare;
|
||||||
core.fillText('ui', '<继续点击该装备即可卸下>', 10, 89, '#CCCCCC', '14px Verdana');
|
if (index<12) compare = core.compareEquipment("blank", selectId);
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
core.fillText('ui', '<继续点击该装备即可换上>', 10, 89, '#CCCCCC', '14px Verdana');
|
compare = core.compareEquipment(selectId, equipEquipment[equip.equipType]);
|
||||||
|
}
|
||||||
|
// 绘制
|
||||||
|
var drawList; //= [['攻击',atk],['防御',def],['魔防',mdef]];var draw;
|
||||||
|
var drawPointer = 0;
|
||||||
|
var color;
|
||||||
|
/*for (var printer = 0; printer<drawList.length; printer++)
|
||||||
|
if (compare[drawList[printer][1]]!=0) {
|
||||||
|
if (compare[printer]>0)
|
||||||
|
color = '#00FF00'
|
||||||
|
else color = '#FF0000'
|
||||||
|
draw = drawList[printer][0]+' '+core.status.hero[drawList[printer][1]]+'->'+(core.status.hero[drawList[printer][1]]+compare[drawList[printer][1]])+' ';
|
||||||
|
drawPointer += draw.length;
|
||||||
|
core.fillText('ui', draw, 10+drawPointer, 89, color, '14px Verdana');
|
||||||
|
}*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1848,19 +1891,15 @@ ui.prototype.drawEquipbox = function(index) {
|
|||||||
var ownEquip=ownEquipment[12*(page-1)+i];
|
var ownEquip=ownEquipment[12*(page-1)+i];
|
||||||
if (!core.isset(ownEquip)) break;
|
if (!core.isset(ownEquip)) break;
|
||||||
var icon=core.material.icons.items[ownEquip];
|
var icon=core.material.icons.items[ownEquip];
|
||||||
if (i<6) {
|
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+1)+5, 304+5-ydelta, 32, 32)
|
// 个数
|
||||||
if (selectId == ownEquip)
|
if (core.itemCount(ownEquip)>1)
|
||||||
core.strokeRect('ui', 16*(4*i+1)+1, 304+1-ydelta, 40, 40, '#FFD700');
|
core.fillText('ui', core.itemCount(ownEquip), 16*(4*(i%6)+1)+40, 304+Math.floor(i/6)*64+38-ydelta, '#FFFFFF', "bold 14px Verdana");
|
||||||
}
|
if (selectId == ownEquip)
|
||||||
else {
|
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 304+Math.floor(i/6)*64+1-ydelta, 40, 40, '#FFD700');
|
||||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i-6)+1)+5, 304+64+5-ydelta, 32, 32)
|
|
||||||
if (selectId == ownEquip)
|
|
||||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 304+64+1-ydelta, 40, 40, '#FFD700');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawPagination(page, totalPage);
|
this.drawPagination(page, totalPage, 12);
|
||||||
// 道具栏
|
// 道具栏
|
||||||
core.canvas.ui.textAlign = 'center';
|
core.canvas.ui.textAlign = 'center';
|
||||||
core.fillText('ui', '道具栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
core.fillText('ui', '道具栏', 370, 19,'#DDDDDD', 'bold 15px Verdana');
|
||||||
@ -1951,7 +1990,9 @@ ui.prototype.drawSLPanel = function(index, refresh) {
|
|||||||
}
|
}
|
||||||
else drawAll();
|
else drawAll();
|
||||||
|
|
||||||
this.drawPagination(page+1, max_page);
|
this.drawPagination(page+1, max_page, 12);
|
||||||
|
// 退出
|
||||||
|
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||||
|
|
||||||
if (core.status.event.selection)
|
if (core.status.event.selection)
|
||||||
core.setFillStyle('ui', '#FF6A6A');
|
core.setFillStyle('ui', '#FF6A6A');
|
||||||
|
|||||||
@ -324,6 +324,10 @@ utils.prototype.encodeRoute = function (route) {
|
|||||||
}
|
}
|
||||||
if (t.indexOf('item:')==0)
|
if (t.indexOf('item:')==0)
|
||||||
ans+="I"+t.substring(5)+":";
|
ans+="I"+t.substring(5)+":";
|
||||||
|
else if (t.indexOf('unEquip:')==0)
|
||||||
|
ans+="u"+t.substring(8)+":";
|
||||||
|
else if (t.indexOf('equip:')==0)
|
||||||
|
ans+="e"+t.substring(6)+":";
|
||||||
else if (t.indexOf('fly:')==0)
|
else if (t.indexOf('fly:')==0)
|
||||||
ans+="F"+t.substring(4)+":";
|
ans+="F"+t.substring(4)+":";
|
||||||
else if (t.indexOf('choices:')==0)
|
else if (t.indexOf('choices:')==0)
|
||||||
@ -383,7 +387,7 @@ utils.prototype.decodeRoute = function (route) {
|
|||||||
|
|
||||||
while (index<route.length) {
|
while (index<route.length) {
|
||||||
var c=route.charAt(index++);
|
var c=route.charAt(index++);
|
||||||
var nxt=(c=='I'||c=='F'||c=='S'||c=='Q'||c=='t')?getString():getNumber();
|
var nxt=(c=='I'|| c=='u' || c=='e' ||c=='F'||c=='S'||c=='Q'||c=='t')?getString():getNumber();
|
||||||
|
|
||||||
var mp = {
|
var mp = {
|
||||||
"U": "up",
|
"U": "up",
|
||||||
@ -395,6 +399,8 @@ utils.prototype.decodeRoute = function (route) {
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
case "U": case "D": case "L": case "R": for (var i=0;i<nxt;i++) ans.push(mp[c]); break;
|
case "U": case "D": case "L": case "R": for (var i=0;i<nxt;i++) ans.push(mp[c]); break;
|
||||||
case "I": ans.push("item:"+nxt); break;
|
case "I": ans.push("item:"+nxt); break;
|
||||||
|
case "u": ans.push("unEquip:"+nxt); break;
|
||||||
|
case "e": ans.push("equip:"+nxt); break;
|
||||||
case "F": ans.push("fly:"+nxt); break;
|
case "F": ans.push("fly:"+nxt); break;
|
||||||
case "C": ans.push("choices:"+nxt); break;
|
case "C": ans.push("choices:"+nxt); break;
|
||||||
case "S": ans.push("shop:"+nxt+":"+getNumber(true)); break;
|
case "S": ans.push("shop:"+nxt+":"+getNumber(true)); break;
|
||||||
|
|||||||
@ -273,6 +273,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"cls": "blank",
|
"cls": "blank",
|
||||||
"name": " ",
|
"name": " ",
|
||||||
"text": " ",
|
"text": " ",
|
||||||
|
"equipEffect": {},
|
||||||
"animate": "hand"
|
"animate": "hand"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user