forward core

This commit is contained in:
oc 2019-03-09 21:25:46 +08:00
parent bf11ff6d18
commit 6b058c7be0
13 changed files with 69 additions and 1204 deletions

View File

@ -6,10 +6,10 @@ actions.js用户交互的事件的处理
"use strict"; "use strict";
function actions() { function actions() {
this.init(); this._init();
} }
actions.prototype.init = function () { actions.prototype._init = function () {
this.actionsdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.actions; this.actionsdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.actions;
this.actions = {}; this.actions = {};
// --- onkeyDown注册 // --- onkeyDown注册
@ -66,10 +66,10 @@ actions.prototype.init = function () {
* 返回如果func返回true则不会再继续执行其他的交互函数否则会继续执行其他的交互函数 * 返回如果func返回true则不会再继续执行其他的交互函数否则会继续执行其他的交互函数
*/ */
actions.prototype.registerAction = function (action, name, func, priority) { actions.prototype.registerAction = function (action, name, func, priority) {
if (!core.isset(name) || !core.isset(func) || !(func instanceof Function)) if (!name || !func || !(func instanceof Function))
return; return;
priority = priority || 0; priority = priority || 0;
if (!core.isset(this.actions[action])) { if (!this.actions[action]) {
this.actions[action] = []; this.actions[action] = [];
} }
this.unregisterAction(action, name); this.unregisterAction(action, name);
@ -83,7 +83,7 @@ actions.prototype.registerAction = function (action, name, func, priority) {
////// 注销一个用户交互行为 ////// ////// 注销一个用户交互行为 //////
actions.prototype.unregisterAction = function (action, name) { actions.prototype.unregisterAction = function (action, name) {
if (!core.isset(this.actions[action])) return; if (!this.actions[action]) return;
this.actions[action] = this.actions[action].filter(function (x) { return x.name != name; }); this.actions[action] = this.actions[action].filter(function (x) { return x.name != name; });
} }
@ -1261,7 +1261,7 @@ actions.prototype._clickToolboxIndex = function(index) {
if (select>=items.length) return; if (select>=items.length) return;
var itemId=items[select]; var itemId=items[select];
if (itemId==core.status.event.data.selectId) { if (itemId==core.status.event.data.selectId) {
core.events.useItem(itemId); core.events.tryUseItem(itemId);
} }
else { else {
core.ui.drawToolbox(index); core.ui.drawToolbox(index);

View File

@ -7,10 +7,10 @@ control.js游戏主要逻辑控制
"use strict"; "use strict";
function control() { function control() {
this.init(); this._init();
} }
control.prototype.init = function () { control.prototype._init = function () {
this.controldata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.control; this.controldata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.control;
} }
@ -2430,7 +2430,7 @@ control.prototype.saveData = function() {
'floorId': core.status.floorId, 'floorId': core.status.floorId,
'hero': hero, 'hero': hero,
'hard': core.status.hard, 'hard': core.status.hard,
'maps': core.maps.save(core.status.maps), 'maps': core.maps.saveMap(core.status.maps),
'route': core.encodeRoute(core.status.route), 'route': core.encodeRoute(core.status.route),
'values': core.clone(core.values), 'values': core.clone(core.values),
'shops': {}, 'shops': {},
@ -2453,7 +2453,7 @@ control.prototype.saveData = function() {
////// 从本地读档 ////// ////// 从本地读档 //////
control.prototype.loadData = function (data, callback) { control.prototype.loadData = function (data, callback) {
core.resetStatus(data.hero, data.hard, data.floorId, core.decodeRoute(data.route), core.maps.load(data.maps), core.resetStatus(data.hero, data.hard, data.floorId, core.decodeRoute(data.route), core.maps.loadMap(data.maps),
data.values); data.values);
// load shop times // load shop times

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
"use strict"; "use strict";
function data() { function data() {
this.init(); this._init();
} }
data.prototype.init = function() { data.prototype._init = function() {
this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData; this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData;
this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values; this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values;
this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags; this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags;

View File

@ -1,11 +1,11 @@
"use strict"; "use strict";
function enemys() { function enemys() {
this.init(); this._init();
} }
////// 初始化 ////// ////// 初始化 //////
enemys.prototype.init = function () { enemys.prototype._init = function () {
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80; this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys; this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys;
if (main.mode=='play') { if (main.mode=='play') {

View File

@ -1,11 +1,11 @@
"use strict"; "use strict";
function events() { function events() {
this.init(); this._init();
} }
////// 初始化 ////// ////// 初始化 //////
events.prototype.init = function () { events.prototype._init = function () {
this.eventdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events; this.eventdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;
this.commonEvent = events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent; this.commonEvent = events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent;
this.events = { this.events = {
@ -2088,7 +2088,7 @@ events.prototype.checkLvUp = function () {
} }
////// 尝试使用道具 ////// ////// 尝试使用道具 //////
events.prototype.useItem = function(itemId) { events.prototype.tryUseItem = function(itemId) {
core.ui.closePanel(); core.ui.closePanel();
if (itemId=='book') { if (itemId=='book') {

View File

@ -1,10 +1,10 @@
"use strict"; "use strict";
function icons() { function icons() {
this.init(); this._init();
} }
icons.prototype.init = function () { icons.prototype._init = function () {
this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1; this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
//delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1); //delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1);

View File

@ -1,17 +1,17 @@
"use strict"; "use strict";
function items() { function items() {
this.init(); this._init();
} }
////// 初始化 ////// ////// 初始化 //////
items.prototype.init = function () { items.prototype._init = function () {
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items; this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect; this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip; this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect; this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect; this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
if (!core.isset(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip)) if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip)
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip = {}; items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip = {};
this.canEquip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip; this.canEquip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip;

View File

@ -5,10 +5,10 @@ loader.js负责对资源的加载
"use strict"; "use strict";
function loader() { function loader() {
this.init(); this._init();
} }
loader.prototype.init = function () { loader.prototype._init = function () {
} }
@ -22,7 +22,7 @@ loader.prototype.setStartLoadTipText = function (text) {
core.dom.startTopLoadTips.innerHTML = text; core.dom.startTopLoadTips.innerHTML = text;
} }
loader.prototype.load = function (callback) { loader.prototype._load = function (callback) {
// 加载icons // 加载icons
core.loader.loadIcons(); core.loader.loadIcons();

View File

@ -1,10 +1,10 @@
"use strict"; "use strict";
function maps() { function maps() {
this.init(); this._init();
} }
maps.prototype.init = function() { maps.prototype._init = function() {
this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e; this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
//delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e); //delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
} }
@ -246,11 +246,11 @@ maps.prototype.decompressMap = function (mapArr, floorId) {
} }
////// 将当前地图重新变成数字,以便于存档 ////// ////// 将当前地图重新变成数字,以便于存档 //////
maps.prototype.save = function(maps, floorId) { maps.prototype.saveMap = function(maps, floorId) {
if (!core.isset(floorId)) { if (!core.isset(floorId)) {
var map = {}; var map = {};
for (var id in maps) { for (var id in maps) {
map[id] = this.save(maps, id); map[id] = this.saveMap(maps, id);
} }
return map; return map;
} }
@ -308,7 +308,7 @@ maps.prototype.resizeMap = function(floorId) {
} }
////// 将存档中的地图信息重新读取出来 ////// ////// 将存档中的地图信息重新读取出来 //////
maps.prototype.load = function (data, floorId) { maps.prototype.loadMap = function (data, floorId) {
if (!core.isset(floorId)) { if (!core.isset(floorId)) {
var map = {}; var map = {};
core.floorIds.forEach(function (id) { core.floorIds.forEach(function (id) {

View File

@ -7,11 +7,11 @@
"use strict"; "use strict";
function ui() { function ui() {
this.init(); this._init();
} }
// 初始化UI // 初始化UI
ui.prototype.init = function () { ui.prototype._init = function () {
this.uidata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui; this.uidata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui;
} }
@ -2091,7 +2091,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 30, '#FFFFFF', "bold 17px "+globalFont); core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 30, '#FFFFFF', "bold 17px "+globalFont);
core.strokeRect('ui', (2*i+1)*u-size/2, 45, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2); core.strokeRect('ui', (2*i+1)*u-size/2, 45, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) { if (core.isset(data) && core.isset(data.floorId)) {
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 45, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); core.ui.drawThumbnail(data.floorId, 'ui', core.maps.loadMap(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 45, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true); var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true);
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true); var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
if (v.length+v2.length<=21) v+=v2; if (v.length+v2.length<=21) v+=v2;
@ -2107,7 +2107,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
core.fillText('ui', name+id, (2*i-5)*u, 218, '#FFFFFF', "bold 17px "+globalFont); core.fillText('ui', name+id, (2*i-5)*u, 218, '#FFFFFF', "bold 17px "+globalFont);
core.strokeRect('ui', (2*i-5)*u-size/2, 233, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2); core.strokeRect('ui', (2*i-5)*u-size/2, 233, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) { if (core.isset(data) && core.isset(data.floorId)) {
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 233, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); core.ui.drawThumbnail(data.floorId, 'ui', core.maps.loadMap(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 233, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true); var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true);
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true); var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
if (v.length+v2.length<=21) v+=v2; if (v.length+v2.length<=21) v+=v2;

View File

@ -6,7 +6,7 @@ utils.js 工具类
"use strict"; "use strict";
function utils() { function utils() {
this.init(); this._init();
this.scan = { this.scan = {
'up': {'x': 0, 'y': -1}, 'up': {'x': 0, 'y': -1},
'left': {'x': -1, 'y': 0}, 'left': {'x': -1, 'y': 0},
@ -15,7 +15,7 @@ function utils() {
}; };
} }
utils.prototype.init = function () { utils.prototype._init = function () {
// 定义Object.assign // 定义Object.assign
if (typeof Object.assign != "function") { if (typeof Object.assign != "function") {
Object.assign = function(target, varArgs) { // .length of function is 2 Object.assign = function(target, varArgs) { // .length of function is 2

View File

@ -848,7 +848,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
break; break;
case 51: // 快捷键3: 飞 case 51: // 快捷键3: 飞
if (core.hasItem('centerFly')) { if (core.hasItem('centerFly')) {
core.events.useItem('centerFly'); core.events.tryUseItem('centerFly');
} }
break; break;
case 52: // 快捷键4破冰/冰冻/地震/上下楼器/... 其他道具依次判断 case 52: // 快捷键4破冰/冰冻/地震/上下楼器/... 其他道具依次判断