Merge branch 'refactoring-editor' of https://github.com/zhaouv/mota-js into refactoring-editor
This commit is contained in:
commit
8b6ef9f0d3
@ -65,6 +65,7 @@ return code;
|
|||||||
|
|
||||||
shoplist
|
shoplist
|
||||||
: shopsub
|
: shopsub
|
||||||
|
| shopcommonevent
|
||||||
| emptyshop
|
| emptyshop
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -77,6 +78,24 @@ var code = ' \n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
shopcommonevent
|
||||||
|
: '商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' EvalString?
|
||||||
|
|
||||||
|
/* shopcommonevent
|
||||||
|
tooltip : 全局商店, 执行一个公共事件
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/
|
||||||
|
default : ["shop1","回收钥匙商店",false,"回收钥匙商店",""]
|
||||||
|
var code = {
|
||||||
|
'id': IdString_0,
|
||||||
|
'textInList': EvalString_0,
|
||||||
|
'mustEnable': Bool_0,
|
||||||
|
'commonEvent': EvalString_1,
|
||||||
|
'args': EvalString_2
|
||||||
|
}
|
||||||
|
code=JSON.stringify(code,null,2)+',\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
shopsub
|
shopsub
|
||||||
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
|
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
|
||||||
|
|
||||||
@ -303,6 +322,7 @@ action
|
|||||||
| callBook_s
|
| callBook_s
|
||||||
| callSave_s
|
| callSave_s
|
||||||
| callLoad_s
|
| callLoad_s
|
||||||
|
| unknow_s
|
||||||
| function_s
|
| function_s
|
||||||
| pass_s
|
| pass_s
|
||||||
;
|
;
|
||||||
@ -1726,6 +1746,19 @@ var code = '{"type": "callLoad"},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
unknow_s
|
||||||
|
: '自定义事件' BGNL? RawEvalString
|
||||||
|
|
||||||
|
/* unknow_s
|
||||||
|
tooltip : 通过脚本自定义的事件类型, 以及编辑器不识别的事件类型
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/
|
||||||
|
default : ['{"type":"eventType1"}']
|
||||||
|
colour : this.dataColor
|
||||||
|
var tempobj={};
|
||||||
|
eval("tempobj='"+RawEvalString_0+"'");
|
||||||
|
var code = tempobj +',\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
function_s
|
function_s
|
||||||
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
|
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
|
||||||
@ -2114,10 +2147,21 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
|
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
var buildcommentevent = function(obj,parser,next){
|
||||||
|
return MotaActionBlocks['shopcommonevent'].xmlText([
|
||||||
|
obj.id,parser.EvalString(obj.textInList),obj.mustEnable,parser.EvalString(obj.commonEvent),parser.EvalString(obj.args),next
|
||||||
|
]);
|
||||||
|
}
|
||||||
var next=null;
|
var next=null;
|
||||||
if(!obj)obj=[];
|
if(!obj)obj=[];
|
||||||
while(obj.length){
|
while(obj.length){
|
||||||
next=buildsub(obj.pop(),this,next);
|
var shopobj=obj.pop()
|
||||||
|
if(shopobj.choices)
|
||||||
|
next=buildsub(shopobj,this,next);
|
||||||
|
else if(shopobj.commonEvent)
|
||||||
|
next=buildcommentevent(shopobj,this,next);
|
||||||
|
else
|
||||||
|
throw new Error("[警告]出错啦!\n"+shopobj.id+" 无效的商店");
|
||||||
}
|
}
|
||||||
return MotaActionBlocks['shop_m'].xmlText([next]);
|
return MotaActionBlocks['shop_m'].xmlText([next]);
|
||||||
|
|
||||||
@ -2607,7 +2651,13 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
case "animateImage": // 兼容 animateImage
|
case "animateImage": // 兼容 animateImage
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持...");
|
var rawdata = JSON.stringify(data,function(k,v){
|
||||||
|
if(typeof(v)=='string')return v.split('\n').join('\\n');
|
||||||
|
else return v;
|
||||||
|
},2);
|
||||||
|
rawdata=rawdata.split('\n').join('\\n');
|
||||||
|
this.next = MotaActionBlocks['unknow_s'].xmlText([
|
||||||
|
rawdata,this.next]);
|
||||||
}
|
}
|
||||||
this.parseAction();
|
this.parseAction();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -227,8 +227,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"openDoor",
|
"openDoor",
|
||||||
"passNet",
|
"passNet",
|
||||||
"changeLight",
|
"changeLight",
|
||||||
"ski",
|
"pushBox",
|
||||||
"pushBox"
|
"custom"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"_data": "该图块的默认触发器"
|
"_data": "该图块的默认触发器"
|
||||||
|
|||||||
@ -37,6 +37,11 @@ editor_blockly = function () {
|
|||||||
{"text": "防御+4", "effect": "status:def+=4"},
|
{"text": "防御+4", "effect": "status:def+=4"},
|
||||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||||
]
|
]
|
||||||
|
},{
|
||||||
|
"id": "keyShop1",
|
||||||
|
"textInList": "回收钥匙商店",
|
||||||
|
"commonEvent": "回收钥匙商店",
|
||||||
|
"args": ""
|
||||||
}],'shop'),
|
}],'shop'),
|
||||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||||
@ -583,6 +588,7 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
'showTextImage_s': 'EvalString_0',
|
'showTextImage_s': 'EvalString_0',
|
||||||
'function_s': 'RawEvalString_0',
|
'function_s': 'RawEvalString_0',
|
||||||
'shopsub': 'EvalString_3',
|
'shopsub': 'EvalString_3',
|
||||||
|
'unknow_s': 'RawEvalString_0',
|
||||||
}
|
}
|
||||||
var f = b ? textStringDict[b.type] : null;
|
var f = b ? textStringDict[b.type] : null;
|
||||||
if (f) {
|
if (f) {
|
||||||
|
|||||||
376
libs/actions.js
376
libs/actions.js
@ -686,8 +686,9 @@ actions.prototype._sys_onmousewheel = function (direct) {
|
|||||||
|
|
||||||
// 存读档
|
// 存读档
|
||||||
if (core.status.lockControl && (core.status.event.id == 'save' || core.status.event.id == 'load')) {
|
if (core.status.lockControl && (core.status.event.id == 'save' || core.status.event.id == 'load')) {
|
||||||
if (direct == 1) core.ui.drawSLPanel(core.status.event.data - 10);
|
var index = core.status.event.data.page*10+core.status.event.data.offset;
|
||||||
if (direct == -1) core.ui.drawSLPanel(core.status.event.data + 10);
|
if (direct == 1) core.ui.drawSLPanel(index - 10);
|
||||||
|
if (direct == -1) core.ui.drawSLPanel(index + 10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,12 +1198,26 @@ actions.prototype._keyUpShop = function (keycode) {
|
|||||||
|
|
||||||
////// 快捷商店界面时的点击操作 //////
|
////// 快捷商店界面时的点击操作 //////
|
||||||
actions.prototype._clickQuickShop = function (x, y) {
|
actions.prototype._clickQuickShop = function (x, y) {
|
||||||
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
|
var keys = [];
|
||||||
return shopList[shopId].visited || !shopList[shopId].mustEnable
|
if (core.flags.quickCommonEvents) {
|
||||||
|
keys = core.getFlag("__commonEventList__", []);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
keys = Object.keys(core.status.shops).filter(function (shopId) {
|
||||||
|
return core.status.shops[shopId].visited || !core.status.shops[shopId].mustEnable
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
||||||
var topIndex = this.HSIZE - parseInt(keys.length / 2);
|
var topIndex = this.HSIZE - parseInt(keys.length / 2);
|
||||||
if (y >= topIndex && y < topIndex + keys.length) {
|
if (y >= topIndex && y < topIndex + keys.length) {
|
||||||
|
if (core.flags.quickCommonEvents) {
|
||||||
|
var name = keys[y - topIndex];
|
||||||
|
core.ui.closePanel();
|
||||||
|
core.status.route.push("common:" + core.encodeBase64(name));
|
||||||
|
core.insertAction(name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
var reason = core.events.canUseQuickShop(keys[y - topIndex]);
|
var reason = core.events.canUseQuickShop(keys[y - topIndex]);
|
||||||
if (!core.flags.enableDisabledShop && reason) {
|
if (!core.flags.enableDisabledShop && reason) {
|
||||||
core.drawText(reason);
|
core.drawText(reason);
|
||||||
@ -1212,6 +1227,7 @@ actions.prototype._clickQuickShop = function (x, y) {
|
|||||||
if (core.status.event.id == 'shop')
|
if (core.status.event.id == 'shop')
|
||||||
core.status.event.data.fromList = true;
|
core.status.event.data.fromList = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 离开
|
// 离开
|
||||||
else if (y == topIndex + keys.length)
|
else if (y == topIndex + keys.length)
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
@ -1224,59 +1240,64 @@ actions.prototype._keyUpQuickShop = function (keycode) {
|
|||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var length = 0;
|
||||||
|
if (core.flags.quickCommonEvents) {
|
||||||
|
length = core.getFlag("__commonEventList__", []).length;
|
||||||
|
}
|
||||||
|
else {
|
||||||
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
|
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
|
||||||
return shopList[shopId].visited || !shopList[shopId].mustEnable
|
return shopList[shopId].visited || !shopList[shopId].mustEnable
|
||||||
});
|
});
|
||||||
this._selectChoices(keys.length + 1, keycode, this._clickQuickShop);
|
length = keys.length;
|
||||||
|
}
|
||||||
|
this._selectChoices(length + 1, keycode, this._clickQuickShop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 工具栏界面时的点击操作 //////
|
////// 工具栏界面时的点击操作 //////
|
||||||
actions.prototype._clickToolbox = function (x, y) {
|
actions.prototype._clickToolbox = function (x, y) {
|
||||||
// 装备栏
|
// 装备栏
|
||||||
if (x >= 10 && x <= 12 && y == 0) {
|
if (x >= this.LAST - 2 && y == 0) {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.openEquipbox();
|
core.openEquipbox();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 返回
|
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||||
if (x >= 10 && x <= 12 && y == 12) {
|
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var toolsPage = core.status.event.data.toolsPage;
|
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 (x == this.HSIZE-2 || x == this.HSIZE-3) {
|
||||||
if (y == 7 && toolsPage > 1) {
|
if (y == this.LAST - 5 && toolsPage > 1) {
|
||||||
core.status.event.data.toolsPage--;
|
core.status.event.data.toolsPage--;
|
||||||
core.ui.drawToolbox(core.status.event.selection);
|
core.ui.drawToolbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
if (y == 12 && constantsPage > 1) {
|
if (y == this.LAST && constantsPage > 1) {
|
||||||
core.status.event.data.toolsPage--;
|
core.status.event.data.toolsPage--;
|
||||||
core.ui.drawToolbox(core.status.event.selection);
|
core.ui.drawToolbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if (x == 8 || x == 9) {
|
if (x == this.HSIZE+2 || x == this.HSIZE+3) {
|
||||||
if (y == 7 && toolsPage < Math.ceil(Object.keys(core.status.hero.items.tools).length / 12)) {
|
if (y == this.LAST - 5 && toolsPage < Math.ceil(Object.keys(core.status.hero.items.tools).length / this.LAST)) {
|
||||||
core.status.event.data.toolsPage++;
|
core.status.event.data.toolsPage++;
|
||||||
core.ui.drawToolbox(core.status.event.selection);
|
core.ui.drawToolbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
if (y == 12 && constantsPage < Math.ceil(Object.keys(core.status.hero.items.constants).length / 12)) {
|
if (y == this.LAST && constantsPage < Math.ceil(Object.keys(core.status.hero.items.constants).length / this.LAST)) {
|
||||||
core.status.event.data.constantsPage++;
|
core.status.event.data.constantsPage++;
|
||||||
core.ui.drawToolbox(core.status.event.selection);
|
core.ui.drawToolbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = parseInt(x / 2);
|
var index = parseInt(x / 2);
|
||||||
;
|
if (y == this.LAST - 8) index += 0;
|
||||||
if (y == 4) index += 0;
|
else if (y == this.LAST - 6) index += this.HSIZE;
|
||||||
else if (y == 6) index += 6;
|
else if (y == this.LAST - 3) index += this.LAST;
|
||||||
else if (y == 9) index += 12;
|
else if (y == this.LAST - 1) index += this.LAST + this.HSIZE;
|
||||||
else if (y == 11) index += 18;
|
|
||||||
else index = -1;
|
else index = -1;
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
this._clickToolboxIndex(index);
|
this._clickToolboxIndex(index);
|
||||||
}
|
}
|
||||||
@ -1285,12 +1306,12 @@ actions.prototype._clickToolbox = function (x, y) {
|
|||||||
actions.prototype._clickToolboxIndex = function (index) {
|
actions.prototype._clickToolboxIndex = function (index) {
|
||||||
var items = null;
|
var items = null;
|
||||||
var select;
|
var select;
|
||||||
if (index < 12) {
|
if (index < this.LAST) {
|
||||||
select = index + 12 * (core.status.event.data.toolsPage - 1);
|
select = index + this.LAST * (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 {
|
||||||
select = index % 12 + 12 * (core.status.event.data.constantsPage - 1);
|
select = index % this.LAST + this.LAST * (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;
|
||||||
@ -1308,33 +1329,35 @@ actions.prototype._clickToolboxIndex = function (index) {
|
|||||||
actions.prototype._keyDownToolbox = function (keycode) {
|
actions.prototype._keyDownToolbox = function (keycode) {
|
||||||
if (core.status.event.data == null) return;
|
if (core.status.event.data == null) return;
|
||||||
|
|
||||||
|
var last_index = this.LAST - 1;
|
||||||
|
|
||||||
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 toolsPage = core.status.event.data.toolsPage;
|
var toolsPage = core.status.event.data.toolsPage;
|
||||||
var constantsPage = core.status.event.data.constantsPage;
|
var constantsPage = core.status.event.data.constantsPage;
|
||||||
var toolsTotalPage = Math.ceil(tools.length / 12);
|
var toolsTotalPage = Math.ceil(tools.length / this.LAST);
|
||||||
var constantsTotalPage = Math.ceil(constants.length / 12);
|
var constantsTotalPage = Math.ceil(constants.length / this.LAST);
|
||||||
var toolsLastIndex = toolsPage < toolsTotalPage ? 11 : (tools.length + 11) % 12;
|
var toolsLastIndex = toolsPage < toolsTotalPage ? last_index : (tools.length + last_index) % this.LAST;
|
||||||
var constantsLastIndex = 12 + (constantsPage < constantsTotalPage ? 11 : (constants.length + 11) % 12);
|
var constantsLastIndex = this.LAST + (constantsPage < constantsTotalPage ? last_index : (constants.length + last_index) % this.LAST);
|
||||||
|
|
||||||
if (keycode == 37) { // left
|
if (keycode == 37) { // left
|
||||||
if (index == 0) { // 处理向前翻页
|
if (index == 0) { // 处理向前翻页
|
||||||
if (toolsPage > 1) {
|
if (toolsPage > 1) {
|
||||||
core.status.event.data.toolsPage--;
|
core.status.event.data.toolsPage--;
|
||||||
index = 11;
|
index = last_index;
|
||||||
}
|
}
|
||||||
else return; // 第一页不向前翻
|
else return; // 第一页不向前翻
|
||||||
}
|
}
|
||||||
else if (index == 12) {
|
else if (index == this.LAST) {
|
||||||
if (constantsPage == 1) {
|
if (constantsPage == 1) {
|
||||||
if (toolsTotalPage == 0) return;
|
if (toolsTotalPage == 0) return;
|
||||||
core.status.event.data.toolsPage = toolsTotalPage;
|
core.status.event.data.toolsPage = toolsTotalPage;
|
||||||
index = (tools.length + 11) % 12;
|
index = (tools.length + last_index) % this.LAST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.status.event.data.constantsPage--;
|
core.status.event.data.constantsPage--;
|
||||||
index = 23;
|
index = 2 * this.LAST - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else index -= 1;
|
else index -= 1;
|
||||||
@ -1342,29 +1365,29 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 38) { // up
|
if (keycode == 38) { // up
|
||||||
if (index >= 12 && index <= 17) { // 进入tools
|
if (index >= this.LAST && index < this.LAST + this.HSIZE) { // 进入tools
|
||||||
if (toolsTotalPage == 0) return;
|
if (toolsTotalPage == 0) return;
|
||||||
if (toolsLastIndex >= 6) index = Math.min(toolsLastIndex, index - 6);
|
if (toolsLastIndex >= this.HSIZE) index = Math.min(toolsLastIndex, index - this.HSIZE);
|
||||||
else index = Math.min(toolsLastIndex, index - 12);
|
else index = Math.min(toolsLastIndex, index - this.LAST);
|
||||||
}
|
}
|
||||||
else if (index < 6) return; // 第一行没有向上
|
else if (index < this.HSIZE) return; // 第一行没有向上
|
||||||
else index -= 6;
|
else index -= this.HSIZE;
|
||||||
this._clickToolboxIndex(index);
|
this._clickToolboxIndex(index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 39) { // right
|
if (keycode == 39) { // right
|
||||||
if (toolsPage < toolsTotalPage && index == 11) {
|
if (toolsPage < toolsTotalPage && index == last_index) {
|
||||||
core.status.event.data.toolsPage++;
|
core.status.event.data.toolsPage++;
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
else if (constantsPage < constantsTotalPage && index == 23) {
|
else if (constantsPage < constantsTotalPage && index == 2 * this.LAST - 1) {
|
||||||
core.status.event.data.constantsPage++;
|
core.status.event.data.constantsPage++;
|
||||||
index = 12;
|
index = this.LAST;
|
||||||
}
|
}
|
||||||
else if (index == toolsLastIndex) {
|
else if (index == toolsLastIndex) {
|
||||||
if (constantsTotalPage == 0) return;
|
if (constantsTotalPage == 0) return;
|
||||||
core.status.event.data.constantsPage = 1;
|
core.status.event.data.constantsPage = 1;
|
||||||
index = 12;
|
index = this.LAST;
|
||||||
}
|
}
|
||||||
else if (index == constantsLastIndex) // 一个物品无操作
|
else if (index == constantsLastIndex) // 一个物品无操作
|
||||||
return;
|
return;
|
||||||
@ -1374,16 +1397,17 @@ actions.prototype._keyDownToolbox = function (keycode) {
|
|||||||
}
|
}
|
||||||
if (keycode == 40) { // down
|
if (keycode == 40) { // down
|
||||||
var nextIndex = null;
|
var nextIndex = null;
|
||||||
if (index <= 5) {
|
if (index < this.HSIZE) {
|
||||||
if (toolsLastIndex > 5) nextIndex = Math.min(toolsLastIndex, index + 6);
|
if (toolsLastIndex >= this.HSIZE) nextIndex = Math.min(toolsLastIndex, index + this.HSIZE);
|
||||||
else index += 6;
|
else index += this.HSIZE;
|
||||||
}
|
}
|
||||||
if (nextIndex == null && index <= 11) {
|
if (nextIndex == null && index < this.LAST) {
|
||||||
if (constantsTotalPage == 0) return;
|
if (constantsTotalPage == 0) return;
|
||||||
nextIndex = Math.min(index + 6, constantsLastIndex);
|
nextIndex = Math.min(index + this.HSIZE, constantsLastIndex);
|
||||||
}
|
}
|
||||||
if (nextIndex == null && index <= 17) {
|
if (nextIndex == null && index < this.LAST + this.HSIZE) {
|
||||||
if (constantsLastIndex > 17) nextIndex = Math.min(constantsLastIndex, index + 6);
|
if (constantsLastIndex >= this.LAST + this.HSIZE)
|
||||||
|
nextIndex = Math.min(constantsLastIndex, index + this.HSIZE);
|
||||||
}
|
}
|
||||||
if (nextIndex != null) {
|
if (nextIndex != null) {
|
||||||
this._clickToolboxIndex(nextIndex);
|
this._clickToolboxIndex(nextIndex);
|
||||||
@ -1414,64 +1438,65 @@ actions.prototype._keyUpToolbox = function (keycode) {
|
|||||||
////// 装备栏界面时的点击操作 //////
|
////// 装备栏界面时的点击操作 //////
|
||||||
actions.prototype._clickEquipbox = function (x, y) {
|
actions.prototype._clickEquipbox = function (x, y) {
|
||||||
// 道具栏
|
// 道具栏
|
||||||
if (x >= 10 && x <= 12 && y == 0) {
|
if (x >= this.LAST - 2 && y == 0) {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.openToolbox();
|
core.openToolbox();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 返回
|
// 返回
|
||||||
if (x >= 10 && x <= 12 && y == 12) {
|
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前页面
|
|
||||||
var page = core.status.event.data.page;
|
|
||||||
|
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) {
|
||||||
if (page > 1) {
|
if (core.status.event.data.page > 1) {
|
||||||
core.status.event.data.page--;
|
core.status.event.data.page--;
|
||||||
core.ui.drawEquipbox(core.status.event.selection);
|
core.ui.drawEquipbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) {
|
||||||
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 / this.LAST);
|
||||||
if (page < lastPage) {
|
if (core.status.event.data.page < lastPage) {
|
||||||
core.status.event.data.page++;
|
core.status.event.data.page++;
|
||||||
core.ui.drawEquipbox(core.status.event.selection);
|
core.ui.drawEquipbox(core.status.event.selection);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = parseInt(x / 2);
|
var per_page = this.HSIZE - 3, v = this.SIZE / per_page;
|
||||||
if (y == 4) index += 0;
|
if (y == this.LAST - 8) {
|
||||||
else if (y == 6) index += 6;
|
for (var i = 0; i < per_page; ++i)
|
||||||
else if (y == 9) index += 12;
|
if (x >= i * v && x <= (i + 1) * v)
|
||||||
else if (y == 11) index += 18;
|
return this._clickEquipboxIndex(i);
|
||||||
else index = -1;
|
|
||||||
|
|
||||||
if (index >= 0) {
|
|
||||||
if (index < 12) index = parseInt(index / 2);
|
|
||||||
this._clickEquipboxIndex(index);
|
|
||||||
}
|
}
|
||||||
|
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后的操作 //////
|
////// 选择装备栏界面中某个Index后的操作 //////
|
||||||
actions.prototype._clickEquipboxIndex = function (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.globalAttribute.equipName.length) return;
|
||||||
if (index == core.status.event.selection && core.status.hero.equipment[index]) {
|
if (index == core.status.event.selection && core.status.hero.equipment[index]) {
|
||||||
core.unloadEquip(index);
|
core.unloadEquip(index);
|
||||||
core.status.route.push("unEquip:" + index);
|
core.status.route.push("unEquip:" + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (index >= 12) {
|
else {
|
||||||
var equips = Object.keys(core.status.hero.items.equips || {}).sort();
|
var equips = Object.keys(core.status.hero.items.equips || {}).sort();
|
||||||
if (index == core.status.event.selection) {
|
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.loadEquip(equipId);
|
||||||
core.status.route.push("equip:" + equipId);
|
core.status.route.push("equip:" + equipId);
|
||||||
}
|
}
|
||||||
@ -1481,21 +1506,23 @@ actions.prototype._clickEquipboxIndex = function (index) {
|
|||||||
|
|
||||||
////// 装备栏界面时,按下某个键的操作 //////
|
////// 装备栏界面时,按下某个键的操作 //////
|
||||||
actions.prototype._keyDownEquipbox = function (keycode) {
|
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 equipCapacity = core.status.globalAttribute.equipName.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 = core.status.event.data.page;
|
var page = core.status.event.data.page;
|
||||||
var totalPage = Math.ceil(ownEquipment.length / 12);
|
var totalPage = Math.ceil(ownEquipment.length / this.LAST);
|
||||||
var totalLastIndex = 12 + (page < totalPage ? 11 : (ownEquipment.length + 11) % 12);
|
var totalLastIndex = this.LAST + (page < totalPage ? last_index : (ownEquipment.length + last_index) % this.LAST);
|
||||||
|
|
||||||
if (keycode == 37) { // left
|
if (keycode == 37) { // left
|
||||||
if (index == 0) return;
|
if (index == 0) return;
|
||||||
if (index == 12) {
|
if (index == this.LAST) {
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
core.status.event.data.page--;
|
core.status.event.data.page--;
|
||||||
index = 23;
|
index = this.LAST + last_index;
|
||||||
}
|
}
|
||||||
else if (page == 1)
|
else if (page == 1)
|
||||||
index = equipCapacity - 1;
|
index = equipCapacity - 1;
|
||||||
@ -1506,25 +1533,25 @@ actions.prototype._keyDownEquipbox = function (keycode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 38) { // up
|
if (keycode == 38) { // up
|
||||||
if (index < 3) return;
|
if (index < per_line) return;
|
||||||
else if (index < 6) index -= 3;
|
else if (index < 2 * per_line) index -= per_line;
|
||||||
else if (index < 18) {
|
else if (index < this.LAST + this.HSIZE) {
|
||||||
index = parseInt((index - 12) / 2);
|
index = parseInt((index - this.LAST) / 2);
|
||||||
if (equipCapacity > 3) index = Math.min(equipCapacity - 1, index + 3);
|
if (equipCapacity > per_line) index = Math.min(equipCapacity - 1, index + per_line);
|
||||||
else index = Math.min(equipCapacity - 1, index);
|
else index = Math.min(equipCapacity - 1, index);
|
||||||
}
|
}
|
||||||
else index -= 6;
|
else index -= this.HSIZE;
|
||||||
this._clickEquipboxIndex(index);
|
this._clickEquipboxIndex(index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 39) { // right
|
if (keycode == 39) { // right
|
||||||
if (page < totalPage && index == 23) {
|
if (page < totalPage && index == this.LAST + last_index) {
|
||||||
core.status.event.data.page++;
|
core.status.event.data.page++;
|
||||||
index = 12;
|
index = this.LAST;
|
||||||
}
|
}
|
||||||
else if (index == equipCapacity - 1) {
|
else if (index == equipCapacity - 1) {
|
||||||
if (totalPage == 0) return;
|
if (totalPage == 0) return;
|
||||||
index = 12;
|
index = this.LAST;
|
||||||
}
|
}
|
||||||
else if (index == totalLastIndex)
|
else if (index == totalLastIndex)
|
||||||
return;
|
return;
|
||||||
@ -1533,19 +1560,19 @@ actions.prototype._keyDownEquipbox = function (keycode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 40) { // down
|
if (keycode == 40) { // down
|
||||||
if (index < 3) {
|
if (index < per_line) {
|
||||||
if (equipCapacity > 3) index = Math.min(index + 3, equipCapacity - 1);
|
if (equipCapacity > per_line) index = Math.min(index + per_line, equipCapacity - 1);
|
||||||
else {
|
else {
|
||||||
if (totalPage == 0) return;
|
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;
|
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)
|
else if (index < this.LAST + this.HSIZE)
|
||||||
index = Math.min(index + 6, totalLastIndex);
|
index = Math.min(index + this.HSIZE, totalLastIndex);
|
||||||
else return;
|
else return;
|
||||||
this._clickEquipboxIndex(index);
|
this._clickEquipboxIndex(index);
|
||||||
return;
|
return;
|
||||||
@ -1577,84 +1604,124 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) {
|
|||||||
|
|
||||||
////// 存读档界面时的点击操作 //////
|
////// 存读档界面时的点击操作 //////
|
||||||
actions.prototype._clickSL = function (x, y) {
|
actions.prototype._clickSL = function (x, y) {
|
||||||
|
var page = core.status.event.data.page, offset = core.status.event.data.offset;
|
||||||
var index = core.status.event.data;
|
var index = page * 10 + offset;
|
||||||
var page = parseInt(index / 10), offset = index % 10;
|
|
||||||
|
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) {
|
||||||
core.ui.drawSLPanel(10 * (page - 1) + offset);
|
core.ui.drawSLPanel(10 * (page - 1) + offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) {
|
||||||
core.ui.drawSLPanel(10 * (page + 1) + offset);
|
core.ui.drawSLPanel(10 * (page + 1) + offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 返回
|
// 返回
|
||||||
if (x >= 10 && x <= 12 && y == 12) {
|
if (x >= this.LAST-2 && y == this.LAST) {
|
||||||
if (core.events.recoverEvents(core.status.event.interval)) {
|
if (core.events.recoverEvents(core.status.event.interval))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
if (!core.isPlaying()) {
|
if (!core.isPlaying())
|
||||||
core.showStartAnimate(true);
|
core.showStartAnimate(true);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
if (x >= 0 && x <= 2 && y == 12) {
|
if (x >= 0 && x <= 2 && y == this.LAST) {
|
||||||
|
|
||||||
if (core.status.event.id == 'save') {
|
if (core.status.event.id == 'save') {
|
||||||
core.status.event.selection = !core.status.event.selection;
|
core.status.event.selection = !core.status.event.selection;
|
||||||
core.ui.drawSLPanel(index);
|
core.ui.drawSLPanel(index);
|
||||||
}
|
}
|
||||||
|
else { // 显示收藏
|
||||||
|
core.status.event.data.mode = core.status.event.data.mode == 'all'?'fav':'all';
|
||||||
|
if (core.status.event.data.mode == 'fav')
|
||||||
|
core.ui.drawSLPanel(1, true);
|
||||||
else {
|
else {
|
||||||
core.myprompt("请输入读档编号", null, function (index) {
|
page = parseInt((core.saves.saveIndex-1)/5);
|
||||||
index = parseInt(index) || 0;
|
offset = core.saves.saveIndex-5*page;
|
||||||
if (index > 0)
|
core.ui.drawSLPanel(10*page + offset, true);
|
||||||
core.doSL(index, core.status.event.id);
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 点存档名
|
||||||
|
var xLeft = parseInt(this.SIZE/3), xRight = parseInt(this.SIZE*2/3);
|
||||||
|
var topY1 = 0, topY2 = this.HSIZE;
|
||||||
|
if(y >= topY1 && y <= topY1 + 1) {
|
||||||
|
if (x >= xLeft && x < xRight) return this._clickSL_favorite(page, 1);
|
||||||
|
if (x >= xRight) return this._clickSL_favorite(page, 2);
|
||||||
|
}
|
||||||
|
if(y >= topY2 && y <= topY2 + 1) {
|
||||||
|
if (x < xLeft) return this._clickSL_favorite(page, 3);
|
||||||
|
if (x >= xLeft && x < xRight) return this._clickSL_favorite(page, 4);
|
||||||
|
if (x >= xRight) return this._clickSL_favorite(page, 5);
|
||||||
|
}
|
||||||
|
|
||||||
var id = null;
|
var id = null;
|
||||||
if (y >= 1 && y <= 4) {
|
if (y >= topY1 + 2 && y < this.HSIZE - 1) {
|
||||||
if (x >= 1 && x <= 3) id = "autoSave";
|
if (x < xLeft) id = "autoSave";
|
||||||
if (x >= 5 && x <= 7) id = 5 * page + 1;
|
if (x >= xLeft && x < xRight) id = 5 * page + 1;
|
||||||
if (x >= 9 && x <= 11) id = 5 * page + 2;
|
if (x >= xRight) id = 5 * page + 2;
|
||||||
}
|
}
|
||||||
if (y >= 7 && y <= 10) {
|
if (y >= topY2 + 2 && y < this.SIZE - 1) {
|
||||||
if (x >= 1 && x <= 3) id = 5 * page + 3;
|
if (x < xLeft) id = 5 * page + 3;
|
||||||
if (x >= 5 && x <= 7) id = 5 * page + 4;
|
if (x >= xLeft && x < xRight) id = 5 * page + 4;
|
||||||
if (x >= 9 && x <= 11) id = 5 * page + 5;
|
if (x >= xRight) id = 5 * page + 5;
|
||||||
}
|
}
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
if (core.status.event.selection) {
|
if (core.status.event.selection) {
|
||||||
if (id == 'autoSave') {
|
if (id == 'autoSave')
|
||||||
core.drawTip("无法删除自动存档!");
|
core.drawTip("无法删除自动存档!");
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// core.removeLocalStorage("save"+id);
|
core.removeSave(id, function () {
|
||||||
core.removeLocalForage("save" + id, function () {
|
|
||||||
core.ui.drawSLPanel(index, true);
|
core.ui.drawSLPanel(index, true);
|
||||||
}, function () {
|
});
|
||||||
core.drawTip("无法删除存档!");
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(core.status.event.data.mode == 'fav' && id != 'autoSave')
|
||||||
|
id = core.saves.favorite[id - 1];
|
||||||
core.doSL(id, core.status.event.id);
|
core.doSL(id, core.status.event.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actions.prototype._clickSL_favorite = function (page, offset) {
|
||||||
|
if (offset == 0) return;
|
||||||
|
var index = 5 * page + offset;
|
||||||
|
if (core.status.event.data.mode == 'fav') { // 收藏模式下点击的下标直接对应favorite
|
||||||
|
index = core.saves.favorite[index - 1];
|
||||||
|
core.myprompt("请输入想要显示的存档名(长度不超过5字符)", null, function (value) {
|
||||||
|
if(value && value.length <= 5){
|
||||||
|
core.saves.favoriteName[index] = value;
|
||||||
|
core.control._updateFavoriteSaves();
|
||||||
|
core.drawSLPanel(10 * page + offset);
|
||||||
|
} else if (value) {
|
||||||
|
alert("无效的输入!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var v = core.saves.favorite.indexOf(index);
|
||||||
|
if (v >= 0) { // 已经处于收藏状态:取消收藏
|
||||||
|
core.saves.favorite.splice(v, 1);
|
||||||
|
delete core.saves.favoriteName[index];
|
||||||
|
}
|
||||||
|
else if (core.hasSave(index)) { // 存在存档则进行收藏
|
||||||
|
core.saves.favorite.push(index);
|
||||||
|
core.saves.favorite = core.saves.favorite.sort(function (a,b) {return a-b;}); // 保证有序
|
||||||
|
core.drawTip("收藏成功!");
|
||||||
|
}
|
||||||
|
core.control._updateFavoriteSaves();
|
||||||
|
core.ui.drawSLPanel(10 * page + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////// 存读档界面时,按下某个键的操作 //////
|
////// 存读档界面时,按下某个键的操作 //////
|
||||||
actions.prototype._keyDownSL = function (keycode) {
|
actions.prototype._keyDownSL = function (keycode) {
|
||||||
|
|
||||||
var index = core.status.event.data;
|
// var index = core.status.event.data;
|
||||||
var page = parseInt(index / 10), offset = index % 10;
|
var page = core.status.event.data.page, offset = core.status.event.data.offset;
|
||||||
|
var index = page*10 + offset;
|
||||||
|
|
||||||
if (keycode == 37) { // left
|
if (keycode == 37) { // left
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
@ -1704,35 +1771,26 @@ actions.prototype._keyDownSL = function (keycode) {
|
|||||||
|
|
||||||
////// 存读档界面时,放开某个键的操作 //////
|
////// 存读档界面时,放开某个键的操作 //////
|
||||||
actions.prototype._keyUpSL = function (keycode) {
|
actions.prototype._keyUpSL = function (keycode) {
|
||||||
|
var page = core.status.event.data.page, offset = core.status.event.data.offset;
|
||||||
|
var index = page * 10 + offset;
|
||||||
|
|
||||||
var index = core.status.event.data;
|
if (keycode == 27 || keycode == 88 || (core.status.event.id == 'save' && keycode == 83)
|
||||||
var page = parseInt(index / 10), offset = index % 10;
|
|| (core.status.event.id == 'load' && keycode == 68)) {
|
||||||
|
this._clickSL(this.LAST, this.LAST);
|
||||||
if (keycode == 27 || keycode == 88 || (core.status.event.id == 'save' && keycode == 83) || (core.status.event.id == 'load' && keycode == 68)) {
|
|
||||||
if (core.events.recoverEvents(core.status.event.interval)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
core.ui.closePanel();
|
|
||||||
if (!core.isPlaying()) {
|
|
||||||
core.showStartAnimate(true);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
||||||
if (offset == 0) {
|
if (offset == 0)
|
||||||
core.doSL("autoSave", core.status.event.id);
|
core.doSL("autoSave", core.status.event.id);
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
core.doSL(5 * page + offset, core.status.event.id);
|
var id = 5 * page + offset;
|
||||||
|
if(core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1];
|
||||||
|
core.doSL(id, core.status.event.id);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 69 && core.status.event.id != 'save') { // E
|
if (keycode == 69 && core.status.event.id != 'save') { // E 收藏切换
|
||||||
core.myprompt("请输入读档编号", null, function (index) {
|
this._clickSL(0, this.LAST);
|
||||||
index = parseInt(index) || 0;
|
|
||||||
if (index > 0)
|
|
||||||
core.doSL(index, core.status.event.id);
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keycode == 46) {
|
if (keycode == 46) {
|
||||||
@ -1740,16 +1798,18 @@ actions.prototype._keyUpSL = function (keycode) {
|
|||||||
core.drawTip("无法删除自动存档!");
|
core.drawTip("无法删除自动存档!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// core.removeLocalStorage("save"+(5*page+offset));
|
var id = 5 * page + offset;
|
||||||
// core.ui.drawSLPanel(index);
|
if(core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1];
|
||||||
core.removeLocalForage("save" + (5 * page + offset), function () {
|
core.removeSave(id, function () {
|
||||||
core.ui.drawSLPanel(index, true);
|
core.ui.drawSLPanel(index, true);
|
||||||
}, function () {
|
});
|
||||||
core.drawTip("无法删除存档!");
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (keycode == 70 && core.status.event.data.mode == 'all') { // F
|
||||||
|
this._clickSL_favorite(page, offset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////// 系统设置界面时的点击操作 //////
|
////// 系统设置界面时的点击操作 //////
|
||||||
actions.prototype._clickSwitchs = function (x, y) {
|
actions.prototype._clickSwitchs = function (x, y) {
|
||||||
@ -2026,7 +2086,7 @@ actions.prototype._clickLocalSaveSelect = function (x, y) {
|
|||||||
var selection = y - topIndex;
|
var selection = y - topIndex;
|
||||||
core.status.event.selection = selection;
|
core.status.event.selection = selection;
|
||||||
if (selection < 2) {
|
if (selection < 2) {
|
||||||
core.control.getSaves(selection == 0 ? null : core.saves.saveIndex, function (saves) {
|
core.getAllSaves(selection == 0 ? null : core.saves.saveIndex, function (saves) {
|
||||||
if (saves) {
|
if (saves) {
|
||||||
var content = {
|
var content = {
|
||||||
"name": core.firstData.name,
|
"name": core.firstData.name,
|
||||||
@ -2079,12 +2139,16 @@ actions.prototype._clickStorageRemove = function (x, y) {
|
|||||||
actions.prototype._clickStorageRemove_all = function () {
|
actions.prototype._clickStorageRemove_all = function () {
|
||||||
core.myconfirm("你确定要清除【全部塔】的所有本地存档?\n此行为不可逆!!!", function () {
|
core.myconfirm("你确定要清除【全部塔】的所有本地存档?\n此行为不可逆!!!", function () {
|
||||||
var done = function () {
|
var done = function () {
|
||||||
|
core.saves.ids = {};
|
||||||
core.saves.autosave.data = null;
|
core.saves.autosave.data = null;
|
||||||
core.saves.autosave.updated = false;
|
core.saves.autosave.updated = false;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
|
||||||
core.saves.saveIndex = 1;
|
core.saves.saveIndex = 1;
|
||||||
|
core.saves.favorite = [];
|
||||||
|
core.saves.favoriteName = {};
|
||||||
|
core.control._updateFavoriteSaves();
|
||||||
core.removeLocalStorage('saveIndex');
|
core.removeLocalStorage('saveIndex');
|
||||||
|
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
||||||
};
|
};
|
||||||
if (core.platform.useLocalForage) {
|
if (core.platform.useLocalForage) {
|
||||||
core.ui.drawWaiting("正在清空,请稍后...");
|
core.ui.drawWaiting("正在清空,请稍后...");
|
||||||
@ -2100,12 +2164,16 @@ actions.prototype._clickStorageRemove_all = function () {
|
|||||||
actions.prototype._clickStorageRemove_current = function () {
|
actions.prototype._clickStorageRemove_current = function () {
|
||||||
core.myconfirm("你确定要清除本塔的所有本地存档?\n此行为不可逆!!!", function () {
|
core.myconfirm("你确定要清除本塔的所有本地存档?\n此行为不可逆!!!", function () {
|
||||||
var done = function () {
|
var done = function () {
|
||||||
|
core.saves.ids = {};
|
||||||
core.saves.autosave.data = null;
|
core.saves.autosave.data = null;
|
||||||
core.saves.autosave.updated = false;
|
core.saves.autosave.updated = false;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.drawText("\t[操作成功]当前塔的存档已被清空。");
|
|
||||||
core.saves.saveIndex = 1;
|
core.saves.saveIndex = 1;
|
||||||
|
core.saves.favorite = [];
|
||||||
|
core.saves.favoriteName = {};
|
||||||
|
core.control._updateFavoriteSaves();
|
||||||
core.removeLocalStorage('saveIndex');
|
core.removeLocalStorage('saveIndex');
|
||||||
|
core.drawText("\t[操作成功]当前塔的存档已被清空。");
|
||||||
}
|
}
|
||||||
if (core.platform.useLocalForage) {
|
if (core.platform.useLocalForage) {
|
||||||
core.ui.drawWaiting("正在清空,请稍后...");
|
core.ui.drawWaiting("正在清空,请稍后...");
|
||||||
|
|||||||
124
libs/control.js
124
libs/control.js
@ -33,6 +33,7 @@ control.prototype._init = function () {
|
|||||||
this.registerReplayAction("fly", this._replayAction_fly);
|
this.registerReplayAction("fly", this._replayAction_fly);
|
||||||
this.registerReplayAction("shop", this._replayAction_shop);
|
this.registerReplayAction("shop", this._replayAction_shop);
|
||||||
this.registerReplayAction("turn", this._replayAction_turn);
|
this.registerReplayAction("turn", this._replayAction_turn);
|
||||||
|
this.registerReplayAction("common", this._replayAction_common);
|
||||||
this.registerReplayAction("getNext", this._replayAction_getNext);
|
this.registerReplayAction("getNext", this._replayAction_getNext);
|
||||||
this.registerReplayAction("moveDirectly", this._replayAction_moveDirectly);
|
this.registerReplayAction("moveDirectly", this._replayAction_moveDirectly);
|
||||||
this.registerReplayAction("key", this._replayAction_key);
|
this.registerReplayAction("key", this._replayAction_key);
|
||||||
@ -795,7 +796,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
|
|||||||
|
|
||||||
////// 绘制勇士 //////
|
////// 绘制勇士 //////
|
||||||
control.prototype.drawHero = function (status, offset) {
|
control.prototype.drawHero = function (status, offset) {
|
||||||
if (!core.isPlaying() || !core.status.floorId) return;
|
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
|
||||||
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
|
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
|
||||||
status = status || 'stop';
|
status = status || 'stop';
|
||||||
offset = offset || 0;
|
offset = offset || 0;
|
||||||
@ -1301,8 +1302,12 @@ control.prototype._replay_save = function () {
|
|||||||
|
|
||||||
control.prototype._replay_error = function (action) {
|
control.prototype._replay_error = function (action) {
|
||||||
core.status.replay.replaying = false;
|
core.status.replay.replaying = false;
|
||||||
main.log("录像文件出错,当前操作:" + action +
|
var len = core.status.replay.toReplay.length;
|
||||||
"\n接下来10个操作是:"+core.status.replay.toReplay.slice(0, 10).toString());
|
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
|
||||||
|
var nextList = core.status.replay.toReplay.slice(0, 10);
|
||||||
|
main.log("录像文件出错,当前操作:" + action);
|
||||||
|
main.log("之前的10个操作是:\n" + prevList.toString());
|
||||||
|
main.log("接下来10个操作是:\n" + nextList.toString());
|
||||||
core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () {
|
core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
if (core.status.replay.save.length > 0) {
|
if (core.status.replay.save.length > 0) {
|
||||||
@ -1441,6 +1446,16 @@ control.prototype._replayAction_turn = function (action) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
control.prototype._replayAction_common = function (action) {
|
||||||
|
if (action.indexOf("common:") != 0) return false;
|
||||||
|
var name = core.decodeBase64(action.substring(7));
|
||||||
|
if (core.getFlag("__commonEventList__").indexOf(name) == -1) return false;
|
||||||
|
core.status.route.push(action);
|
||||||
|
core.insertAction(name);
|
||||||
|
setTimeout(core.replay);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
control.prototype._replayAction_getNext = function (action) {
|
control.prototype._replayAction_getNext = function (action) {
|
||||||
if (action != "getNext") return false;
|
if (action != "getNext") return false;
|
||||||
if (!core.getNextItem()) return false;
|
if (!core.getNextItem()) return false;
|
||||||
@ -1608,7 +1623,7 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) {
|
|||||||
////// 同步存档到服务器 //////
|
////// 同步存档到服务器 //////
|
||||||
control.prototype.syncSave = function (type) {
|
control.prototype.syncSave = function (type) {
|
||||||
core.ui.drawWaiting("正在同步,请稍后...");
|
core.ui.drawWaiting("正在同步,请稍后...");
|
||||||
core.control.getSaves(type=='all'?null:core.saves.saveIndex, function (saves) {
|
core.getAllSaves(type=='all'?null:core.saves.saveIndex, function (saves) {
|
||||||
if (!saves) return core.drawText("没有要同步的存档");
|
if (!saves) return core.drawText("没有要同步的存档");
|
||||||
core.control._syncSave_http(type, saves);
|
core.control._syncSave_http(type, saves);
|
||||||
})
|
})
|
||||||
@ -1702,32 +1717,54 @@ control.prototype.loadData = function (data, callback) {
|
|||||||
return this.controldata.loadData(data, callback);
|
return this.controldata.loadData(data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
control.prototype.getSaves = function (index, callback) {
|
control.prototype.getSave = function (index, callback) {
|
||||||
if (index != null) {
|
if (index == 0) {
|
||||||
|
// --- 自动存档先从缓存中获取
|
||||||
|
if (core.saves.autosave.data != null)
|
||||||
|
callback(core.clone(core.saves.autosave.data));
|
||||||
|
else {
|
||||||
|
core.getLocalForage("autoSave", null, function(data) {
|
||||||
|
callback(data);
|
||||||
|
}, function(err) {
|
||||||
|
main.log(err);
|
||||||
|
callback(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
core.getLocalForage("save"+index, null, function(data) {
|
core.getLocalForage("save"+index, null, function(data) {
|
||||||
if (callback) callback(data);
|
if (callback) callback(data);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
main.log(err);
|
main.log(err);
|
||||||
if (callback) callback(null);
|
if (callback) callback(null);
|
||||||
})
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
control.prototype.getSaves = function (ids, callback) {
|
||||||
|
if (!(ids instanceof Array)) return this.getSave(ids, callback);
|
||||||
|
var count = ids.length, data = {};
|
||||||
|
for (var i = 0; i < ids.length; ++i) {
|
||||||
|
(function (i) {
|
||||||
|
core.getSave(ids[i], function (result) {
|
||||||
|
data[i] = result;
|
||||||
|
if (Object.keys(data).length == count)
|
||||||
|
callback(data);
|
||||||
|
})
|
||||||
|
})(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
control.prototype.getAllSaves = function (id, callback) {
|
||||||
|
if (id != null) return this.getSave(id, callback);
|
||||||
var ids = Object.keys(core.saves.ids).filter(function(x){return x!=0;})
|
var ids = Object.keys(core.saves.ids).filter(function(x){return x!=0;})
|
||||||
.sort(function(a,b) {return a-b;}), number = ids.length, saves = [];
|
.sort(function(a,b) {return a-b;}), saves = [];
|
||||||
var load = function (index, callback) {
|
this.getSaves(ids, function (data) {
|
||||||
if (index > number) {
|
for (var i = 0; i < ids.length; ++i) {
|
||||||
if (callback) callback(saves);
|
if (data[i] != null)
|
||||||
return;
|
saves.push(data[i]);
|
||||||
}
|
}
|
||||||
core.getLocalForage("save"+ids[index], null, function (data) {
|
callback(saves);
|
||||||
saves.push(data);
|
});
|
||||||
load(index+1, callback);
|
|
||||||
}, function(err) {
|
|
||||||
main.log(err);
|
|
||||||
load(index+1, callback);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
load(0, callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得所有存在存档的存档位 //////
|
////// 获得所有存在存档的存档位 //////
|
||||||
@ -1761,6 +1798,43 @@ control.prototype.hasSave = function (index) {
|
|||||||
return core.saves.ids[index] || false;
|
return core.saves.ids[index] || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 删除一个或多个存档
|
||||||
|
control.prototype.removeSave = function (index, callback) {
|
||||||
|
if (index == 0 || index == "autoSave") {
|
||||||
|
index = "autoSave";
|
||||||
|
core.removeLocalForage(index, function () {
|
||||||
|
core.saves.autosave.data = null;
|
||||||
|
core.saves.autosave.updated = false;
|
||||||
|
if (callback) callback();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
core.removeLocalForage("save" + index, function () {
|
||||||
|
core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
|
||||||
|
delete core.saves.favoriteName[index];
|
||||||
|
core.control._updateFavoriteSaves();
|
||||||
|
if (callback) callback();
|
||||||
|
}, function () {
|
||||||
|
core.drawTip("无法删除存档!");
|
||||||
|
if (callback) callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 读取收藏信息
|
||||||
|
control.prototype._loadFavoriteSaves = function () {
|
||||||
|
core.saves.favorite = core.getLocalStorage("favorite", []);
|
||||||
|
// --- 移除不存在的收藏
|
||||||
|
core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
|
||||||
|
core.saves.favoriteName = core.getLocalStorage("favoriteName", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
control.prototype._updateFavoriteSaves = function () {
|
||||||
|
core.setLocalStorage("favorite", core.saves.favorite);
|
||||||
|
core.setLocalStorage("favoriteName", core.saves.favoriteName);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 加载某个存档
|
||||||
|
|
||||||
// ------ 属性,状态,位置,buff,变量,锁定控制等 ------ //
|
// ------ 属性,状态,位置,buff,变量,锁定控制等 ------ //
|
||||||
|
|
||||||
////// 设置勇士属性 //////
|
////// 设置勇士属性 //////
|
||||||
@ -1782,7 +1856,7 @@ control.prototype.addStatus = function (name, value) {
|
|||||||
control.prototype.getStatus = function (name) {
|
control.prototype.getStatus = function (name) {
|
||||||
if (!core.status.hero) return null;
|
if (!core.status.hero) return null;
|
||||||
if (name == 'x' || name == 'y' || name == 'direction')
|
if (name == 'x' || name == 'y' || name == 'direction')
|
||||||
return this.getHeroLoc('x');
|
return this.getHeroLoc(name);
|
||||||
if (name == 'exp') name = 'experience';
|
if (name == 'exp') name = 'experience';
|
||||||
return core.status.hero[name];
|
return core.status.hero[name];
|
||||||
}
|
}
|
||||||
@ -1806,12 +1880,12 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
|
|||||||
|
|
||||||
////// 设置某个属性的增幅值 //////
|
////// 设置某个属性的增幅值 //////
|
||||||
control.prototype.setBuff = function (name, value) {
|
control.prototype.setBuff = function (name, value) {
|
||||||
this.setFlag('flag:__'+name+'_buff__', value);
|
this.setFlag('__'+name+'_buff__', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 加减某个属性的增幅值 //////
|
////// 加减某个属性的增幅值 //////
|
||||||
control.prototype.addBuff = function (name, value) {
|
control.prototype.addBuff = function (name, value) {
|
||||||
this.setFlag('flag:__'+name+'_buff__', this.getBuff(name) + value);
|
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得某个属性的增幅值 //////
|
////// 获得某个属性的增幅值 //////
|
||||||
|
|||||||
13
libs/core.js
13
libs/core.js
@ -67,6 +67,7 @@ function core() {
|
|||||||
'isPC': true, // 是否是PC
|
'isPC': true, // 是否是PC
|
||||||
'isAndroid': false, // 是否是Android
|
'isAndroid': false, // 是否是Android
|
||||||
'isIOS': false, // 是否是iOS
|
'isIOS': false, // 是否是iOS
|
||||||
|
'string': 'PC',
|
||||||
'isWeChat': false, // 是否是微信
|
'isWeChat': false, // 是否是微信
|
||||||
'isQQ': false, // 是否是QQ
|
'isQQ': false, // 是否是QQ
|
||||||
'isChrome': false, // 是否是Chrome
|
'isChrome': false, // 是否是Chrome
|
||||||
@ -102,7 +103,9 @@ function core() {
|
|||||||
"data": null,
|
"data": null,
|
||||||
"time": 0,
|
"time": 0,
|
||||||
"updated": false,
|
"updated": false,
|
||||||
}
|
},
|
||||||
|
"favorite": [],
|
||||||
|
"favoriteName": {}
|
||||||
}
|
}
|
||||||
this.initStatus = {
|
this.initStatus = {
|
||||||
'played': false,
|
'played': false,
|
||||||
@ -272,6 +275,7 @@ core.prototype._init_platform = function () {
|
|||||||
core.platform.isPC = false;
|
core.platform.isPC = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
core.platform.string = core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "";
|
||||||
core.platform.supportCopy = document.queryCommandSupported || document.queryCommandSupported("copy");
|
core.platform.supportCopy = document.queryCommandSupported || document.queryCommandSupported("copy");
|
||||||
var chrome = /Chrome\/(\d+)\./i.exec(navigator.userAgent);
|
var chrome = /Chrome\/(\d+)\./i.exec(navigator.userAgent);
|
||||||
if (chrome && parseInt(chrome[1]) >= 50) core.platform.isChrome = true;
|
if (chrome && parseInt(chrome[1]) >= 50) core.platform.isChrome = true;
|
||||||
@ -293,7 +297,7 @@ core.prototype._init_platform = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.prototype._init_checkLocalForage = 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) {
|
var _error = function (e) {
|
||||||
main.log(e);
|
main.log(e);
|
||||||
core.platform.useLocalForage = false;
|
core.platform.useLocalForage = false;
|
||||||
@ -382,13 +386,16 @@ core.prototype._forwardFunc = function (name, funcname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (core[funcname]) {
|
if (core[funcname]) {
|
||||||
console.error("ERROR: Cannot forward function " + funcname + " from " + name + "!");
|
console.error("ERROR: 无法转发 "+name+" 中的函数 "+funcname+" 到 core 中!同名函数已存在。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parameterInfo = /^\s*function\s*[\w_$]*\(([\w_,$\s]*)\)\s*\{/.exec(core[name][funcname].toString());
|
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, ', ');
|
var parameters = (parameterInfo == null ? "" : parameterInfo[1]).replace(/\s*/g, '').replace(/,/g, ', ');
|
||||||
// core[funcname] = new Function(parameters, "return core."+name+"."+funcname+"("+parameters+");");
|
// core[funcname] = new Function(parameters, "return core."+name+"."+funcname+"("+parameters+");");
|
||||||
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
|
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) {
|
core.prototype.doFunc = function (func, _this) {
|
||||||
|
|||||||
@ -89,7 +89,7 @@ events.prototype._startGame_upload = function () {
|
|||||||
formData.append('type', 'people');
|
formData.append('type', 'people');
|
||||||
formData.append('name', core.firstData.name);
|
formData.append('name', core.firstData.name);
|
||||||
formData.append('version', core.firstData.version);
|
formData.append('version', core.firstData.version);
|
||||||
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
|
formData.append('platform', core.platform.string);
|
||||||
formData.append('hard', core.encodeBase64(core.status.hard));
|
formData.append('hard', core.encodeBase64(core.status.hard));
|
||||||
formData.append('hardCode', core.getFlag('hard', 0));
|
formData.append('hardCode', core.getFlag('hard', 0));
|
||||||
formData.append('base64', 1);
|
formData.append('base64', 1);
|
||||||
@ -171,7 +171,7 @@ events.prototype._gameOver_doUpload = function (username, ending, norank) {
|
|||||||
formData.append('type', 'score');
|
formData.append('type', 'score');
|
||||||
formData.append('name', core.firstData.name);
|
formData.append('name', core.firstData.name);
|
||||||
formData.append('version', core.firstData.version);
|
formData.append('version', core.firstData.version);
|
||||||
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
|
formData.append('platform', core.platform.string);
|
||||||
formData.append('hard', core.encodeBase64(core.status.hard));
|
formData.append('hard', core.encodeBase64(core.status.hard));
|
||||||
formData.append('username', core.encodeBase64(username || ""));
|
formData.append('username', core.encodeBase64(username || ""));
|
||||||
formData.append('ending', core.encodeBase64(ending));
|
formData.append('ending', core.encodeBase64(ending));
|
||||||
@ -251,7 +251,7 @@ events.prototype.unregisterSystemEvent = function (type) {
|
|||||||
events.prototype.doSystemEvent = function (type, data, callback) {
|
events.prototype.doSystemEvent = function (type, data, callback) {
|
||||||
if (this.systemEvents[type]) {
|
if (this.systemEvents[type]) {
|
||||||
try {
|
try {
|
||||||
return core.doFunc(this.systemEvents[type], this, data, data, callback);
|
return core.doFunc(this.systemEvents[type], this, data, callback);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
main.log(e);
|
main.log(e);
|
||||||
@ -688,6 +688,11 @@ events.prototype._sys_action = function (data, callback) {
|
|||||||
this.insertAction(ev, ex, ey, callback);
|
this.insertAction(ev, ex, ey, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype._sys_custom = function (data, callback) {
|
||||||
|
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],
|
||||||
|
data.x, data.y, callback);
|
||||||
|
}
|
||||||
|
|
||||||
// ------ 自定义事件的处理 ------ //
|
// ------ 自定义事件的处理 ------ //
|
||||||
|
|
||||||
////// 注册一个自定义事件 //////
|
////// 注册一个自定义事件 //////
|
||||||
@ -801,7 +806,10 @@ events.prototype.insertAction = function (action, x, y, callback, addToLast) {
|
|||||||
|
|
||||||
// ------ 判定commonEvent
|
// ------ 判定commonEvent
|
||||||
var commonEvent = this.getCommonEvent(action);
|
var commonEvent = this.getCommonEvent(action);
|
||||||
if (commonEvent instanceof Array) action = commonEvent;
|
if (commonEvent instanceof Array) {
|
||||||
|
this._addCommentEventToList(action, commonEvent);
|
||||||
|
action = commonEvent;
|
||||||
|
}
|
||||||
if (!action) return;
|
if (!action) return;
|
||||||
|
|
||||||
if (core.status.event.id != 'action') {
|
if (core.status.event.id != 'action') {
|
||||||
@ -822,6 +830,22 @@ events.prototype.getCommonEvent = function (name) {
|
|||||||
return this.commonEvent[name] || null;
|
return this.commonEvent[name] || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype._addCommentEventToList = function (name, list) {
|
||||||
|
if (list == null) list = this.getCommonEvent(name);
|
||||||
|
if (!list || !core.flags.quickCommonEvents) return;
|
||||||
|
var addToList = false;
|
||||||
|
for (var x in list) {
|
||||||
|
if (list[x].type == 'addToList') {
|
||||||
|
addToList = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!addToList) return;
|
||||||
|
var obj = core.getFlag("__commonEventList__", []);
|
||||||
|
if (obj.indexOf(name) == -1) obj.push(name);
|
||||||
|
core.setFlag("__commonEventList__", obj);
|
||||||
|
}
|
||||||
|
|
||||||
////// 恢复一个事件 //////
|
////// 恢复一个事件 //////
|
||||||
events.prototype.recoverEvents = function (data) {
|
events.prototype.recoverEvents = function (data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -1163,13 +1187,14 @@ events.prototype._action_insert = function (data, x, y, prefix) {
|
|||||||
if (data.args instanceof Array) {
|
if (data.args instanceof Array) {
|
||||||
for (var i = 0; i < data.args.length; ++i) {
|
for (var i = 0; i < data.args.length; ++i) {
|
||||||
try {
|
try {
|
||||||
core.setFlag('arg'+(i+1), core.calValue(data.args[i], prefix));
|
if (data.args[i] != null)
|
||||||
|
core.setFlag('arg'+(i+1), data.args[i]);
|
||||||
} catch (e) { main.log(e); }
|
} catch (e) { main.log(e); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.name) { // 公共事件
|
if (data.name) { // 公共事件
|
||||||
core.setFlag('arg0', data.name);
|
core.setFlag('arg0', data.name);
|
||||||
core.insertAction(this.getCommonEvent(data.name));
|
core.insertAction(data.name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||||
@ -1182,6 +1207,10 @@ events.prototype._action_insert = function (data, x, y, prefix) {
|
|||||||
core.doAction();
|
core.doAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype._action_addToList = function (data, x, y, prefix) {
|
||||||
|
core.doAction();
|
||||||
|
}
|
||||||
|
|
||||||
events.prototype._action_playBgm = function (data, x, y, prefix) {
|
events.prototype._action_playBgm = function (data, x, y, prefix) {
|
||||||
core.playBgm(data.name);
|
core.playBgm(data.name);
|
||||||
core.doAction();
|
core.doAction();
|
||||||
@ -2199,7 +2228,7 @@ events.prototype.uploadCurrent = function (username) {
|
|||||||
formData.append('type', 'score');
|
formData.append('type', 'score');
|
||||||
formData.append('name', core.firstData.name);
|
formData.append('name', core.firstData.name);
|
||||||
formData.append('version', core.firstData.version);
|
formData.append('version', core.firstData.version);
|
||||||
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
|
formData.append('platform', core.platform.string);
|
||||||
formData.append('hard', core.encodeBase64(core.status.hard));
|
formData.append('hard', core.encodeBase64(core.status.hard));
|
||||||
formData.append('username', core.encodeBase64(username || "current"));
|
formData.append('username', core.encodeBase64(username || "current"));
|
||||||
formData.append('lv', core.status.hero.lv);
|
formData.append('lv', core.status.hero.lv);
|
||||||
|
|||||||
@ -311,20 +311,17 @@ items.prototype.unloadEquip = function (equipType, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
|
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
|
||||||
var compareAtk = 0, compareDef = 0, compareMdef = 0;
|
var result = {};
|
||||||
if (compareEquipId) {
|
var first = core.material.items[compareEquipId], second = core.material.items[beComparedEquipId];
|
||||||
var compareEquip = core.material.items[compareEquipId];
|
for (var name in core.status.hero) {
|
||||||
compareAtk += (compareEquip.equip || {}).atk || 0;
|
if (typeof core.status.hero[name] == 'number') {
|
||||||
compareDef += (compareEquip.equip || {}).def || 0;
|
var ans = 0;
|
||||||
compareMdef += (compareEquip.equip || {}).mdef || 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;
|
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.unloadEquip(type);
|
||||||
this.loadEquip(loadId);
|
this.loadEquip(loadId);
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
|
|||||||
21
libs/maps.js
21
libs/maps.js
@ -30,11 +30,14 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
map = {"map": map};
|
map = {"map": map};
|
||||||
}
|
}
|
||||||
var content = {};
|
var content = {};
|
||||||
["floorId", "title", "name", "canFlyTo", "canUseQuickShop", "cannotViewMap", "cannotMoveDirectly", "color", "weather",
|
for (var name in floor) {
|
||||||
"defaultGround", "images", "item_ratio", "upFloor", "bgm", "downFloor", "underGround"].forEach(function (e) {
|
if (name != 'map' && name != 'bgmap' && name != 'fgmap' && floor[name] != null)
|
||||||
if (map[e] != null) content[e] = core.clone(map[e]);
|
content[name] = core.clone(floor[name]);
|
||||||
else content[e] = core.clone(floor[e]);
|
}
|
||||||
});
|
for (var name in map) {
|
||||||
|
if (name != 'map' && name != 'bgmap' && name != 'fgmap' && map[name] != null)
|
||||||
|
content[name] = core.clone(map[name]);
|
||||||
|
}
|
||||||
map = this.decompressMap(map.map, floorId);
|
map = this.decompressMap(map.map, floorId);
|
||||||
// 事件处理
|
// 事件处理
|
||||||
content['blocks'] = this._mapIntoBlocks(map, floor, floorId);
|
content['blocks'] = this._mapIntoBlocks(map, floor, floorId);
|
||||||
@ -1696,6 +1699,7 @@ maps.prototype.animateBlock = function (loc, type, time, callback) {
|
|||||||
var isHide = type == 'hide';
|
var isHide = type == 'hide';
|
||||||
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
||||||
loc = [loc];
|
loc = [loc];
|
||||||
|
// --- 检测所有是0的点
|
||||||
var list = this._animateBlock_getList(loc);
|
var list = this._animateBlock_getList(loc);
|
||||||
if (list.length == 0) {
|
if (list.length == 0) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
@ -1714,6 +1718,7 @@ maps.prototype._animateBlock_doAnimate = function (loc, list, isHide, delta, cal
|
|||||||
delete core.animateFrame.asyncId[animate];
|
delete core.animateFrame.asyncId[animate];
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
list.forEach(function (t) {
|
list.forEach(function (t) {
|
||||||
|
if (t.blockInfo)
|
||||||
core.maps._deleteDetachedBlock(t.canvases);
|
core.maps._deleteDetachedBlock(t.canvases);
|
||||||
});
|
});
|
||||||
loc.forEach(function (t) {
|
loc.forEach(function (t) {
|
||||||
@ -1735,7 +1740,10 @@ maps.prototype._animateBlock_getList = function (loc) {
|
|||||||
block = block.block;
|
block = block.block;
|
||||||
|
|
||||||
var blockInfo = core.maps.getBlockInfo(block);
|
var blockInfo = core.maps.getBlockInfo(block);
|
||||||
if (blockInfo == null) return;
|
if (blockInfo == null) {
|
||||||
|
list.push({ 'x': t[0], 'y': t[1] });
|
||||||
|
return;
|
||||||
|
}
|
||||||
var canvases = core.maps._initDetachedBlock(blockInfo, t[0], t[1], block.event.displayDamage !== false);
|
var canvases = core.maps._initDetachedBlock(blockInfo, t[0], t[1], block.event.displayDamage !== false);
|
||||||
|
|
||||||
list.push({
|
list.push({
|
||||||
@ -1748,6 +1756,7 @@ maps.prototype._animateBlock_getList = function (loc) {
|
|||||||
|
|
||||||
maps.prototype._animateBlock_drawList = function (list, opacity) {
|
maps.prototype._animateBlock_drawList = function (list, opacity) {
|
||||||
list.forEach(function (t) {
|
list.forEach(function (t) {
|
||||||
|
if (t.blockInfo)
|
||||||
core.maps._moveDetachedBlock(t.blockInfo, t.x * 32, t.y * 32, opacity, t.canvases);
|
core.maps._moveDetachedBlock(t.blockInfo, t.x * 32, t.y * 32, opacity, t.canvases);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
929
libs/ui.js
929
libs/ui.js
File diff suppressed because it is too large
Load Diff
@ -348,6 +348,12 @@ utils.prototype.formatDate2 = function (date) {
|
|||||||
+ core.setTwoDigits(date.getHours()) + core.setTwoDigits(date.getMinutes()) + core.setTwoDigits(date.getSeconds());
|
+ core.setTwoDigits(date.getHours()) + core.setTwoDigits(date.getMinutes()) + core.setTwoDigits(date.getSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.prototype.formatTime = function (time) {
|
||||||
|
return core.setTwoDigits(parseInt(time/3600000))
|
||||||
|
+":"+core.setTwoDigits(parseInt(time/60000)%60)
|
||||||
|
+":"+core.setTwoDigits(parseInt(time/1000)%60);
|
||||||
|
}
|
||||||
|
|
||||||
////// 两位数显示 //////
|
////// 两位数显示 //////
|
||||||
utils.prototype.setTwoDigits = function (x) {
|
utils.prototype.setTwoDigits = function (x) {
|
||||||
return parseInt(x) < 10 ? "0" + x : x;
|
return parseInt(x) < 10 ? "0" + x : x;
|
||||||
@ -461,6 +467,8 @@ utils.prototype._encodeRoute_encodeOne = function (t) {
|
|||||||
return "P" + t.substring(6);
|
return "P" + t.substring(6);
|
||||||
else if (t.indexOf('input2:') == 0)
|
else if (t.indexOf('input2:') == 0)
|
||||||
return "Q" + t.substring(7) + ":";
|
return "Q" + t.substring(7) + ":";
|
||||||
|
else if (t.indexOf('common:') == 0)
|
||||||
|
return "c" + t.substring(7) + ":";
|
||||||
else if (t == 'no')
|
else if (t == 'no')
|
||||||
return 'N';
|
return 'N';
|
||||||
else if (t.indexOf('move:') == 0)
|
else if (t.indexOf('move:') == 0)
|
||||||
@ -519,7 +527,7 @@ utils.prototype._decodeRoute_number2id = function (number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
|
utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
|
||||||
var nxt = (c == 'I' || c == 'e' || c == 'F' || c == 'S' || c == 'Q' || c == 't') ?
|
var nxt = (c == 'I' || c == 'e' || c == 'F' || c == 'S' || c == 'Q' || c == 't' || c == 'c') ?
|
||||||
this._decodeRoute_getString(decodeObj) : this._decodeRoute_getNumber(decodeObj);
|
this._decodeRoute_getString(decodeObj) : this._decodeRoute_getNumber(decodeObj);
|
||||||
|
|
||||||
var mp = {"U": "up", "D": "down", "L": "left", "R": "right"};
|
var mp = {"U": "up", "D": "down", "L": "left", "R": "right"};
|
||||||
@ -564,6 +572,9 @@ utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
|
|||||||
case "Q":
|
case "Q":
|
||||||
decodeObj.ans.push("input2:" + nxt);
|
decodeObj.ans.push("input2:" + nxt);
|
||||||
break;
|
break;
|
||||||
|
case "c":
|
||||||
|
decodeObj.ans.push("common:" + nxt);
|
||||||
|
break;
|
||||||
case "N":
|
case "N":
|
||||||
decodeObj.ans.push("no");
|
decodeObj.ans.push("no");
|
||||||
break;
|
break;
|
||||||
|
|||||||
2
main.js
2
main.js
@ -675,7 +675,7 @@ window.onblur = function () {
|
|||||||
if (main.core && main.core.control) {
|
if (main.core && main.core.control) {
|
||||||
try {
|
try {
|
||||||
main.core.control.checkAutosave();
|
main.core.control.checkAutosave();
|
||||||
} catch (e) {main.log(e);}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -249,6 +249,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"name": "贪婪之神",
|
"name": "贪婪之神",
|
||||||
"icon": "blueShop",
|
"icon": "blueShop",
|
||||||
"textInList": "1F金币商店",
|
"textInList": "1F金币商店",
|
||||||
|
"commonTimes": false,
|
||||||
|
"mustEnable": false,
|
||||||
"use": "money",
|
"use": "money",
|
||||||
"need": "20+10*times*(times+1)",
|
"need": "20+10*times*(times+1)",
|
||||||
"text": "勇敢的武士啊,给我${need}金币就可以:",
|
"text": "勇敢的武士啊,给我${need}金币就可以:",
|
||||||
@ -276,6 +278,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"name": "经验之神",
|
"name": "经验之神",
|
||||||
"icon": "pinkShop",
|
"icon": "pinkShop",
|
||||||
"textInList": "1F经验商店",
|
"textInList": "1F经验商店",
|
||||||
|
"commonTimes": false,
|
||||||
|
"mustEnable": false,
|
||||||
"use": "experience",
|
"use": "experience",
|
||||||
"need": "-1",
|
"need": "-1",
|
||||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
"text": "勇敢的武士啊,给我若干经验就可以:",
|
||||||
@ -296,6 +300,13 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"effect": "status:def+=5"
|
"effect": "status:def+=5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "keyShop1",
|
||||||
|
"textInList": "1F回收钥匙商店",
|
||||||
|
"mustEnable": false,
|
||||||
|
"commonEvent": "回收钥匙商店",
|
||||||
|
"args": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"levelUp": [
|
"levelUp": [
|
||||||
@ -397,6 +408,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"enableMoveDirectly": true,
|
"enableMoveDirectly": true,
|
||||||
"enableDisabledShop": true,
|
"enableDisabledShop": true,
|
||||||
"disableShopOnDamage": false,
|
"disableShopOnDamage": false,
|
||||||
|
"quickCommonEvents": false,
|
||||||
"checkConsole": false
|
"checkConsole": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,6 +237,100 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
],
|
],
|
||||||
"false": []
|
"false": []
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"回收钥匙商店": [
|
||||||
|
{
|
||||||
|
"type": "comment",
|
||||||
|
"text": "此事件在全局商店中被引用了(全局商店keyShop1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "comment",
|
||||||
|
"text": "解除引用前勿删除此事件"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "comment",
|
||||||
|
"text": "玩家在快捷列表(V键)中可以使用本公共事件"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "while",
|
||||||
|
"condition": "1",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"type": "choices",
|
||||||
|
"text": "\t[商人,woman]你有多余的钥匙想要出售吗?",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"text": "黄钥匙(10金币)",
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"action": [
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "item:yellowKey >= 1",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "item:yellowKey",
|
||||||
|
"value": "-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "status:money",
|
||||||
|
"value": "10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"false": [
|
||||||
|
"\t[商人,woman]你没有黄钥匙!"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "蓝钥匙(50金币)",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"action": [
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "item:blueKey >= 1",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "item:blueKey",
|
||||||
|
"value": "-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "status:money",
|
||||||
|
"value": "50"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"false": [
|
||||||
|
"\t[商人,woman]你没有蓝钥匙!"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "离开",
|
||||||
|
"action": [
|
||||||
|
{
|
||||||
|
"type": "exit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,7 +699,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
gid = guards[i][2];
|
gid = guards[i][2];
|
||||||
// 递归计算支援怪伤害信息,这里不传x,y保证不会重复调用
|
// 递归计算支援怪伤害信息,这里不传x,y保证不会重复调用
|
||||||
// 这里的mdef传0,因为护盾应该只会被计算一次
|
// 这里的mdef传0,因为护盾应该只会被计算一次
|
||||||
var info = core.enemys.getDamageInfo(core.material.enemys[gid], origin_hero_hp, origin_hero_atk, origin_hero_def, 0);
|
var info = core.enemys.getDamageInfo(core.material.enemys[gid], { hp: origin_hero_hp, atk: origin_hero_atk, def: origin_hero_def, mdef: 0 });
|
||||||
if (info == null) { // 小队中任何一个怪物不可战斗,直接返回null
|
if (info == null) { // 小队中任何一个怪物不可战斗,直接返回null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -259,7 +259,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
|||||||
"hammer": 48,
|
"hammer": 48,
|
||||||
"jumpShoes": 49,
|
"jumpShoes": 49,
|
||||||
"skill1": 30,
|
"skill1": 30,
|
||||||
"I73": 10
|
"wand": 10
|
||||||
},
|
},
|
||||||
"autotile": {
|
"autotile": {
|
||||||
"autotile": 0,
|
"autotile": 0,
|
||||||
|
|||||||
@ -303,7 +303,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"text": "可以打开或关闭主动技能二倍斩",
|
"text": "可以打开或关闭主动技能二倍斩",
|
||||||
"hideInReplay": true
|
"hideInReplay": true
|
||||||
},
|
},
|
||||||
"I73": {
|
"wand": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
"name": "新物品"
|
"name": "新物品"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
|||||||
"70": {"cls":"items","id":"sword0"},
|
"70": {"cls":"items","id":"sword0"},
|
||||||
"71": {"cls":"items","id":"shield0"},
|
"71": {"cls":"items","id":"shield0"},
|
||||||
"72": {"cls":"items","id":"skill1"},
|
"72": {"cls":"items","id":"skill1"},
|
||||||
"73": {"cls":"items","id":"I73"},
|
"73": {"cls":"items","id":"wand"},
|
||||||
"81": {"cls":"terrains","id":"yellowDoor","trigger":"openDoor"},
|
"81": {"cls":"terrains","id":"yellowDoor","trigger":"openDoor"},
|
||||||
"82": {"cls":"terrains","id":"blueDoor","trigger":"openDoor"},
|
"82": {"cls":"terrains","id":"blueDoor","trigger":"openDoor"},
|
||||||
"83": {"cls":"terrains","id":"redDoor","trigger":"openDoor"},
|
"83": {"cls":"terrains","id":"redDoor","trigger":"openDoor"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user