Merge pull request #63 from zhaouv/dev-2.0-functions-20180227
Dev 2 0 functions 20180227
This commit is contained in:
commit
646572f5d8
@ -1,9 +1,10 @@
|
||||
function events() {
|
||||
this.init();
|
||||
}
|
||||
var eventdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;
|
||||
|
||||
////// 初始化 //////
|
||||
events.prototype.init = function () {
|
||||
this.eventdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;
|
||||
this.events = {
|
||||
'battle': function (data, core, callback) {
|
||||
//core.autosave(true);
|
||||
@ -101,16 +102,19 @@ events.prototype.startGame = function (hard) {
|
||||
}
|
||||
|
||||
////// 不同难度分别设置初始属性 //////
|
||||
events.prototype.setInitData = eventdata.setInitData
|
||||
// function (hard)
|
||||
events.prototype.setInitData = function (hard) {
|
||||
return this.eventdata.setInitData(hard);
|
||||
}
|
||||
|
||||
////// 游戏获胜事件 //////
|
||||
events.prototype.win = eventdata.win
|
||||
// function(reason)
|
||||
events.prototype.win = function (reason) {
|
||||
return this.eventdata.win(reason);
|
||||
}
|
||||
|
||||
////// 游戏失败事件 //////
|
||||
events.prototype.lose = eventdata.lose
|
||||
// function(reason)
|
||||
events.prototype.lose = function (reason) {
|
||||
return this.eventdata.lose(reason);
|
||||
}
|
||||
|
||||
////// 游戏结束 //////
|
||||
events.prototype.gameOver = function (ending, fromReplay) {
|
||||
@ -188,8 +192,9 @@ events.prototype.gameOver = function (ending, fromReplay) {
|
||||
}
|
||||
|
||||
////// 转换楼层结束的事件 //////
|
||||
events.prototype.afterChangeFloor = eventdata.afterChangeFloor
|
||||
// function (floorId)
|
||||
events.prototype.afterChangeFloor = function (floorId) {
|
||||
return this.eventdata.afterChangeFloor(floorId);
|
||||
}
|
||||
|
||||
////// 开始执行一系列自定义事件 //////
|
||||
events.prototype.doEvents = function (list, x, y, callback) {
|
||||
@ -1027,16 +1032,19 @@ events.prototype.useItem = function(itemId) {
|
||||
}
|
||||
|
||||
////// 加点事件 //////
|
||||
events.prototype.addPoint = eventdata.addPoint
|
||||
// function (enemy)
|
||||
events.prototype.addPoint = function (enemy) {
|
||||
return this.eventdata.addPoint(enemy);
|
||||
}
|
||||
|
||||
////// 战斗结束后触发的事件 //////
|
||||
events.prototype.afterBattle = eventdata.afterBattle
|
||||
// function(enemyId,x,y,callback)
|
||||
events.prototype.afterBattle = function (enemyId,x,y,callback) {
|
||||
return this.eventdata.afterBattle(enemyId,x,y,callback);
|
||||
}
|
||||
|
||||
////// 开一个门后触发的事件 //////
|
||||
events.prototype.afterOpenDoor = eventdata.afterOpenDoor
|
||||
// function(doorId,x,y,callback)
|
||||
events.prototype.afterOpenDoor = function (doorId,x,y,callback) {
|
||||
return this.eventdata.afterOpenDoor(doorId,x,y,callback);
|
||||
}
|
||||
|
||||
////// 经过一个路障 //////
|
||||
events.prototype.passNet = function (data) {
|
||||
@ -1087,8 +1095,9 @@ events.prototype.changeLight = function(x, y) {
|
||||
}
|
||||
|
||||
////// 改变亮灯之后,可以触发的事件 //////
|
||||
events.prototype.afterChangeLight = eventdata.afterChangeLight
|
||||
// function(x,y)
|
||||
events.prototype.afterChangeLight = function (x,y) {
|
||||
return this.eventdata.afterChangeLight(x,y);
|
||||
}
|
||||
|
||||
////// 滑冰 //////
|
||||
events.prototype.ski = function (direction) {
|
||||
@ -1165,21 +1174,23 @@ events.prototype.pushBox = function (data) {
|
||||
}
|
||||
|
||||
////// 推箱子后的事件 //////
|
||||
events.prototype.afterPushBox = eventdata.afterPushBox
|
||||
// function ()
|
||||
events.prototype.afterPushBox = function () {
|
||||
return this.eventdata.afterPushBox();
|
||||
}
|
||||
|
||||
////// 使用炸弹/圣锤后的事件 //////
|
||||
events.prototype.afterUseBomb = eventdata.afterUseBomb
|
||||
// function ()
|
||||
events.prototype.afterUseBomb = function () {
|
||||
return this.eventdata.afterUseBomb();
|
||||
}
|
||||
|
||||
////// 即将存档前可以执行的操作 //////
|
||||
events.prototype.beforeSaveData = eventdata.beforeSaveData
|
||||
// function(data)
|
||||
events.prototype.beforeSaveData = function (data) {
|
||||
return this.eventdata.beforeSaveData(data);
|
||||
}
|
||||
|
||||
////// 读档事件后,载入事件前,可以执行的操作 //////
|
||||
events.prototype.afterLoadData = eventdata.afterLoadData
|
||||
// function(data)
|
||||
events.prototype.afterLoadData = function (data) {
|
||||
return this.eventdata.afterLoadData(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
delete(eventdata);
|
||||
@ -6,10 +6,10 @@
|
||||
function ui() {
|
||||
this.init();
|
||||
}
|
||||
var uidata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui;
|
||||
|
||||
// 初始化UI
|
||||
ui.prototype.init = function () {
|
||||
|
||||
this.uidata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui;
|
||||
}
|
||||
|
||||
////////////////// 地图设置
|
||||
@ -1626,7 +1626,9 @@ ui.prototype.drawKeyBoard = function () {
|
||||
}
|
||||
|
||||
////// 绘制“关于”界面 //////
|
||||
ui.prototype.drawAbout = uidata.drawAbout
|
||||
ui.prototype.drawAbout = function () {
|
||||
return this.uidata.drawAbout();
|
||||
}
|
||||
|
||||
////// 绘制帮助页面 //////
|
||||
ui.prototype.drawHelp = function () {
|
||||
@ -1657,4 +1659,3 @@ ui.prototype.drawHelp = function () {
|
||||
]);
|
||||
}
|
||||
|
||||
delete(uidata)
|
||||
@ -40,6 +40,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"defaultGround": "默认地面的图块ID(terrains中) ",
|
||||
"png": "背景图;你可以选择一张png图片来作为背景素材。详细用法请参见文档“自定义素材”中的说明。 \n$leaf(true)$end",
|
||||
"color": "该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。 \n$leaf(true)$end",
|
||||
"weather": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\"或\"snow\"代表雨雪,第二项为1-10之间的数代表强度。 \n$leaf(true)$end",
|
||||
"bgm": "到达该层后默认播放的BGM。本项可忽略。 ",
|
||||
//"map": "地图数据,需要是13x13,建议使用地图生成器来生成 ",
|
||||
"firstArrive": "第一次到该楼层触发的事件 \n$leaf(true)$end",
|
||||
|
||||
@ -19,7 +19,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
if (hard=='Hell') { // 噩梦难度
|
||||
core.setFlag('hard', 4); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
this.afterLoadData();
|
||||
core.events.afterLoadData();
|
||||
},
|
||||
////// 游戏获胜事件 //////
|
||||
"win" : function(reason) {
|
||||
@ -54,7 +54,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
if (core.isset(core.status.event.id)) return; // 当前存在事件
|
||||
|
||||
if (!core.hasFlag("visited_"+floorId)) {
|
||||
this.doEvents(core.floors[floorId].firstArrive, null, null, function () {
|
||||
core.events.doEvents(core.floors[floorId].firstArrive, null, null, function () {
|
||||
//core.autosave();
|
||||
});
|
||||
core.setFlag("visited_"+floorId, true);
|
||||
@ -174,7 +174,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
// 如果事件不为空,将其插入
|
||||
if (todo.length>0) {
|
||||
this.insertAction(todo,x,y);
|
||||
core.events.insertAction(todo,x,y);
|
||||
}
|
||||
|
||||
// 如果已有事件正在处理中
|
||||
@ -199,7 +199,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
|
||||
if (todo.length>0) {
|
||||
this.insertAction(todo,x,y);
|
||||
core.events.insertAction(todo,x,y);
|
||||
}
|
||||
|
||||
if (core.status.event.id == null) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user