Merge branch 'ckcz123-master'
This commit is contained in:
commit
4d7233d502
111
libs/core.js
111
libs/core.js
@ -470,28 +470,36 @@ core.prototype.keyUp = function(keyCode) {
|
||||
|
||||
switch (keyCode) {
|
||||
case 27: // ESC
|
||||
core.ui.drawSettings(true);
|
||||
if (core.status.heroStop)
|
||||
core.ui.drawSettings(true);
|
||||
break;
|
||||
case 71: // G
|
||||
core.useFly(true);
|
||||
if (core.status.heroStop)
|
||||
core.useFly(true);
|
||||
break;
|
||||
case 88: // X
|
||||
core.openBook(true);
|
||||
if (core.status.heroStop)
|
||||
core.openBook(true);
|
||||
break;
|
||||
case 83: // S
|
||||
core.save(true);
|
||||
if (core.status.heroStop)
|
||||
core.save(true);
|
||||
break;
|
||||
case 68: // D
|
||||
core.load(true);
|
||||
if (core.status.heroStop)
|
||||
core.load(true);
|
||||
break;
|
||||
case 84: // T
|
||||
core.openToolbox(true);
|
||||
if (core.status.heroStop)
|
||||
core.openToolbox(true);
|
||||
break;
|
||||
case 90: // Z
|
||||
core.turnHero();
|
||||
if (core.status.heroStop)
|
||||
core.turnHero();
|
||||
break;
|
||||
case 75: // K
|
||||
core.ui.drawQuickShop(true);
|
||||
if (core.status.heroStop)
|
||||
core.ui.drawQuickShop(true);
|
||||
break;
|
||||
case 37: // UP
|
||||
break;
|
||||
@ -1136,10 +1144,10 @@ core.prototype.setHeroMoveTriggerInterval = function () {
|
||||
direction = core.getHeroLoc('direction');
|
||||
x = core.getHeroLoc('x');
|
||||
y = core.getHeroLoc('y');
|
||||
var noPass;
|
||||
noPass = core.noPass(x + scan[direction].x, y + scan[direction].y);
|
||||
if (noPass) {
|
||||
core.trigger(x + scan[direction].x, y + scan[direction].y);
|
||||
var noPass = core.noPass(x + scan[direction].x, y + scan[direction].y), canMove = core.canMove();
|
||||
if (noPass || !canMove) {
|
||||
if (canMove) // 非箭头:触发
|
||||
core.trigger(x + scan[direction].x, y + scan[direction].y);
|
||||
core.drawHero(direction, x, y, 'stop');
|
||||
if (core.status.autoHeroMove) {
|
||||
core.status.movedStep++;
|
||||
@ -1191,32 +1199,28 @@ core.prototype.turnHero = function(direction) {
|
||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
||||
}
|
||||
|
||||
core.prototype.moveHero = function (direction) {
|
||||
core.setHeroLoc('direction', direction);
|
||||
core.status.heroStop = false;
|
||||
var nowX = core.getHeroLoc('x');
|
||||
var nowY = core.getHeroLoc('y');
|
||||
var nowId, nowBlock = core.getBlock(nowX,nowY);
|
||||
core.prototype.canMove = function() {
|
||||
var direction = core.getHeroLoc('direction');
|
||||
var nowBlock = core.getBlock(core.getHeroLoc('x'),core.getHeroLoc('y'));
|
||||
if (nowBlock!=null){
|
||||
nowId = nowBlock.block.event.id;
|
||||
var nowIsArrow = nowId.slice(0, 5).toLowerCase() == 'arrow';
|
||||
if(nowIsArrow){
|
||||
var nowArrow = nowId.slice(5).toLowerCase();
|
||||
if (direction != nowArrow) {
|
||||
core.status.heroStop = true;
|
||||
core.turnHero(direction);
|
||||
// core.status.heroStop = true;
|
||||
// core.turnHero(direction);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}console.log(direction,nowX,nowY, nowBlock, '1111')
|
||||
}
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
var nextX = nowX + scan[direction].x;
|
||||
var nextY = nowY + scan[direction].y;
|
||||
var nextId, nextBlock = core.getBlock(nextX,nextY);
|
||||
var nextBlock = core.getBlock(core.nextX(),core.nextY());
|
||||
if (nextBlock!=null){
|
||||
nextId = nextBlock.block.event.id;
|
||||
// 遇到单向箭头处理
|
||||
@ -1224,11 +1228,18 @@ core.prototype.moveHero = function (direction) {
|
||||
if(isArrow){
|
||||
var nextArrow = nextId.slice(5).toLowerCase();
|
||||
if ( (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) {
|
||||
core.status.heroStop = true;
|
||||
core.turnHero(direction);
|
||||
// core.status.heroStop = true;
|
||||
// core.turnHero(direction);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}console.log(direction,nextX,nextY, nextBlock, '2222')
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
core.prototype.moveHero = function (direction) {
|
||||
core.setHeroLoc('direction', direction);
|
||||
core.status.heroStop = false;
|
||||
}
|
||||
|
||||
core.prototype.moveOneStep = function() {
|
||||
@ -3022,8 +3033,9 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
var BASE_LINEHEIGHT = 32;
|
||||
var SPACE = 3;
|
||||
var DEFAULT_FONT_SIZE = 16;
|
||||
//适配宽度阈值
|
||||
//适配宽度 422
|
||||
var ADAPT_WIDTH = DEFAULT_CANVAS_WIDTH;
|
||||
var CHANGE_WIDTH = DEFAULT_CANVAS_WIDTH+DEFAULT_BAR_WIDTH;
|
||||
//判断横竖屏
|
||||
var width = clientWidth;
|
||||
var isHorizontal = false;
|
||||
@ -3046,23 +3058,30 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
if (!core.flags.enableDebuff) count--;
|
||||
|
||||
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
||||
|
||||
|
||||
var shopDisplay, mdefDisplay, expDisplay;
|
||||
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
|
||||
expDisplay = core.flags.enableExperience ? 'block' : 'none';
|
||||
|
||||
statusBarBorder = '3px #fff solid';
|
||||
toolBarBorder = '3px #fff solid';
|
||||
var zoom = (ADAPT_WIDTH - width) / 4.22;
|
||||
var aScale = 1 - zoom / 100;
|
||||
|
||||
// 移动端
|
||||
if (width < ADAPT_WIDTH) {
|
||||
var zoom = (ADAPT_WIDTH - width) / 4.22;
|
||||
var scale = 1 - zoom / 100;
|
||||
|
||||
core.domStyle.scale = scale;
|
||||
|
||||
canvasWidth = width;
|
||||
if (width < CHANGE_WIDTH) {
|
||||
if(width < ADAPT_WIDTH){
|
||||
|
||||
core.domStyle.scale = aScale;
|
||||
canvasWidth = width;
|
||||
}else{
|
||||
canvasWidth = DEFAULT_CANVAS_WIDTH;
|
||||
core.domStyle.scale = 1;
|
||||
}
|
||||
|
||||
var scale = core.domStyle.scale
|
||||
var tempWidth = DEFAULT_CANVAS_WIDTH * scale;
|
||||
fontSize = DEFAULT_FONT_SIZE * scale;
|
||||
|
||||
if(!isHorizontal){ //竖屏
|
||||
core.domStyle.screenMode = 'vertical';
|
||||
//显示快捷商店图标
|
||||
@ -3072,14 +3091,14 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
|
||||
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
|
||||
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
|
||||
|
||||
gameGroupHeight = width + tempTopBarH + tempBotBarH;
|
||||
|
||||
gameGroupWidth = width
|
||||
gameGroupHeight = tempWidth + tempTopBarH + tempBotBarH;
|
||||
|
||||
gameGroupWidth = tempWidth
|
||||
canvasTop = tempTopBarH;
|
||||
// canvasLeft = 0;
|
||||
toolBarWidth = statusBarWidth = width;
|
||||
statusBarHeight = tempTopBarH; //一共有3行加上两个padding空隙
|
||||
toolBarWidth = statusBarWidth = canvasWidth;
|
||||
statusBarHeight = tempTopBarH;
|
||||
statusBarBorder = '3px #fff solid';
|
||||
|
||||
statusHeight = scale*BASE_LINEHEIGHT * .8;
|
||||
@ -3087,7 +3106,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
|
||||
toolBarHeight = tempBotBarH;
|
||||
|
||||
toolBarTop = statusBarHeight + width;
|
||||
toolBarTop = statusBarHeight + canvasWidth;
|
||||
toolBarBorder = '3px #fff solid';
|
||||
toolsHeight = scale * BASE_LINEHEIGHT;
|
||||
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
|
||||
@ -3098,8 +3117,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
}else { //横屏
|
||||
core.domStyle.screenMode = 'horizontal';
|
||||
shopDisplay = 'none';
|
||||
gameGroupWidth = width + DEFAULT_BAR_WIDTH * scale;
|
||||
gameGroupHeight = width;
|
||||
gameGroupWidth = tempWidth + DEFAULT_BAR_WIDTH * scale;
|
||||
gameGroupHeight = tempWidth;
|
||||
canvasTop = 0;
|
||||
// canvasLeft = DEFAULT_BAR_WIDTH * scale;
|
||||
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
|
||||
@ -3108,7 +3127,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
|
||||
statusHeight = scale*statusLineHeight * .8;
|
||||
statusLabelsLH = .8 * statusLineHeight *scale;
|
||||
toolBarHeight = width - statusBarHeight;
|
||||
toolBarHeight = canvasWidth - statusBarHeight;
|
||||
toolBarTop = scale*statusLineHeight * count + SPACE * 2;
|
||||
toolBarBorder = '3px #fff solid';
|
||||
toolsHeight = scale * BASE_LINEHEIGHT;
|
||||
|
||||
@ -50,7 +50,7 @@ enemys.prototype.init = function () {
|
||||
'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 15016},
|
||||
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 16},
|
||||
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3, 'bomb': false}, // 吸血怪需要在后面添加value代表吸血比例
|
||||
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
|
||||
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
|
||||
@ -11,7 +11,7 @@ main.floors.sample0 = {
|
||||
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
||||
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
||||
[219, 0, 0, 0, 219, 20, 0, 3, 57, 26, 62, 63, 40],
|
||||
[20, 20, 20, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39],
|
||||
[20, 20, 125, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39],
|
||||
[216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38],
|
||||
[6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37],
|
||||
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user