Commit 54294280 authored by zjz1994's avatar zjz1994

Merge branch 'dev' of http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole into 726-750关卡

parents 6a028552 deecdc2b
...@@ -106,6 +106,7 @@ export default class MainBase extends eui.UILayer { ...@@ -106,6 +106,7 @@ export default class MainBase extends eui.UILayer {
// baseApi.enableTitleShow(false); // baseApi.enableTitleShow(false);
// }, false); // }, false);
document.addEventListener("deviceready", () => { document.addEventListener("deviceready", () => {
console.log("苏宁baseapi准备完毕1111");
window['baseApi'].enableTitleShow(false); window['baseApi'].enableTitleShow(false);
}, false); }, false);
} }
...@@ -582,11 +583,13 @@ export default class MainBase extends eui.UILayer { ...@@ -582,11 +583,13 @@ export default class MainBase extends eui.UILayer {
} }
protected async createGameScene() { protected async createGameScene() {
window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) }; window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) };
localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次 localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次
await this.hcHome(); await this.hcHome();
await Promise.all([ await Promise.all([
this.getAd(), // this.getAd(),
this.ajaxElement(), this.ajaxElement(),
this.hc_userInfo(), this.hc_userInfo(),
this.getBackReward(), this.getBackReward(),
...@@ -595,6 +598,32 @@ export default class MainBase extends eui.UILayer { ...@@ -595,6 +598,32 @@ export default class MainBase extends eui.UILayer {
this.getInviteInfo(), this.getInviteInfo(),
this.hbRainBaseInfo(), this.hbRainBaseInfo(),
]); ]);
if(GFun.isIOS){
}else{
console.log("苏宁安卓开始准备");
if(!window['baseApi']){
await new Promise((resolve,reject)=>{
// let t1 = setTimeout(() => {
// console.log("苏宁准备失败");
// resolve();
// }, 6000);
document.addEventListener("deviceready", function() {
console.log("苏宁baseapi准备完毕222");
// clearTimeout(t1);
resolve();
}.bind(this), false);
})
console.log("游戏继续");
}else{
console.log("已经获得baseapi,游戏继续");
}
}
await this.getAd();
//获取分享加体力的shareCode,不影响初始化场景,不进await //获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(() => { }) NetManager.ins.getUserShareCode(() => { })
......
...@@ -1462,7 +1462,7 @@ export class NetManager extends ABNetManager { ...@@ -1462,7 +1462,7 @@ export class NetManager extends ABNetManager {
} }
public hc_advert(callback: Function): void { public hc_advert(callback: Function): void {
var deviceid:string = ''; var deviceId:string = '';
const net: INetData = { const net: INetData = {
name: 'hc_advert', name: 'hc_advert',
uri: window['duiba'] + '/customActivity/happyclear/advert', uri: window['duiba'] + '/customActivity/happyclear/advert',
...@@ -1470,32 +1470,39 @@ export class NetManager extends ABNetManager { ...@@ -1470,32 +1470,39 @@ export class NetManager extends ABNetManager {
dataType: 'json', dataType: 'json',
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
deviceid:deviceid deviceId:deviceId
}, },
hideMsg: true, hideMsg: true,
callback: callback callback: callback
}; };
try{ try{
if(window['SNNativeClient']){ // console.log("苏宁原生测试",window['baseApi']);
if(window['baseApi']){
console.log("苏宁原生测试",GFun.isIOS); console.log("苏宁原生测试",GFun.isIOS);
console.log(window['SNNativeClient']); window['baseApi'].getClientInfo(function(res){
window['SNNativeClient'].getClientInfo(function(res){ console.log("啦啦啦baseApi----info",res);
console.log("啦啦啦SNNativeClientFunc",res);
if(res){ if(res){
var resdata;
if(typeof res =="string"){
resdata = JSON.parse(res);
}else{
resdata = res;
}
if(GFun.isIOS){ if(GFun.isIOS){
deviceid = res.imsi||''; deviceId = resdata.identifier||'';
}else{ }else{
deviceid = res.imei||''; deviceId = resdata.imei||'';
} }
} }
console.log('新增deviceid',deviceid); console.log('新增deviceId',deviceId);
net.param.deviceid = deviceid; net.param.deviceId = deviceId;
this.send(net); this.send(net);
}.bind(this)); }.bind(this));
}else{ }else{
this.send(net); this.send(net);
} }
}catch(e){ }catch(e){
console.log('一般获取');
this.send(net); this.send(net);
} }
} }
......
...@@ -5,32 +5,42 @@ ...@@ -5,32 +5,42 @@
</w:Declarations> </w:Declarations>
<e:Image x="0" y="0" source="playSceneBg_jpg"/> <e:Image x="0" y="0" source="playSceneBg_jpg"/>
<e:Image source="lef_png" y="-2" x="0"/> <e:Image source="lef_png" y="-2" x="0"/>
<e:Image y="199.5" source="targetBoard_png" x="174"/> <e:Group id="adapttop" width="750" height="1624" horizontalCenter="0" y="0" touchEnabled="false" touchThrough="true">
<e:Image y="-47.5" source="progressDown_png" horizontalCenter="0"/> <e:Image y="199.5" source="targetBoard_png" x="174" scaleX="1" scaleY="1"/>
<e:Image id="starProgress" x="138" y="159.35" source="starProgress_png"/> <e:Image y="-47.5" source="progressDown_png" horizontalCenter="0" x="11" scaleX="1" scaleY="1"/>
<e:Group id="chaptergro" width="750" height="200"/> <e:Image id="starProgress" x="138" y="159.35" source="starProgress_png" scaleX="1" scaleY="1"/>
<e:Image x="69" y="-64.5" source="stepsBoard_png"/> <e:Group id="chaptergro" width="750" height="200" x="0" y="0" scaleX="1" scaleY="1"/>
<e:Image x="171.5" y="166.35" source="dangqianfenshu_png"/> <e:Image x="69" y="-64.5" source="stepsBoard_png" scaleX="1" scaleY="1"/>
<e:Image x="171.5" y="166.35" source="dangqianfenshu_png" scaleX="1" scaleY="1"/>
<e:Label id="targetScoreTxt" touchEnabled="false" size="26" width="292.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="目标分数" y="234.85" textColor="0x9d4a06" bold="true" horizontalCenter="0.5" x="229" scaleX="1" scaleY="1"/>
<e:Group id="settingAll" width="89" height="203" x="641" y="5.5" anchorOffsetY="0" scaleX="1" scaleY="1">
<e:Group id="settingGroup" width="72" height="282" x="8" y="29" anchorOffsetX="0" visible="false">
<e:Image y="-13.03" source="mainSettingBg_png" horizontalCenter="0"/>
<e:Image id="questionBtn" y="53" source="mainQuestionBtn_png" horizontalCenter="1"/>
<e:Image id="soundBtn" y="105" source="mainSoundBtnOn_png" horizontalCenter="1"/>
<e:Image id="musicBtn" y="155" source="mainMusicBtnOn_png" horizontalCenter="1"/>
<e:Image id="quitBtn" y="205.99" source="mainQuitBtn_png" horizontalCenter="1"/>
</e:Group>
<e:Image id="settingBtn" y="1" source="setting_png" horizontalCenter="0"/>
</e:Group>
</e:Group>
<e:Label id="targetScoreTxt" touchEnabled="false" size="26" width="292.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="目标分数" y="234.85" textColor="0x9d4a06" bold="true" horizontalCenter="0.5"/>
<e:Group id="settingAll" width="89" height="203" x="641" y="5.5" anchorOffsetY="0">
<e:Group id="settingGroup" width="72" height="282" x="8" y="29" anchorOffsetX="0" visible="false">
<e:Image y="-13.03" source="mainSettingBg_png" horizontalCenter="0"/>
<e:Image id="questionBtn" y="53" source="mainQuestionBtn_png" horizontalCenter="1"/>
<e:Image id="soundBtn" y="105" source="mainSoundBtnOn_png" horizontalCenter="1"/>
<e:Image id="musicBtn" y="155" source="mainMusicBtnOn_png" horizontalCenter="1"/>
<e:Image id="quitBtn" y="205.99" source="mainQuitBtn_png" horizontalCenter="1"/>
</e:Group>
<e:Image id="settingBtn" y="1" source="setting_png" horizontalCenter="0"/>
</e:Group>
<e:Group id="redrainbg" width="750" height="1624" visible="false"> <e:Group id="redrainbg" width="750" height="1624" visible="false">
<e:Image source="redrainbg_jpg"/> <e:Image source="redrainbg_jpg"/>
<e:Label id="tips" text="正在加载中,请稍后" y="826.33" textColor="0x244B00" horizontalCenter="0" size="24" visible="false"/> <e:Label id="tips" text="正在加载中,请稍后" y="826.33" textColor="0x244B00" horizontalCenter="0" size="24" visible="false"/>
......
This diff is collapsed.
...@@ -412,13 +412,44 @@ export default class MainScene extends Scene { ...@@ -412,13 +412,44 @@ export default class MainScene extends Scene {
}> }>
}> = []; }> = [];
islongScreen:boolean = false;
constructor(){ constructor(){
super(); super();
window['gm'] = this.gm; window['gm'] = this.gm;
//选择框 无需加入场景
var textureChoosed: egret.Texture = RES.getRes("chooseRect_png")
this.choosed = new eui.Image(textureChoosed);
this.choosed.x = -textureChoosed.textureWidth / 2;
this.choosed.y = -textureChoosed.textureHeight / 2;
//bonusTime引导,备用的,无需加入场景
this.bonusTime = new BonusTime();
this.bonusTime.x = 375;
this.bonusTime.y = 600;
this.once(egret.Event.ADDED_TO_STAGE,this.initMainScene,this);
}
initMainScene(){
var stagew = this.stage.stageWidth;
var stageh = this.stage.stageHeight;
var whl = stagew/stageh;
if(whl>0.5){
this.islongScreen = false;
}else{
this.islongScreen = true;
}
if(this.islongScreen){
this['adapttop'].y = 60;
}else{
this['adapttop'].y = 0;
}
//基础ui //基础ui
//目标 //目标
this.targetContainer = new egret.DisplayObjectContainer; this.targetContainer = new egret.DisplayObjectContainer;
this.addChild(this.targetContainer); this['adapttop'].addChild(this.targetContainer);
//第几关 //第几关
this.chapterTxt = new ChapterNum(); this.chapterTxt = new ChapterNum();
this.chapterTxt.num = '0' // >> 0; this.chapterTxt.num = '0' // >> 0;
...@@ -429,15 +460,15 @@ export default class MainScene extends Scene { ...@@ -429,15 +460,15 @@ export default class MainScene extends Scene {
this.stepNumber = new StepNumber(); this.stepNumber = new StepNumber();
this.stepNumber.x = 175; this.stepNumber.x = 175;
this.stepNumber.y = 83.5; this.stepNumber.y = 83.5;
this.addChild(this.stepNumber); this['adapttop'].addChild(this.stepNumber);
//当前分数 //当前分数
this.curScoreNum = new CurScoreNum(); this.curScoreNum = new CurScoreNum();
this.curScoreNum.x = 284; this.curScoreNum.x = 284;
this.curScoreNum.y = 170; this.curScoreNum.y = 170;
this.addChild(this.curScoreNum); this['adapttop'].addChild(this.curScoreNum);
//初始换道具容器 //初始换道具容器
this.propBtnCon = new PropBtnCon(); this.propBtnCon = new PropBtnCon(this.islongScreen);
this.addChild(this.propBtnCon); this.addChild(this.propBtnCon);
this.mapContainer = new egret.DisplayObjectContainer(); this.mapContainer = new egret.DisplayObjectContainer();
...@@ -461,20 +492,11 @@ export default class MainScene extends Scene { ...@@ -461,20 +492,11 @@ export default class MainScene extends Scene {
this.festivalContainer = new egret.DisplayObjectContainer(); this.festivalContainer = new egret.DisplayObjectContainer();
this.addChildAt(this.festivalContainer,1); this.addChildAt(this.festivalContainer,1);
//选择框 无需加入场景
var textureChoosed: egret.Texture = RES.getRes("chooseRect_png")
this.choosed = new eui.Image(textureChoosed);
this.choosed.x = -textureChoosed.textureWidth / 2;
this.choosed.y = -textureChoosed.textureHeight / 2;
//道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据 //道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据
this.propGuide = new PropGuide(this.propBtnCon.y); console.log('偏移',this.propBtnCon.y,this.propBtnCon.boomBtn.y);
this.propGuide.touchEnabled = true;
//bonusTime引导,备用的,无需加入场景 this.propGuide = new PropGuide(this.propBtnCon.y,this.islongScreen);
this.bonusTime = new BonusTime(); this.propGuide.touchEnabled = true;
this.bonusTime.x = 375;
this.bonusTime.y = 600;
} }
resetMainScene(){ resetMainScene(){
...@@ -931,8 +953,9 @@ export default class MainScene extends Scene { ...@@ -931,8 +953,9 @@ export default class MainScene extends Scene {
//当前分数 //当前分数
//初始换道具容器 //初始换道具容器
this.propBtnCon.y = 299 + Tool.gameAreaHeight// + 55; var propbtny:number = 299 + Tool.gameAreaHeight// + 55;
this.propGuide.changeOffset(this.propBtnCon.y); this.propBtnCon.y = propbtny;
this.propGuide.changeOffset(this.propBtnCon.y,this.islongScreen);
//初始化道具信息 //初始化道具信息
this.updateScene(); this.updateScene();
...@@ -1888,7 +1911,7 @@ export default class MainScene extends Scene { ...@@ -1888,7 +1911,7 @@ export default class MainScene extends Scene {
} }
//添加引导蒙层 //添加引导蒙层
this.guideContainer.addChild(this.propGuide); this.guideContainer.addChild(this.propGuide);
this.propGuide.init(prop); this.propGuide.init(prop,this['adapttop'].y);
//如果是炸弹或者锤子 //如果是炸弹或者锤子
if(prop == PropType.BOOM || prop == PropType.HAMMER) { if(prop == PropType.BOOM || prop == PropType.HAMMER) {
//去掉元素容器的侦听 //去掉元素容器的侦听
......
...@@ -133,6 +133,23 @@ export default class MapScene extends Scene { ...@@ -133,6 +133,23 @@ export default class MapScene extends Scene {
} }
} }
initMapScene(){ initMapScene(){
var stagew = this.stage.stageWidth;
var stageh = this.stage.stageHeight;
var whl = stagew/stageh;
if(whl>0.5){
this.islongScreen = false;
}else{
this.islongScreen = true;
}
console.log("手机长短屏幕适配",whl,this.islongScreen);
if(this.islongScreen){
this['adapttop'].y = 50;
this['settingsx'].bottom = 50;
}else{
this['adapttop'].y = 0;
this['settingsx'].bottom = 25;
}
// console.log('initMapScene--------------'); // console.log('initMapScene--------------');
// 添加Icon // 添加Icon
this.addIcon(); this.addIcon();
...@@ -324,7 +341,7 @@ export default class MapScene extends Scene { ...@@ -324,7 +341,7 @@ export default class MapScene extends Scene {
}, 20 * 1000); }, 20 * 1000);
loadFireworks(); loadFireworks();
} }
islongScreen:boolean = false;
constructor(data?){ constructor(data?){
super(); super();
this._data = data; this._data = data;
......
...@@ -8,7 +8,7 @@ export class PropBtnCon extends eui.Component { ...@@ -8,7 +8,7 @@ export class PropBtnCon extends eui.Component {
bg: eui.Image; bg: eui.Image;
constructor() { constructor(islongScreen:boolean) {
super(); super();
var textureBg = RES.getRes("propBg_png"); var textureBg = RES.getRes("propBg_png");
...@@ -16,14 +16,21 @@ export class PropBtnCon extends eui.Component { ...@@ -16,14 +16,21 @@ export class PropBtnCon extends eui.Component {
this.bg.y = -137; this.bg.y = -137;
this.addChild(this.bg); this.addChild(this.bg);
var cuty:number = 0;
if(islongScreen){
cuty = 40;
}
this.boomBtn = new CusButton("boomBtn_png"); this.boomBtn = new CusButton("boomBtn_png");
this.boomBtn.x = 375 - 110 - 50; //110图片宽度,50按钮间隔 this.boomBtn.x = 375 - 110 - 50; //110图片宽度,50按钮间隔
this.boomBtn.y = -cuty;
this.addChild(this.boomBtn); this.addChild(this.boomBtn);
this.hammerBtn = new CusButton("hammerBtn_png"); this.hammerBtn = new CusButton("hammerBtn_png");
this.hammerBtn.x = 375; this.hammerBtn.x = 375;
this.hammerBtn.y = -cuty;
this.addChild(this.hammerBtn); this.addChild(this.hammerBtn);
this.stepBtn = new CusButton("stepBtn_png"); this.stepBtn = new CusButton("stepBtn_png");
this.stepBtn.x = 375 + 110 + 50; this.stepBtn.x = 375 + 110 + 50;
this.stepBtn.y = -cuty;
this.addChild(this.stepBtn); this.addChild(this.stepBtn);
} }
} }
......
...@@ -13,21 +13,25 @@ export class PropGuide extends egret.DisplayObjectContainer { ...@@ -13,21 +13,25 @@ export class PropGuide extends egret.DisplayObjectContainer {
hammerBtn: egret.Bitmap; hammerBtn: egret.Bitmap;
stepBtn: egret.Bitmap; stepBtn: egret.Bitmap;
msgTxt: egret.TextField; msgTxt: egret.TextField;
constructor(offsetY: number) { constructor(offsetY: number,islongScreen:boolean) {
super() super()
this.bg = new egret.Shape(); this.bg = new egret.Shape();
this.addChild(this.bg); this.addChild(this.bg);
this.boomBtn = new egret.Bitmap(RES.getRes("boomBtn_png")); this.boomBtn = new egret.Bitmap(RES.getRes("boomBtn_png"));
this.boomBtn.x = 375 - 110 - 50 - 55; //110图片宽度,50按钮间隔,55一半的图片宽度 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.addChild(this.boomBtn);
this.hammerBtn = new egret.Bitmap(RES.getRes("hammerBtn_png")); this.hammerBtn = new egret.Bitmap(RES.getRes("hammerBtn_png"));
this.hammerBtn.x = 375 - 55; this.hammerBtn.x = 375 - 55;
this.hammerBtn.y = offsetY - 55; this.hammerBtn.y = offsetY - 55+cuty;
this.addChild(this.hammerBtn); this.addChild(this.hammerBtn);
this.stepBtn = new egret.Bitmap(RES.getRes("stepBtn_png")); this.stepBtn = new egret.Bitmap(RES.getRes("stepBtn_png"));
this.stepBtn.x = 375 + 110 + 50 - 55; this.stepBtn.x = 375 + 110 + 50 - 55;
this.stepBtn.y = offsetY - 55; this.stepBtn.y = offsetY - 55+cuty;
this.addChild(this.stepBtn); this.addChild(this.stepBtn);
//再调 //再调
var text: egret.TextField = new egret.TextField(); var text: egret.TextField = new egret.TextField();
...@@ -35,7 +39,7 @@ export class PropGuide extends egret.DisplayObjectContainer { ...@@ -35,7 +39,7 @@ export class PropGuide extends egret.DisplayObjectContainer {
text.textColor = 0xffffff; text.textColor = 0xffffff;
text.size = 20; text.size = 20;
text.x = (750 - 500) / 2; text.x = (750 - 500) / 2;
text.y = offsetY - 80; text.y = offsetY - 80+cuty;
text.textAlign = egret.HorizontalAlign.CENTER; text.textAlign = egret.HorizontalAlign.CENTER;
text.width = 500; text.width = 500;
this.addChild(text); this.addChild(text);
...@@ -44,13 +48,17 @@ export class PropGuide extends egret.DisplayObjectContainer { ...@@ -44,13 +48,17 @@ export class PropGuide extends egret.DisplayObjectContainer {
if (this.parent) this.parent.removeChild(this) if (this.parent) this.parent.removeChild(this)
}, this) }, this)
} }
changeOffset(offsetY: number){ changeOffset(offsetY: number,islongScreen:boolean){
this.boomBtn.y = offsetY - 55; var cuty:number = 0;
this.hammerBtn.y = offsetY - 55; if(islongScreen){
this.stepBtn.y = offsetY - 55; cuty = -40;
this.msgTxt.y = offsetY - 80; }
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) { init(prop: PropType,adapttopy:number) {
if (prop == PropType.BOOM) { if (prop == PropType.BOOM) {
this.boomBtn.visible = true; this.boomBtn.visible = true;
this.hammerBtn.visible = false; this.hammerBtn.visible = false;
...@@ -78,7 +86,7 @@ export class PropGuide extends egret.DisplayObjectContainer { ...@@ -78,7 +86,7 @@ export class PropGuide extends egret.DisplayObjectContainer {
this.bg.graphics.lineTo(750, 1624); this.bg.graphics.lineTo(750, 1624);
this.bg.graphics.lineTo(0, 1624); this.bg.graphics.lineTo(0, 1624);
this.bg.graphics.lineTo(0, 0); this.bg.graphics.lineTo(0, 0);
this.bg.graphics.drawArc(178, 85, 80, 0, Math.PI * 2, true) this.bg.graphics.drawArc(178, 85+adapttopy, 80, 0, Math.PI * 2, true)
this.bg.graphics.endFill(); this.bg.graphics.endFill();
this.msgTxt.text = "点击左上方步数,可为闯关时增加额外5次步数"; this.msgTxt.text = "点击左上方步数,可为闯关时增加额外5次步数";
// this.msgTxt.x = 320; // this.msgTxt.x = 320;
......
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