Commit c24326ea authored by wildfirecode's avatar wildfirecode

1

parent 3fd1a080
......@@ -95,6 +95,7 @@ import { DataManager } from './../../libs/tw/manager/DataManager';
import { NetManager } from './../../libs/tw/manager/NetManager';
import doMonsterAI from './doMonsterAI';
import jellyMonsterAI from './jellyMonsterAI';
import doFishAI from './doFishAI';
const aniClass = {
"BoomAni": BoomAni,
......@@ -844,7 +845,7 @@ export default class MainScene extends Scene {
//初始化引导,游戏和道具
initGuide() {
//游戏引导
const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12, 17, 25, 41, 61, 101, 121, 226,377]
const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12, 17, 25, 41, 61, 101, 121, 226, 377]
if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) {
if (!readCache(getCacheKey() + this.chapter)) {
this.gameGuide = new GameGuide(this);
......@@ -1984,12 +1985,18 @@ export default class MainScene extends Scene {
async fallCallback() {
//掉落后有消除,执行消除
if (this.threeMatch()) {
this.eliminate()
this.eliminate();
return
}
const doFishResult = await doFishAI(this);
if (doFishResult.length > 0) {
//这里应该先播放动画,播放完了,再执行消除
this.eliminate();
return;
}
const genarateEffect = await doMonsterAI(this);
if (genarateEffect.length > 0) {//如果有苏醒的怪物被消除,那么表示可以自动消除,则不需要进行下一步
genarateEffect.forEach((ele:Element) => {
genarateEffect.forEach((ele: Element) => {
this.eliminatedElements.push(ele.index);
});
await wait(500);
......@@ -2464,6 +2471,14 @@ export default class MainScene extends Scene {
// else if (ele.type == ElementType.FIREWORKS_SHOOTER) {
// //没有处理
// }
//fish
else if (ele.type == ElementType.FISH) {
if (ele.fishCanEliFlag) {
this.playAni(RecoverName.ELEDIS_ANI, p)
//这里面会去算个数
this.recoverEle(index);
}
}
//鸡蛋
else if (ele.type == ElementType.CHICKEN_EGG) {
//额外逻辑,
......@@ -2554,6 +2569,9 @@ export default class MainScene extends Scene {
(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) {
this.eliminatedElements.push(i);
if (this.lattices[i].element.type == ElementType.FISH) {
this.lattices[i].element.nextFishState();
}
//加分
if (Tool.judgeHasScore(this.lattices[i].element)) {
this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes["2"], Tool.getPositionByIndex(i))
......@@ -2573,6 +2591,9 @@ export default class MainScene extends Scene {
if (Tool.judgeEliminate(this.lattices[ein])) {
if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this.eliminatedElements.push(ein);
if (this.lattices[ein].element.type == ElementType.FISH) {
this.lattices[ein].element.nextFishState();
}
//加分
if (Tool.judgeHasScore(this.lattices[ein].element)) {
this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes["0"], Tool.getPositionByIndex(ein))
......@@ -2592,6 +2613,9 @@ export default class MainScene extends Scene {
if (Tool.judgeEliminate(this.lattices[ein])) {
if (this.eliminatedElements.indexOf(ein) < 0 && effectIndexs.indexOf(ein) < 0) {
this.eliminatedElements.push(ein);
if (this.lattices[ein].element.type == ElementType.FISH) {
this.lattices[ein].element.nextFishState();
}
//加分
if (Tool.judgeHasScore(this.lattices[ein].element)) {
this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes["1"], Tool.getPositionByIndex(ein))
......@@ -3047,12 +3071,34 @@ export default class MainScene extends Scene {
}
}
}
checkFishNebEle(lat0: Lattice) {
if (!lat0) return;
var indexMy = lat0.index;
var indexs = [
indexMy - Tool.colNum,
indexMy + Tool.colNum,
];
if (lat0.column > 0) {
indexs.push(indexMy - 1)
}
if (lat0.column < Tool.colNum - 1) {
indexs.push(indexMy + 1)
}
for (let i = 0; i < indexs.length; i++) {
let index = indexs[i];
let lat = this.lattices[index];
if (lat && lat.element && lat.element.type == ElementType.FISH) {
lat.element.setFishNebFlag();
}
}
}
//检查附近所有元素
checkNebAll(latttice: Lattice, ele?: Element) {
//如果格子有冰
this.iceBroken(latttice);
this.checkFireworksNebEle(latttice, ele);
this.checkFishNebEle(latttice);
//如果附近有石头
this.checkNebEle(latttice, (lat) => {
return lat && lat.element && lat.element.type == ElementType.ROCK
......@@ -3152,7 +3198,7 @@ export default class MainScene extends Scene {
}
//时间再调cd
setTimeout(() => {
callback();
callback();
}, 400)
}
......
import MainScene from "./MainScene";
import { ElementType } from "../something/enum/ElementType";
import wait from "../../libs/new_tc/wait";
/**
* fish爆炸
*/
export default async (thisObj: MainScene) => {
//先找出所有有碰撞状态的fish
//如果有的话那么可以设置消除状态了
const indexs: number[] = [];
for (var i = 0; i < thisObj.lattices.length; i++) {
const lattice = thisObj.lattices[i]
if (lattice && lattice.element && lattice.element.type == ElementType.FISH && lattice.element.isNeb) {
lattice.element.fishCanEliFlag = true;
indexs.push(i);
thisObj.eliminatedElements.push(i);
}
}
await wait(1000);
//然后再消除四周的
return indexs;
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ import { ElementType } from "../enum/ElementType";
export const Chapters16: ChapterData[] = [
//1引导基本消除
{
baseElementTypes: [0, 1, 2, 3],
baseElementTypes: [0, 1, 2, 3,4],
bubbleProbability: 0,
stepCount: 25,
passTarget: {
......@@ -47,14 +47,14 @@ export const Chapters16: ChapterData[] = [
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
baseElements: [
20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 0, 0, 0, 20, 0, 0,
0, 20, 10, 20, 0, 20, 10, 20, 0,
20, 10, 20, 10, 20, 10, 20, 10, 20,
20, 10, 20, 20, 10, 20, 20, 10, 20,
0, 20, 10, 20, 10, 20, 10, 20, 0,
0, 0, 20, 10, 20, 10, 20, 0, 0,
0, 0, 0, 20, 10, 20, 0, 0, 0,
21, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 30, 0, 0, 0, 20, 0, 0,
0, 20, 10, 20, 0, 30, 10, 20, 0,
20, 10, 20, 10, 20, 10, 40, 10, 20,
21, 10, 20, 20, 0, 40, 20, 10, 20,
0, 30, 10, 30, 10, 30, 10, 20, 0,
0, 0, 20, 30, 22, 10, 20, 0, 0,
0, 0, 0, 20, 10, 30, 0, 0, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0,
],
// recycles: [70, 71, 72, 73]
......
......@@ -28,12 +28,31 @@ import { FestivalEle } from "./FestivalEle";
import { FestivalEle2 } from "./FestivalEle2";
import { Monster } from "./Monster";
import { State } from "./State";
import wait from "../../../libs/new_tc/wait";
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
* 最好到时按,底图,动效,气泡,笼子,毛球,进行分层,如果多个状态要共存时,必须分层,到时气泡的动画,要写再自己的层里
*/
export class Element extends eui.Component {
private _fishState = 0;
private _isNeb: boolean;//是否
get isNeb() { return this._isNeb }
fishCanEliFlag: boolean;
//尝试设置碰撞状态,如果之前被特效集中,那么可以设置碰撞状态。碰撞状态之后可以准备消除。
setFishNebFlag() {
if (this._fishState > 0) {
this._isNeb = true;
}
}
async nextFishState() {
await wait(1000);
this._fishState++;
if (this._fishState == 1) {
this.changeSource("ele33_1_png");
}
}
private _fireworksTimer = 0;
get canFire() {
const t = new Date().getTime();
......@@ -137,11 +156,13 @@ export class Element extends eui.Component {
resetToMonsterView(res: ElementType) {
this.changeSource("ele" + res + "_png");
this.monster = new Monster(res,this.type);
this.monster = new Monster(res, this.type);
this.addChild(this.monster);
this.showImage.alpha = 0;
}
resetToFishView() {
this._fishState = 0;
this._isNeb = false;
this.changeSource("ele33_0_png");
// this.monster = new Monster(res,this.type);
// this.addChild(this.monster);
......@@ -396,6 +417,7 @@ export class Element extends eui.Component {
* @param type 只应该是基础元素和特殊元素
*/
reset(type: ElementType) {
this._isNeb = false;
this.alpha = this.scaleX = this.scaleY = 1;
this.showImage.anchorOffsetX = 0;
this.showImage.anchorOffsetY = 0;
......
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