Merge pull request #10 from i2Echo/master

update
This commit is contained in:
Zhang Chen 2017-12-18 16:11:54 +08:00 committed by GitHub
commit 36c6511479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3033,8 +3033,9 @@ core.prototype.resize = function(clientWidth, clientHeight) {
var BASE_LINEHEIGHT = 32; var BASE_LINEHEIGHT = 32;
var SPACE = 3; var SPACE = 3;
var DEFAULT_FONT_SIZE = 16; var DEFAULT_FONT_SIZE = 16;
//适配宽度阈值 //适配宽度 422
var ADAPT_WIDTH = DEFAULT_CANVAS_WIDTH; var ADAPT_WIDTH = DEFAULT_CANVAS_WIDTH;
var CHANGE_WIDTH = DEFAULT_CANVAS_WIDTH+DEFAULT_BAR_WIDTH;
//判断横竖屏 //判断横竖屏
var width = clientWidth; var width = clientWidth;
var isHorizontal = false; var isHorizontal = false;
@ -3057,23 +3058,30 @@ core.prototype.resize = function(clientWidth, clientHeight) {
if (!core.flags.enableDebuff) count--; if (!core.flags.enableDebuff) count--;
var statusLineHeight = BASE_LINEHEIGHT * 9/count; var statusLineHeight = BASE_LINEHEIGHT * 9/count;
var shopDisplay, mdefDisplay, expDisplay; var shopDisplay, mdefDisplay, expDisplay;
mdefDisplay = core.flags.enableMDef ? 'block' : 'none'; mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
expDisplay = core.flags.enableExperience ? 'block' : 'none'; expDisplay = core.flags.enableExperience ? 'block' : 'none';
statusBarBorder = '3px #fff solid'; statusBarBorder = '3px #fff solid';
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
var zoom = (ADAPT_WIDTH - width) / 4.22;
var aScale = 1 - zoom / 100;
// 移动端 // 移动端
if (width < ADAPT_WIDTH) { if (width < CHANGE_WIDTH) {
var zoom = (ADAPT_WIDTH - width) / 4.22; if(width < ADAPT_WIDTH){
var scale = 1 - zoom / 100;
core.domStyle.scale = aScale;
core.domStyle.scale = scale; canvasWidth = width;
}else{
canvasWidth = width; canvasWidth = DEFAULT_CANVAS_WIDTH;
core.domStyle.scale = 1;
}
var scale = core.domStyle.scale
var tempWidth = DEFAULT_CANVAS_WIDTH * scale;
fontSize = DEFAULT_FONT_SIZE * scale; fontSize = DEFAULT_FONT_SIZE * scale;
if(!isHorizontal){ //竖屏 if(!isHorizontal){ //竖屏
core.domStyle.screenMode = 'vertical'; core.domStyle.screenMode = 'vertical';
//显示快捷商店图标 //显示快捷商店图标
@ -3083,14 +3091,14 @@ core.prototype.resize = function(clientWidth, clientHeight) {
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6; var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6; var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
gameGroupHeight = width + tempTopBarH + tempBotBarH;
gameGroupWidth = width gameGroupHeight = tempWidth + tempTopBarH + tempBotBarH;
gameGroupWidth = tempWidth
canvasTop = tempTopBarH; canvasTop = tempTopBarH;
// canvasLeft = 0; // canvasLeft = 0;
toolBarWidth = statusBarWidth = width; toolBarWidth = statusBarWidth = canvasWidth;
statusBarHeight = tempTopBarH; //一共有3行加上两个padding空隙 statusBarHeight = tempTopBarH;
statusBarBorder = '3px #fff solid'; statusBarBorder = '3px #fff solid';
statusHeight = scale*BASE_LINEHEIGHT * .8; statusHeight = scale*BASE_LINEHEIGHT * .8;
@ -3098,7 +3106,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95; statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
toolBarHeight = tempBotBarH; toolBarHeight = tempBotBarH;
toolBarTop = statusBarHeight + width; toolBarTop = statusBarHeight + canvasWidth;
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
toolsHeight = scale * BASE_LINEHEIGHT; toolsHeight = scale * BASE_LINEHEIGHT;
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4; toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
@ -3109,8 +3117,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
}else { //横屏 }else { //横屏
core.domStyle.screenMode = 'horizontal'; core.domStyle.screenMode = 'horizontal';
shopDisplay = 'none'; shopDisplay = 'none';
gameGroupWidth = width + DEFAULT_BAR_WIDTH * scale; gameGroupWidth = tempWidth + DEFAULT_BAR_WIDTH * scale;
gameGroupHeight = width; gameGroupHeight = tempWidth;
canvasTop = 0; canvasTop = 0;
// canvasLeft = DEFAULT_BAR_WIDTH * scale; // canvasLeft = DEFAULT_BAR_WIDTH * scale;
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale; toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
@ -3119,7 +3127,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
statusHeight = scale*statusLineHeight * .8; statusHeight = scale*statusLineHeight * .8;
statusLabelsLH = .8 * statusLineHeight *scale; statusLabelsLH = .8 * statusLineHeight *scale;
toolBarHeight = width - statusBarHeight; toolBarHeight = canvasWidth - statusBarHeight;
toolBarTop = scale*statusLineHeight * count + SPACE * 2; toolBarTop = scale*statusLineHeight * count + SPACE * 2;
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
toolsHeight = scale * BASE_LINEHEIGHT; toolsHeight = scale * BASE_LINEHEIGHT;