Commit 80ec99ba authored by zjz1994's avatar zjz1994

炮台暂存

parent 5844ccd5
......@@ -305,6 +305,8 @@ export default class MainBase extends eui.UILayer {
}
RES.getResAsync("ele34_png");
RES.getResAsync("ele36_png");
RES.getResAsync("ele38_png");
RES.getResAsync("ele39_png");
for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png")
}
......
This diff is collapsed.
......@@ -61,7 +61,7 @@ import { Ice } from '../something/class/Ice';
import { Lattice } from '../something/class/Lattice';
import { EffectType } from '../something/enum/EffectType';
import { ElementConfigType } from '../something/enum/ElementConfigType';
import { CandyBaseElementType, codeMsgs, convertBaseElementType, elementMonsterResMap, ElementType, fireworksTypeMap, FiveBaseElementTypes, MonsterBaseElementType, monsterElementMap, submitTran } from '../something/enum/ElementType';
import { CandyBaseElementType, codeMsgs, convertBaseElementType, elementMonsterResMap, ElementType, fireworksTypeMap, FiveBaseElementTypes, MonsterBaseElementType, monsterElementMap, submitTran, connoDirection, forwardDirection } from '../something/enum/ElementType';
import { isIce, isSpecialLattice, isSand, isBlock } from '../something/enum/LatticeType';
import { PassType } from '../something/enum/PassType';
import { RecoverName } from '../something/enum/RecoverName';
......@@ -268,6 +268,8 @@ export default class MainScene extends Scene {
private _steps: number;
private stepNumber: StepNumber;
//新增炮台
cannoArr:Array<{idx:number,ele:Element}> = [];
get steps(): number {
return this._steps
}
......@@ -734,6 +736,7 @@ export default class MainScene extends Scene {
//初始化地图元素
initElement() {
this.cannoArr = new Array();
//没有就根据地图格子随机元素
var elements = this.chapterData.map.elements || Tool.setNumber01(this.chapterData.map.lattices.slice());
for (var i = 0; i < elements.length; i++) {
......@@ -865,12 +868,32 @@ export default class MainScene extends Scene {
this.elementContainer.addChild(egg);
this.lattices[i].element = egg;
break;
case ElementConfigType.CANNO:
let canno:Element = Tool.getElement(ElementType.CANNO);
canno.x = p[0];
canno.y = p[1];
this.elementContainer.addChild(canno);
this.lattices[i].element = canno;
this.cannoArr.push({
idx:i,
ele:canno
});
break;
case ElementConfigType.CANNO_BLOCK:
let canno_block:Element = Tool.getElement(ElementType.CANNO_BLOCK);
canno_block.x = p[0];
canno_block.y = p[1];
this.elementContainer.addChild(canno_block);
this.lattices[i].element = canno_block;
break;
default:
//其他标识按空元素记
this.emptys.push(i);
break
}
}
console.log("关卡大炮配置",this.cannoArr);
}
//重置基础元素及特效类型
......@@ -883,10 +906,12 @@ export default class MainScene extends Scene {
const baseElement = elements[i];
const isCandyEle = elementConfig == ElementConfigType.CANDY;
const isMonsterEle = elementConfig == ElementConfigType.MONSTER;
const isCanno = elementConfig == ElementConfigType.CANNO;
//不是基础元素,跳过,
if (!Tool.judgeBaseEle(this.lattices[i]) && !isCandyEle && !isMonsterEle) continue;
if (!Tool.judgeBaseEle(this.lattices[i]) && !isCandyEle && !isMonsterEle && !isCanno) continue;
//是0,跳过
if (!baseElement && !isCandyEle && !isMonsterEle) continue
const ele: Element = this.lattices[i].element;
if (isCandyEle) { //糖果元素
if (baseElement == CandyBaseElementType.RANDOM) {//如果是随机糖果,目前只有随机糖果
......@@ -903,6 +928,12 @@ export default class MainScene extends Scene {
}
ele.resetToMonsterView(elementMonsterResMap[ele.type]);
}
else if(isCanno){//是炮台
var dirarr: number[] = Tool.returnTO(elements[i]);
var dirnum = dirarr[1]||1;
var dirType = connoDirection[dirnum];
ele.resetToCannoView(dirType);
}
else {
//解析elements[i];
var arr: number[] = Tool.returnTO(elements[i]);
......@@ -1188,6 +1219,8 @@ export default class MainScene extends Scene {
var ele = e.target.parent
if (ele instanceof Element &&
// ele.type != ElementType.ROCK &&
ele.type != ElementType.CANNO &&
ele.type != ElementType.CANNO_BLOCK &&
!ele.hasState(StateType.BLOCK_LOCK) && //石门无法消除
ele.type != ElementType.LOLLIPOP) {
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, fun, this);
......@@ -2014,6 +2047,23 @@ export default class MainScene extends Scene {
this.pushScoreAni(baseScore * this.commonContinuityTimes, Tool.getPositionByIndex(index))
}
}
if(this.eliminatedElements.length>0){
for(var i=0;i<this.eliminatedElements.length;i++){
var ielimidx = this.eliminatedElements[i];
for(var p=0;p<this.cannoArr.length;p++){
var pcannoidx = this.cannoArr[p].idx;
var isnext = Tool.checkNebByidx(pcannoidx,ielimidx);
if(isnext){
var pcannoele = this.cannoArr[p].ele;
pcannoele.addOneCannoStat();
}
}
}
}
return this.eliminatedElements.length > 0;
}
......@@ -2075,6 +2125,22 @@ export default class MainScene extends Scene {
return
}
//炮台充能发射
var emitcanno:Element;
for(var p=0;p<this.cannoArr.length;p++){
var pcanno = this.cannoArr[p].ele;
var pcannostat = pcanno.checkCannoStat();
if(pcannostat){
emitcanno = pcanno;
break;
}
}
if(emitcanno){
console.log("大炮发射");
this.fireCanno(emitcanno);
return;
}
if (this._converyorTag) {
await doConveyorAI(this);
......@@ -2211,6 +2277,53 @@ export default class MainScene extends Scene {
})
}
//大炮发射
fireCanno(canno:Element){
var cannodir = canno._cannoDir;
var cannorow = canno.row;
var cannocol = canno.column;
var cannoFireArr:number[] = new Array();
if(cannodir==forwardDirection.left){
for(var i=cannocol;i>=0;i--){
var iemitidx = Tool.rcToIndex(cannorow,i);
cannoFireArr.push(iemitidx);
}
}else if(cannodir==forwardDirection.up){
for(var i=cannorow;i>=0;i--){
var iemitidx = Tool.rcToIndex(i,cannocol);
cannoFireArr.push(iemitidx);
}
}else if(cannodir==forwardDirection.right){
for(var i=cannocol;i<Tool.colNum;i++){
var iemitidx = Tool.rcToIndex(cannorow,i);
cannoFireArr.push(iemitidx);
}
}else if(cannodir==forwardDirection.down){
for(var i=cannorow;i<Tool.rowNum;i++){
var iemitidx = Tool.rcToIndex(i,cannocol);
cannoFireArr.push(iemitidx);
}
}
for(var j=0;j<cannoFireArr.length;j++){
var jemitidx = cannoFireArr[j];
var lat = this.lattices[jemitidx];
var caneliminate = Tool.judgeEliminate(lat);
if(lat&&(caneliminate||lat.element.type==ElementType.CANNO_BLOCK)){
if(this.eliminatedElements.indexOf(jemitidx)==-1){
this.eliminatedElements.push(jemitidx);
}
//加分
if(lat.element.type==ElementType.CANNO_BLOCK){
// console.log("炮台石头消除");
break;
}
}
}
setTimeout(()=>{
this.eliminate();
canno.resetCannoStat();
},200);
}
checkAllBlock() {
// this.lattices.filter(item => item.block).forEach((item) => {
// item.block.nextState();
......@@ -2636,6 +2749,10 @@ export default class MainScene extends Scene {
//统一逻辑,个数等,都进里面
this.removeFestivalEleSmall(index);
}
//炮台石头
else if (ele.type == ElementType.CANNO_BLOCK){
this.removeCannoBlock(index);
}
}
}
//从消除列表移除
......@@ -3285,7 +3402,13 @@ export default class MainScene extends Scene {
//播放动效
this.playAni(RecoverName.ROCK_ANI, Tool.getPositionByIndex(index))
}
/**
* 炮台石头的动效
*/
removeCannoBlock(index:number){
this.removeOperation(index);
//炮台石头的动效
}
/**
* 果冻的移除,包括动效
* @param index
......
......@@ -230,6 +230,21 @@ export class Tool {
}
return false
}
/**
* 根据idx判断相邻
* @param a
* @param b
*/
public static checkNebByidx(a:number,b:number){
var arc = this.indexToRc(a);
var brc = this.indexToRc(b);
if (Math.abs(arc[0] - brc[0]) == 1 && Math.abs(arc[1] - brc[1]) == 0) {
return true
} else if (Math.abs(arc[0] - brc[0]) == 0 && Math.abs(arc[1] - brc[1]) == 1) {
return true
}
return false
}
/**
* 数组中插入一个数值,按顺序的
......@@ -281,8 +296,10 @@ export class Tool {
lat.element.type == ElementType.JELLY_MONSTER ||
lat.element.type == ElementType.FIREWORKS_SHOOTER ||
lat.element.type == ElementType.CHICKEN_EGG ||
lat.element.type == ElementType.FESTIVALELE_BIG //||
lat.element.type == ElementType.FESTIVALELE_BIG ||
// lat.element.type == ElementType.FESTIVALELE_SMALL
lat.element.type == ElementType.CANNO ||
lat.element.type == ElementType.CANNO_BLOCK
) {
return false
}
......@@ -344,7 +361,9 @@ export class Tool {
//上方元素为冰淇淋
else if (lat.element.type == ElementType.LOLLIPOP ||
lat.element.type == ElementType.JELLY_MONSTER ||
lat.element.type == ElementType.FIREWORKS_SHOOTER
lat.element.type == ElementType.FIREWORKS_SHOOTER ||
lat.element.type == ElementType.CANNO ||
lat.element.type == ElementType.CANNO_BLOCK
) {
return false
}
......@@ -428,7 +447,9 @@ export class Tool {
ele.type == ElementType.FIREWORKS_SHOOTER ||
ele.type == ElementType.CHICKEN_EGG ||
ele.type == ElementType.FESTIVALELE_BIG ||
ele.type == ElementType.FESTIVALELE_SMALL
ele.type == ElementType.FESTIVALELE_SMALL ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
) {
return false;
}
......@@ -454,7 +475,9 @@ export class Tool {
ele.hasState(StateType.HAIRBALLGREY) ||
ele.hasState(StateType.BLOCK_LOCK) ||
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN)
ele.hasState(StateType.HAIRBALLBROWN) ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
) {
return false;
}
......@@ -474,7 +497,9 @@ export class Tool {
ele.hasState(StateType.BLOCK_LOCK) ||
ele.monster ||
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN)
ele.hasState(StateType.HAIRBALLBROWN) ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
) {
return false;
}
......@@ -860,7 +885,6 @@ export class Tool {
}
return Tool.randomT(arr);
}
/**
* 根据关卡的地图数据generateLats
*
......
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//551-575
export const Chapters22: ChapterData[] = [
//551
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 25,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 45,
},
],
},
starScores: [1000, 5000, 10000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[0, 18], [1, 19], [2, 20]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 18, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 19, 1, 18, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
baseElements: [
0, 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,
0, 0, 0, 0, 20, 0, 0, 0, 0,
],
// recycles: [70, 71, 72, 73]
},
}
]
......@@ -69,7 +69,7 @@ chapters.forEach((chapter,index) => {
*/
export function getChapterData(index: number): ChapterData {
//没有数据就返回第一关数据
return chapters[index] || chapters[1];
return chapters[index] || chapters[551];
}
var a = {
......
......@@ -13,7 +13,7 @@ import { createCandyDis3Ani } from "../anis/candy/createCandyDis3Ani";
import { createCandyDis4Ani } from "../anis/candy/createCandyDis4Ani";
import { createCandySubAni } from "../anis/candy/createCandySubAni";
import { EffectType } from "../enum/EffectType";
import { CandyBaseElementType, ElementType, FiveBaseElementTypes, transElementRes } from "../enum/ElementType";
import { CandyBaseElementType, ElementType, FiveBaseElementTypes, transElementRes, forwardDirection } from "../enum/ElementType";
import { RecoverName } from "../enum/RecoverName";
import { stateDatas, StateType } from "../enum/StateType";
import { ExplosiveBgAni } from "../periodAni/ExplosiveBgAni";
......@@ -188,6 +188,49 @@ export class Element extends eui.Component {
this.addCandyStandbyAni();
}
_cannoDir:forwardDirection;
private _cannoStat:number = 0;
resetToCannoView(cannodir:forwardDirection){
this._cannoDir = cannodir;
this.resetCannoStat();
this.showImage.x = 0;
this.showImage.y = 0;
this.showImage.anchorOffsetX = this.showImage.width / 2;
this.showImage.anchorOffsetY = this.showImage.height / 2;
var roaidx:number;
if(cannodir==forwardDirection.left){
roaidx = 0;
}else if(cannodir==forwardDirection.up){
roaidx = 1;
}else if(cannodir==forwardDirection.right){
roaidx = 2;
}else if(cannodir==forwardDirection.down){
roaidx = 3;
}
this.showImage.rotation = [-90,0,90,180][roaidx];
}
changeShowCannoStat(){
this.cannolab.text = this._cannoStat+"";
}
checkCannoStat(){
if(this._cannoStat==3){
return true;
}
return false;
}
resetCannoStat(){
this._cannoStat = 0;
this.changeShowCannoStat();
}
addOneCannoStat(){
this._cannoStat += 1;
if(this._cannoStat>3){
this._cannoStat = 3;
}
this.changeShowCannoStat();
}
playCandyDieAni() {
var p = Tool.getPositionByIndex(this.index);
createCandyDieBgAni(p[0], p[1], this.stage);
......@@ -358,6 +401,8 @@ export class Element extends eui.Component {
*/
private states: State[] = []
//模拟炮台发射情况
protected cannolab: eui.Label;
/**
*
* @param type 只应该是基础元素和特殊元素
......@@ -366,8 +411,17 @@ export class Element extends eui.Component {
super();
this._type = type;
this.showImage = new eui.Image();
this.changeSource("ele" + this.type + "_png");
this.addChild(this.showImage);
this.cannolab = new eui.Label();
this.cannolab.size = 30;
this.cannolab.textColor = 0xff0000;
this.cannolab.x = 0;
this.cannolab.y = 0;
this.addChild(this.cannolab);
this.cannolab.visible = type == ElementType.CANNO;
//鸡蛋
if (type == ElementType.CHICKEN_EGG) {
this.chickenEgg = Pool.takeOut(RecoverName.CHICKEN_EGG)
......@@ -398,7 +452,7 @@ export class Element extends eui.Component {
changeSource(source: string) {
// this.showImage.source = source;
var texture: egret.Texture = RES.getRes(source);
if (!texture) { return; }
if (!texture) { return console.error("未找到纹理",source,this.type); }
this.showImage.texture = texture
this.showImage.x = -texture.textureWidth / 2;
......@@ -429,6 +483,8 @@ export class Element extends eui.Component {
egret.Tween.removeTweens(this.showImage);
//类型重置,showImage修改
this._type = type;
this.cannolab.visible = type == ElementType.CANNO;
this.changeSource("ele" + type + "_png");
//特效重置
this.effectType = null;
......
......@@ -68,10 +68,7 @@ export enum ElementConfigType {
HONEY_POT = 16,
FLOWER = 17,
/** 大炮 */
CANNO_DIR_TOP = 18,
CANNO_DIR_BOTTOM = 19,
CANNO_DIR_LEFT = 20,
CANNO_DIR_RIGHT = 21,
CANNO = 18,
/** 大炮石头 */
CANNO_BLOCK = 22,
CANNO_BLOCK = 19,
}
\ No newline at end of file
......@@ -30,39 +30,36 @@ export enum ElementType {
FESTIVALELE_BIG, //节日元素大中间一个13
FESTIVALELE_SMALL, //节日元素飞溅的小元素14
CANDY_RABBIT,//兔子
CANDY_CHICKEN,//鸟
CANDY_CATTLE,//牛
CANDY_LION,//狮子
CANDY_PIG,//猪
CANDY_RABBIT,//兔子15
CANDY_CHICKEN,//鸟16
CANDY_CATTLE,//牛17
CANDY_LION,//狮子18
CANDY_PIG,//猪19
MONSTER_JELLY1,
JELLY_MONSTER,
MONSTER_JELLY1,//20
JELLY_MONSTER,//21
FIREWORKS_RABBIT,//烟花目标元素,下同
FIREWORKS_CHICKEN,
FIREWORKS_CATTLE,
FIREWORKS_LION,
FIREWORKS_PIG,
FIREWORKS_RABBIT,//烟花目标元素,下同22
FIREWORKS_CHICKEN,//23
FIREWORKS_CATTLE,//24
FIREWORKS_LION,//25
FIREWORKS_PIG,//26
FIREWORKS_SHOOTER,//烟花
FIREWORKS_SHOOTER,//烟花27
MONSTER_RABBIT,//独眼怪
MONSTER_CHICKEN,
MONSTER_CATTLE,
MONSTER_LION,
MONSTER_PIG,
MONSTER_RABBIT,//独眼怪28
MONSTER_CHICKEN,//29
MONSTER_CATTLE,//30
MONSTER_LION,//31
MONSTER_PIG,//32
FISH,//气鼓鱼
HONEY,// 蜂蜜
HONEY_POT,//蜂蜜罐
SAND,
FLOWER,
CANNO_LEFT,
CANNO_RIGHT,
CANNO_TOP,
CANNO_BOTTOM,
CANNO_BLOCK,
FISH,//气鼓鱼33
HONEY,// 蜂蜜34
HONEY_POT,//蜂蜜罐35
SAND,//36
FLOWER,//37
CANNO,//38
CANNO_BLOCK,//39
}
export const isMonsterEle = (t: ElementType) => {
......@@ -93,6 +90,12 @@ export enum MonsterBaseElementType {
}
export enum forwardDirection{
left="left",
up="up",
right="right",
down="down",
}
export const fireworksTypeMap: any = {}
fireworksTypeMap[ElementType.RABBIT] = ElementType.FIREWORKS_RABBIT;
fireworksTypeMap[ElementType.CHICKEN] = ElementType.FIREWORKS_CHICKEN;
......@@ -156,6 +159,13 @@ export const monsterElementMap = {
"5": ElementType.PIG,
}
export const connoDirection = {
"1":forwardDirection.left,
"2":forwardDirection.up,
"3":forwardDirection.right,
"4":forwardDirection.down,
}
export const elementMonsterResMap = {
"0": ElementType.MONSTER_RABBIT,
"1": ElementType.MONSTER_CHICKEN,
......
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