Commit deecdc2b authored by zjz1994's avatar zjz1994

全屏幕适配代码暂存

parent 01dd4530
......@@ -442,7 +442,7 @@ export default class MainScene extends Scene {
this.islongScreen = true;
}
if(this.islongScreen){
this['adapttop'].y = 40;
this['adapttop'].y = 60;
}else{
this['adapttop'].y = 0;
}
......@@ -468,7 +468,7 @@ export default class MainScene extends Scene {
this['adapttop'].addChild(this.curScoreNum);
//初始换道具容器
this.propBtnCon = new PropBtnCon();
this.propBtnCon = new PropBtnCon(this.islongScreen);
this.addChild(this.propBtnCon);
this.mapContainer = new egret.DisplayObjectContainer();
......@@ -493,7 +493,9 @@ export default class MainScene extends Scene {
this.addChildAt(this.festivalContainer,1);
//道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据
this.propGuide = new PropGuide(this.propBtnCon.y);
console.log('偏移',this.propBtnCon.y,this.propBtnCon.boomBtn.y);
this.propGuide = new PropGuide(this.propBtnCon.y,this.islongScreen);
this.propGuide.touchEnabled = true;
}
......@@ -951,8 +953,9 @@ export default class MainScene extends Scene {
//当前分数
//初始换道具容器
this.propBtnCon.y = 299 + Tool.gameAreaHeight// + 55;
this.propGuide.changeOffset(this.propBtnCon.y);
var propbtny:number = 299 + Tool.gameAreaHeight// + 55;
this.propBtnCon.y = propbtny;
this.propGuide.changeOffset(this.propBtnCon.y,this.islongScreen);
//初始化道具信息
this.updateScene();
......
......@@ -143,7 +143,7 @@ export default class MapScene extends Scene {
}
console.log("手机长短屏幕适配",whl,this.islongScreen);
if(this.islongScreen){
this['adapttop'].y = 40;
this['adapttop'].y = 50;
this['settingsx'].bottom = 50;
}else{
this['adapttop'].y = 0;
......
......@@ -8,7 +8,7 @@ export class PropBtnCon extends eui.Component {
bg: eui.Image;
constructor() {
constructor(islongScreen:boolean) {
super();
var textureBg = RES.getRes("propBg_png");
......@@ -16,14 +16,21 @@ export class PropBtnCon extends eui.Component {
this.bg.y = -137;
this.addChild(this.bg);
var cuty:number = 0;
if(islongScreen){
cuty = 40;
}
this.boomBtn = new CusButton("boomBtn_png");
this.boomBtn.x = 375 - 110 - 50; //110图片宽度,50按钮间隔
this.boomBtn.y = -cuty;
this.addChild(this.boomBtn);
this.hammerBtn = new CusButton("hammerBtn_png");
this.hammerBtn.x = 375;
this.hammerBtn.y = -cuty;
this.addChild(this.hammerBtn);
this.stepBtn = new CusButton("stepBtn_png");
this.stepBtn.x = 375 + 110 + 50;
this.stepBtn.y = -cuty;
this.addChild(this.stepBtn);
}
}
......
......@@ -13,21 +13,25 @@ export class PropGuide extends egret.DisplayObjectContainer {
hammerBtn: egret.Bitmap;
stepBtn: egret.Bitmap;
msgTxt: egret.TextField;
constructor(offsetY: number) {
constructor(offsetY: number,islongScreen:boolean) {
super()
this.bg = new egret.Shape();
this.addChild(this.bg);
this.boomBtn = new egret.Bitmap(RES.getRes("boomBtn_png"));
this.boomBtn.x = 375 - 110 - 50 - 55; //110图片宽度,50按钮间隔,55一半的图片宽度
this.boomBtn.y = offsetY - 55;
var cuty:number = 0;
if(islongScreen){
cuty = -100;
}
this.boomBtn.y = offsetY - 55+cuty;
this.addChild(this.boomBtn);
this.hammerBtn = new egret.Bitmap(RES.getRes("hammerBtn_png"));
this.hammerBtn.x = 375 - 55;
this.hammerBtn.y = offsetY - 55;
this.hammerBtn.y = offsetY - 55+cuty;
this.addChild(this.hammerBtn);
this.stepBtn = new egret.Bitmap(RES.getRes("stepBtn_png"));
this.stepBtn.x = 375 + 110 + 50 - 55;
this.stepBtn.y = offsetY - 55;
this.stepBtn.y = offsetY - 55+cuty;
this.addChild(this.stepBtn);
//再调
var text: egret.TextField = new egret.TextField();
......@@ -35,7 +39,7 @@ export class PropGuide extends egret.DisplayObjectContainer {
text.textColor = 0xffffff;
text.size = 20;
text.x = (750 - 500) / 2;
text.y = offsetY - 80;
text.y = offsetY - 80+cuty;
text.textAlign = egret.HorizontalAlign.CENTER;
text.width = 500;
this.addChild(text);
......@@ -44,11 +48,15 @@ export class PropGuide extends egret.DisplayObjectContainer {
if (this.parent) this.parent.removeChild(this)
}, this)
}
changeOffset(offsetY: number){
this.boomBtn.y = offsetY - 55;
this.hammerBtn.y = offsetY - 55;
this.stepBtn.y = offsetY - 55;
this.msgTxt.y = offsetY - 80;
changeOffset(offsetY: number,islongScreen:boolean){
var cuty:number = 0;
if(islongScreen){
cuty = -40;
}
this.boomBtn.y = offsetY - 55+cuty;
this.hammerBtn.y = offsetY - 55+cuty;
this.stepBtn.y = offsetY - 55+cuty;
this.msgTxt.y = offsetY - 80+cuty;
}
init(prop: PropType,adapttopy:number) {
if (prop == PropType.BOOM) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment