Commit 20e8ee56 authored by wildfirecode's avatar wildfirecode

Merge branch 'dev' of gitlab2.dui88.com:wanghongyuan/xiaoxiaole into dev

parents 9ddcd4eb e6325262
...@@ -156,7 +156,12 @@ export default class MainBase extends eui.UILayer { ...@@ -156,7 +156,12 @@ export default class MainBase extends eui.UILayer {
for (var i = 0; i <= 9; i++) { for (var i = 0; i <= 9; i++) {
RES.getResAsync("targetNumber" + i + "_png") RES.getResAsync("targetNumber" + i + "_png")
} }
for (var i = 1; i <= 5; i++) {
RES.getResAsync("guideTxt" + i + "_png")
}
var arr = [ var arr = [
"guideBg",
"guideKnowBtn",
"bonusShoot", "bonusShoot",
"ele5", "ele5",
"ele6", "ele6",
......
...@@ -57,12 +57,12 @@ ...@@ -57,12 +57,12 @@
"name": "startpanel" "name": "startpanel"
}, },
{ {
"keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png", "keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,playSceneBg_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png",
"name": "mainScene" "name": "mainScene"
}, },
{ {
"name": "preload", "keys": "showoff_jpg,share2_jpg",
"keys": "showoff_jpg,share2_jpg" "name": "preload"
} }
], ],
"resources": [ "resources": [
...@@ -1312,14 +1312,49 @@ ...@@ -1312,14 +1312,49 @@
"name": "bonusShoot_png" "name": "bonusShoot_png"
}, },
{ {
"name": "share2_jpg", "url": "assets/share2.jpg",
"type": "image", "type": "image",
"url": "assets/share2.jpg" "name": "share2_jpg"
}, },
{ {
"name": "showoff_jpg", "url": "assets/showoff.jpg",
"type": "image", "type": "image",
"url": "assets/showoff.jpg" "name": "showoff_jpg"
},
{
"url": "assets/mainScene/guideTxt5.png",
"type": "image",
"name": "guideTxt5_png"
},
{
"url": "assets/mainScene/guideBg.png",
"type": "image",
"name": "guideBg_png"
},
{
"url": "assets/mainScene/guideKnowBtn.png",
"type": "image",
"name": "guideKnowBtn_png"
},
{
"url": "assets/mainScene/guideTxt1.png",
"type": "image",
"name": "guideTxt1_png"
},
{
"url": "assets/mainScene/guideTxt2.png",
"type": "image",
"name": "guideTxt2_png"
},
{
"url": "assets/mainScene/guideTxt3.png",
"type": "image",
"name": "guideTxt3_png"
},
{
"url": "assets/mainScene/guideTxt4.png",
"type": "image",
"name": "guideTxt4_png"
} }
] ]
} }
\ No newline at end of file
...@@ -40,6 +40,9 @@ import { ElementTargets } from '../something/uis/ElementTargets'; ...@@ -40,6 +40,9 @@ import { ElementTargets } from '../something/uis/ElementTargets';
import { Chapters } from '../something/Chapters'; import { Chapters } from '../something/Chapters';
import { FlyTargetAni } from '../something/anis/FlyTargetAni'; import { FlyTargetAni } from '../something/anis/FlyTargetAni';
import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni'; import { BonusShootAni, stepPosition } from '../something/anis/BonusShootAni';
import { GuideMsg } from '../something/uis/GuideMsg';
import Loading from '../../libs/new_wx/components/Loading';
import { getlogItem } from '../Main';
// import BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory"; // import BridgeFactory from "../../libs/JSBridge/bridge/BridgeFactory";
const aniClass = { const aniClass = {
...@@ -116,6 +119,7 @@ export default class MainScene extends Scene { ...@@ -116,6 +119,7 @@ export default class MainScene extends Scene {
lollipopCount: number = 0; lollipopCount: number = 0;
//是否已通关 //是否已通关
hasPassed: boolean = false; hasPassed: boolean = false;
isCountingTime: boolean = false;
//通关的目标元素的计数,下标和元素类型索引一致 //通关的目标元素的计数,下标和元素类型索引一致
passElements: number[]; passElements: number[];
elementTargets: ElementTargets; elementTargets: ElementTargets;
...@@ -189,6 +193,9 @@ export default class MainScene extends Scene { ...@@ -189,6 +193,9 @@ export default class MainScene extends Scene {
//先禁掉事件 //先禁掉事件
this.enableMouseEvt(false); this.enableMouseEvt(false);
// this.initBuired() // this.initBuired()
NetManager.ins.showLog(getlogItem(7))
NetManager.ins.showLog(getlogItem(10))
NetManager.ins.showLog(getlogItem(13))
//步数初始化 //步数初始化
this.steps = this.chapterData.stepCount; this.steps = this.chapterData.stepCount;
...@@ -213,34 +220,21 @@ export default class MainScene extends Scene { ...@@ -213,34 +220,21 @@ export default class MainScene extends Scene {
this.targetScoreTxt.visible = true; this.targetScoreTxt.visible = true;
this.targetScoreTxt.text = "目标分数:" + this.chapterData.passTarget.score; this.targetScoreTxt.text = "目标分数:" + this.chapterData.passTarget.score;
} }
//背景图生成
// var bg = drawBg(this.chapterData.map.paths, this.chapterData.map.lattices)
var bg = drawBg(generateMapBg(this.chapterData.map.lattices), this.chapterData.map.lattices)
this.addChild(bg);
this.map = bg;
//选择框
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;
//容器
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
//加遮罩
var mask = new egret.Shape();
mask.graphics.beginFill(0xffffff, 1);
mask.graphics.drawRect(Tool.offsetX, Tool.offsetY, Tool.width * Tool.colNum, Tool.height * Tool.rowNum + 100);
mask.graphics.endFill();
this.elementContainer.mask = mask;
this.addChild(mask)
//容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
//初始化格子 //初始化格子
this.initLattices(); this.initLattices();
//设置栏置顶 //设置栏置顶
this.addChild(this["settingAll"]) this.addChild(this["settingAll"])
//引导提示
if (chapter <= 5) {
Loading.instace.show()
let g = new GuideMsg();
g.init(chapter, () => {
Loading.instace.hide()
this.addChild(g)
})
}
//开启事件,具体不应该放在这里,到时看 //开启事件,具体不应该放在这里,到时看
this.enableMouseEvt(true); this.enableMouseEvt(true);
} }
...@@ -264,7 +258,7 @@ export default class MainScene extends Scene { ...@@ -264,7 +258,7 @@ export default class MainScene extends Scene {
}, this) }, this)
this.movieClips[svgas[i]] = mv; this.movieClips[svgas[i]] = mv;
}, function (error) { }, function (error) {
alert(error.message); // alert(error.message);
}) })
} }
} }
...@@ -277,10 +271,42 @@ export default class MainScene extends Scene { ...@@ -277,10 +271,42 @@ export default class MainScene extends Scene {
this.addChild(this.stepNumber); this.addChild(this.stepNumber);
//分数进度条 //分数进度条
this.scoreProgress = new ScoreProgress(this.starProgress, this.scoreTxt, this.chapterData.starScores); this.scoreProgress = new ScoreProgress(this.starProgress, this.scoreTxt, this.chapterData.starScores);
//背景图生成
// var bg = drawBg(this.chapterData.map.paths, this.chapterData.map.lattices)
var bg = drawBg(generateMapBg(this.chapterData.map.lattices), this.chapterData.map.lattices)
this.addChild(bg);
this.map = bg;
//选择框
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;
//容器
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
//加遮罩
var mask = new egret.Shape();
mask.graphics.beginFill(0xffffff, 1);
mask.graphics.drawRect(Tool.offsetX, Tool.offsetY, Tool.width * Tool.colNum, Tool.height * Tool.rowNum + 100);
mask.graphics.endFill();
this.elementContainer.mask = mask;
this.addChild(mask)
//容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
//根据缓存修改音乐显示按钮 //根据缓存修改音乐显示按钮
if (getSoundOn()) {
this.soundBtn.source = "mainSoundBtnOn_png"
} else {
this.soundBtn.source = "mainSoundBtnOff_png"
}
if (getBgOn()) {
this.musicBtn.source = "mainSoundBtnOn_png"
} else {
this.musicBtn.source = "mainSoundBtnOff_png"
} }
//初始化格子,包括冰块 }
//初始化格子
initLattices() { initLattices() {
var latticesD = this.chapterData.map.lattices; var latticesD = this.chapterData.map.lattices;
var generateLats = this.chapterData.map.generateLats; var generateLats = this.chapterData.map.generateLats;
...@@ -442,7 +468,7 @@ export default class MainScene extends Scene { ...@@ -442,7 +468,7 @@ export default class MainScene extends Scene {
this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this) this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
} }
onEnterFrame() { onEnterFrame() {
if (this.touchEnabled) { if (this.enableTouch) {
this.noActionCount++; this.noActionCount++;
} else { } else {
this.noActionCount = 0; this.noActionCount = 0;
...@@ -492,23 +518,32 @@ export default class MainScene extends Scene { ...@@ -492,23 +518,32 @@ export default class MainScene extends Scene {
} }
onTap_soundBtnn() { onTap_soundBtnn() {
toggleSound() toggleSound()
if(getSoundOn()){ if (getSoundOn()) {
this.soundBtn.source="mainSoundBtnOn_png" this.soundBtn.source = "mainSoundBtnOn_png"
}else{ } else {
this.soundBtn.source="mainSoundBtnOff_png" this.soundBtn.source = "mainSoundBtnOff_png"
} }
} }
onTap_musicBtn() { onTap_musicBtn() {
toggleBg(); toggleBg();
if(getBgOn()){ if (getBgOn()) {
this.musicBtn.source="mainMusicBtnOn_png" this.musicBtn.source = "mainMusicBtnOn_png"
}else{ } else {
this.musicBtn.source="mainMusicBtnOff_png" this.musicBtn.source = "mainMusicBtnOff_png"
} }
} }
onTap_quitBtn() { onTap_quitBtn() {
PanelCtrl.instance.show("quit"); PanelCtrl.instance.show("quit");
} }
onTap_boomBtn(){
NetManager.ins.showLog(getlogItem(7))
}
onTap_hammerBtn(){
NetManager.ins.showLog(getlogItem(10))
}
onTap_stepBtn(){
NetManager.ins.showLog(getlogItem(13))
}
mouseDownE(e: egret.TextEvent) { mouseDownE(e: egret.TextEvent) {
// if (!this.enableTouch) return // if (!this.enableTouch) return
...@@ -1213,9 +1248,7 @@ export default class MainScene extends Scene { ...@@ -1213,9 +1248,7 @@ export default class MainScene extends Scene {
var latC = lattices[cur]; var latC = lattices[cur];
if (Tool.judgeMatch(latP) && if (Tool.judgeMatch(latP) &&
Tool.judgeMatch(latC) && Tool.judgeMatch(latC) &&
latP.element.type == latC.element.type && latP.element.type == latC.element.type) {
latP.element.effectType != EffectType.MAGICLION &&
latC.element.effectType != EffectType.MAGICLION) {
result[i].push(cur) result[i].push(cur)
} else { } else {
result[++i] = [cur]; result[++i] = [cur];
...@@ -1265,23 +1298,14 @@ export default class MainScene extends Scene { ...@@ -1265,23 +1298,14 @@ export default class MainScene extends Scene {
if (this.threeMatch()) { if (this.threeMatch()) {
this.eliminate() this.eliminate()
} else { } else {
//出累计一步分数的toast; //如果早已通关,正在结算
this.oneStepScoreToast();
//连消置0
this.commonContinuityTimes = 0;
this.effectContinuityTimes = 0;
//判断是否已达目标
this.hasPassed = this.judgePass();
console.log(this.hasPassed)
if (this.hasPassed) { if (this.hasPassed) {
if (this.steps > 0) { //如果原先特效还有,
//连消倍数为1 if (!this.isCountingTime) {
this.commonContinuityTimes = 1; this.terminateSteps();
this.effectContinuityTimes = 1; }
//先出toast bonusTime,播完后 //如果只有步数转化的,不能再进结算,
//bonustime,toast,把所有有特效的消除先 else {
this.terminateSteps()
} else {
//通关了 //通关了
//提交分数等 //提交分数等
var json = this.getSubmitJson() var json = this.getSubmitJson()
...@@ -1292,10 +1316,28 @@ export default class MainScene extends Scene { ...@@ -1292,10 +1316,28 @@ export default class MainScene extends Scene {
} }
return return
} }
//判断是否已达目标
this.hasPassed = this.judgePass();
console.log(this.hasPassed)
if (this.hasPassed) {
//连消基数为1
this.commonContinuityTimes = 1;
this.effectContinuityTimes = 1;
showToast("bonus times")
setTimeout(() => {
this.terminateSteps();
}, 1300)
return
}
//出累计一步分数的toast;
this.oneStepScoreToast();
//连消置0
this.commonContinuityTimes = 0;
this.effectContinuityTimes = 0;
//先判断步数是否为0; //先判断步数是否为0;
if (this.steps == 0) { if (this.steps == 0) {
//判断是否有加步数的道具,有则提示是否加(加完判断死图),没有则直接结束 //判断是否有加步数的道具,有则提示是否加(加完判断死图),没有则直接结束
//失败弹框 //失败弹框
playSound(SoundType.fail); playSound(SoundType.fail);
PanelCtrl.instance.show("failed"); PanelCtrl.instance.show("failed");
...@@ -1345,7 +1387,7 @@ export default class MainScene extends Scene { ...@@ -1345,7 +1387,7 @@ export default class MainScene extends Scene {
//把所有元素加入 //把所有元素加入
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeMatch(lat)) { if (Tool.judgeEliminate(lat)) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
//5倍 //5倍
if (!lat.element.isLock/*&&lat.element.effectType==null*/) { if (!lat.element.isLock/*&&lat.element.effectType==null*/) {
...@@ -1382,8 +1424,7 @@ export default class MainScene extends Scene { ...@@ -1382,8 +1424,7 @@ export default class MainScene extends Scene {
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeMatch(lat) && if (Tool.judgeMatch(lat) &&
lat.element.type == other.type && lat.element.type == other.type) {
lat.element.effectType != EffectType.MAGICLION) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
//如果other带特效,符合的元素都加上特效,没动效,直接加吧先, //如果other带特效,符合的元素都加上特效,没动效,直接加吧先,
if (other.effectType != null) { if (other.effectType != null) {
...@@ -1418,7 +1459,7 @@ export default class MainScene extends Scene { ...@@ -1418,7 +1459,7 @@ export default class MainScene extends Scene {
//添加消除元素two,同行或同列 //添加消除元素two,同行或同列
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeMatch(lat) && (lat.row == lat1.row || lat.column == lat1.column)) { if (Tool.judgeEliminate(lat) && (lat.row == lat1.row || lat.column == lat1.column)) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
if (!lat.element.isLock) { if (!lat.element.isLock) {
//3倍 //3倍
...@@ -1441,7 +1482,7 @@ export default class MainScene extends Scene { ...@@ -1441,7 +1482,7 @@ export default class MainScene extends Scene {
//添加消除元素two,同行或同列,需要优化 //添加消除元素two,同行或同列,需要优化
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeMatch(lat) && if (Tool.judgeEliminate(lat) &&
(Math.abs(lat.row - lat1.row) < 2 || Math.abs(lat.column - lat1.column) < 2)) { (Math.abs(lat.row - lat1.row) < 2 || Math.abs(lat.column - lat1.column) < 2)) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
if (!lat.element.isLock) { if (!lat.element.isLock) {
...@@ -1466,7 +1507,7 @@ export default class MainScene extends Scene { ...@@ -1466,7 +1507,7 @@ export default class MainScene extends Scene {
//添加消除元素two,5*5,需要优化 //添加消除元素two,5*5,需要优化
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeMatch(lat) && if (Tool.judgeEliminate(lat) &&
(Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)) { (Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
if (!lat.element.isLock) { if (!lat.element.isLock) {
...@@ -1569,8 +1610,7 @@ export default class MainScene extends Scene { ...@@ -1569,8 +1610,7 @@ export default class MainScene extends Scene {
//对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除 //对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
if (Tool.judgeMatch(this.lattices[i]) && if (Tool.judgeMatch(this.lattices[i]) &&
this.lattices[i].element.type == type && this.lattices[i].element.type == type) {
this.lattices[i].element.effectType != EffectType.MAGICLION) {
if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) { if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
//无特效未枷锁 //无特效未枷锁
...@@ -1593,7 +1633,7 @@ export default class MainScene extends Scene { ...@@ -1593,7 +1633,7 @@ export default class MainScene extends Scene {
this.recoverEle(index); this.recoverEle(index);
//3*3,需要优化 //3*3,需要优化
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
if (Tool.judgeMatch(this.lattices[i]) && if (Tool.judgeEliminate(this.lattices[i]) &&
(Math.abs(this.lattices[i].row - lat.row) < 2 && Math.abs(this.lattices[i].column - lat.column) < 2)) { (Math.abs(this.lattices[i].row - lat.row) < 2 && Math.abs(this.lattices[i].column - lat.column) < 2)) {
if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) { if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) {
this.eliminatedElements.push(i); this.eliminatedElements.push(i);
...@@ -1613,7 +1653,7 @@ export default class MainScene extends Scene { ...@@ -1613,7 +1653,7 @@ export default class MainScene extends Scene {
this.recoverEle(index); this.recoverEle(index);
for (var i = 0; i < Tool.colNum; i++) { for (var i = 0; i < Tool.colNum; i++) {
var ein = Tool.rcToIndex(row, i); var ein = Tool.rcToIndex(row, i);
if (Tool.judgeMatch(this.lattices[ein])) { if (Tool.judgeEliminate(this.lattices[ein])) {
if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) { if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this.eliminatedElements.push(ein); this.eliminatedElements.push(ein);
//1.5倍 //1.5倍
...@@ -1632,7 +1672,7 @@ export default class MainScene extends Scene { ...@@ -1632,7 +1672,7 @@ export default class MainScene extends Scene {
this.recoverEle(index); this.recoverEle(index);
for (var i = 0; i < Tool.rowNum; i++) { for (var i = 0; i < Tool.rowNum; i++) {
var ein = Tool.rcToIndex(i, col); var ein = Tool.rcToIndex(i, col);
if (Tool.judgeMatch(this.lattices[ein])) { if (Tool.judgeEliminate(this.lattices[ein])) {
if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) { if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this.eliminatedElements.push(ein); this.eliminatedElements.push(ein);
//1.5倍 //1.5倍
...@@ -1676,7 +1716,7 @@ export default class MainScene extends Scene { ...@@ -1676,7 +1716,7 @@ export default class MainScene extends Scene {
var effectElements = [], elements = []; var effectElements = [], elements = [];
for (var i = Tool.colNum * Tool.rowNum - 1; i >= 0; i--) { for (var i = Tool.colNum * Tool.rowNum - 1; i >= 0; i--) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (!Tool.judgeMatch(lat)) continue if (!Tool.judgeEliminate(lat)) continue
if (lat.element.effectType != null) { if (lat.element.effectType != null) {
effectElements.push(i); effectElements.push(i);
} else { } else {
...@@ -1689,8 +1729,7 @@ export default class MainScene extends Scene { ...@@ -1689,8 +1729,7 @@ export default class MainScene extends Scene {
this.eliminate(); this.eliminate();
} }
else { else {
//分数 this.isCountingTime = true;
this.score += this.steps * 500;
let countAll = Math.min(this.steps, elements.length); let countAll = Math.min(this.steps, elements.length);
let count = 0; let count = 0;
let deltaCount = 0; let deltaCount = 0;
...@@ -1706,6 +1745,8 @@ export default class MainScene extends Scene { ...@@ -1706,6 +1745,8 @@ export default class MainScene extends Scene {
} }
setTimeout(() => { setTimeout(() => {
this.steps--; this.steps--;
//分数
this.score += 500;
this.addChild(bonusShootAni); this.addChild(bonusShootAni);
//算角度 //算角度
var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y]) var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y])
...@@ -1982,8 +2023,14 @@ export default class MainScene extends Scene { ...@@ -1982,8 +2023,14 @@ export default class MainScene extends Scene {
* @param b * @param b
*/ */
enableMouseEvt(b: boolean) { enableMouseEvt(b: boolean) {
this.touchEnabled = b; // this.touchEnabled = b;
this.touchChildren = b; // this.touchChildren = b;
var arr = [this.elementContainer, this.boomBtn, this.hammerBtn, this.stepBtn]
for (var i = 0; i < arr.length; i++) {
arr[i].touchEnabled = b;
arr[i].touchChildren = b;
}
this.enableTouch = b;
} }
......
...@@ -3,6 +3,7 @@ import { Element } from "./class/Element"; ...@@ -3,6 +3,7 @@ import { Element } from "./class/Element";
import { Lattice } from "./class/Lattice"; import { Lattice } from "./class/Lattice";
import { ElementType } from "./enum/ElementType"; import { ElementType } from "./enum/ElementType";
import { PassType } from "./enum/PassType"; import { PassType } from "./enum/PassType";
import { EffectType } from "./enum/EffectType";
export class Tool { export class Tool {
public static rowNum = 9; public static rowNum = 9;
...@@ -156,10 +157,33 @@ export class Tool { ...@@ -156,10 +157,33 @@ export class Tool {
} }
/** /**
* 判断格子是否可进行匹配 * 判断格子是否可进行匹配,
* 不包括魔力鸟,
* 包括笼子里的
* @param lat * @param lat
*/ */
public static judgeMatch(lat: Lattice) { public static judgeMatch(lat: Lattice) {
//上方格子为null,或格子上元素为null
if (!lat || !lat.element) {
return false
}
//上方元素为石头,或为冰淇淋,或为魔力鸟
else if (lat.element.type == ElementType.ROCK ||
lat.element.type == ElementType.LOLLIPOP ||
lat.element.effectType == EffectType.MAGICLION) {
return false
}
//剩下情况
else {
return true
}
}
/**
* 判断能执行消除的元素,
* 包括所有特效和基本元素
* @param lat
*/
public static judgeEliminate(lat: Lattice) {
//上方格子为null,或格子上元素为null //上方格子为null,或格子上元素为null
if (!lat || !lat.element) { if (!lat || !lat.element) {
return false return false
......
import getResPath from "../../../libs/new_tc/getResPath";
const moiveClip = {};
const resPath = getResPath()
const parser = new window["SVGA"].Parser();
/**
* 引导
*/
export class GuideMsg extends egret.DisplayObjectContainer {
bg: egret.Bitmap;
knowBtn: egret.Bitmap;
closeBtn: egret.Bitmap;
msgTxt: egret.Bitmap;
moiveClip;
/**
* closeCommonBtn_png
* @param num 1到5的引导
*/
constructor() {
super()
var shape: egret.Shape = new egret.Shape();
shape.graphics.beginFill(0x000000, 0.7);
shape.graphics.drawRect(0, 0, 750, 1624);
shape.graphics.endFill();
this.addChild(shape);
//背景图
this.bg = new egret.Bitmap(RES.getRes("guideBg_png"));
this.bg.x = (750 - 639) / 2;
this.bg.y = 300;
this.addChild(this.bg);
//关闭按钮
this.closeBtn = new egret.Bitmap(RES.getRes("closeCommonBtn_png"));
this.closeBtn.x = 615;
this.closeBtn.y = 300;
this.closeBtn.touchEnabled = true;
this.addChild(this.closeBtn);
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
}, this)
//知道了
this.knowBtn = new egret.Bitmap(RES.getRes("guideKnowBtn_png"));
this.knowBtn.x = (750 - 266) / 2;
this.knowBtn.y = 800;
this.knowBtn.touchEnabled = true;
this.addChild(this.knowBtn);
this.knowBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
if (this.parent) this.parent.removeChild(this)
}, this)
}
/**
*
* @param num
* @param callback 里面是移除转圈,加进场景
*/
init(num: number, callback: Function) {
//移除原先的svga
if (this.moiveClip) this.removeChild(this.moiveClip);
//svga
if (moiveClip["guide" + num]) {
this.addChild(moiveClip["guide" + num]);
callback();
} else {
parser.load(resPath + 'resource/assets/svgas/' + 'guide' + num + '.svga', (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.x = 3;
mv.y = -263;
this.moiveClip = mv;
this.addChild(mv);
moiveClip["guide" + num] = mv;
callback();
}, function (error) {
// alert(error.message);
})
}
this.initTxt(num)
}
//调位置
private initTxt(num: number) {
if (!this.msgTxt) {
this.msgTxt = new egret.Bitmap();
this.addChild(this.msgTxt);
}
let y: number;
switch (num) {
case 1:
y = 705;
break;
case 2:
y = 685;
break;
case 3:
y = 685;
break;
case 4:
y = 685;
break;
case 5:
y = 705;
break;
}
var texture: egret.Texture = RES.getRes("guideTxt" + num + "_png");
this.msgTxt.texture = texture;
this.msgTxt.x = (750 - texture.textureWidth) / 2;
this.msgTxt.y = y;
}
}
\ No newline at end of file
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