Commit 5abc1aff authored by zjz1994's avatar zjz1994

草地暂存

parent d6ddd7e9
......@@ -308,6 +308,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync(`ele${i}_2_png`);
RES.getResAsync(`ele${i}_3_png`);
}
//检查下,有不用的资源
RES.getResAsync("ele34_png");
RES.getResAsync("ele36_png");
RES.getResAsync("ele38_png");
......@@ -315,6 +316,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele40_png");
RES.getResAsync("kuang_png");
RES.getResAsync("wormhole_png");
RES.getResAsync("ele41_png");
for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png")
......
......@@ -241,7 +241,7 @@
"name": "helpGroup"
},
{
"keys": "virprizebg_png,lightdi_png,wormhole_png",
"keys": "virprizebg_png,lightdi_png,wormhole_png,ele41_png",
"name": "preload"
}
],
......@@ -5401,6 +5401,11 @@
"name": "wormhole_png",
"type": "image",
"url": "assets/mainScene/wormhole.png"
},
{
"name": "ele41_png",
"type": "image",
"url": "assets/mainScene/ele41.png"
}
]
}
\ No newline at end of file
export enum GameEvent{
Turfing='Turfing',
}
\ No newline at end of file
......@@ -74,7 +74,7 @@ import {
submitTran,
forwardDirection,
} from '../something/enum/ElementType';
import { isIce, isSpecialLattice, isSand, isBlock, LatticeType } from '../something/enum/LatticeType';
import { isIce, isSpecialLattice, isSand, isBlock, LatticeType, isGrass, onlyGrass } from '../something/enum/LatticeType';
import { PassType } from '../something/enum/PassType';
import { RecoverName } from '../something/enum/RecoverName';
import { StateType } from '../something/enum/StateType';
......@@ -120,6 +120,8 @@ import doConveyorAI from './doConveyorAI';
import Rect = eui.Rect;
import WormHole from '../something/class/WormHole';
import doWormHoleAI from './doWormHoleAI';
import { Grass } from '../something/class/Grass';
import { GameEvent } from '../configData/GameEvent';
const aniClass = {
"BoomAni": BoomAni,
......@@ -389,6 +391,10 @@ export default class MainScene extends Scene {
effectContainer:egret.DisplayObjectContainer;
guideContainer:egret.DisplayObjectContainer;
festivalContainer:egret.DisplayObjectContainer;
//铺草坪
turfingArr:Array<number> = []
constructor(){
super();
// console.log('mainscene-------constructor');
......@@ -1122,7 +1128,14 @@ export default class MainScene extends Scene {
latticeDisplay = getSandDisplayBlock();
}
this.lattices[i].sand = latticeDisplay as Sand;
} else {
} else if(isGrass(latticesD[i])){//草坪,在石门关闭状态下是否显示
latticeDisplay = Pool.takeOut(RecoverName.GRASS);
if(!latticeDisplay){
latticeDisplay = new Grass();
}
this.lattices[i].grass = latticeDisplay as Grass;
}
else {
latticeDisplay = genBlockDisplay(latticesD[i]);
this.lattices[i].block = latticeDisplay as BaseBlock;
}
......@@ -1632,8 +1645,11 @@ export default class MainScene extends Scene {
//容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
}
removeEvents() {
console.log('mainscene-------removeEvents');
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
......@@ -2705,6 +2721,8 @@ export default class MainScene extends Scene {
* 三消判断
*/
threeMatch(s?: Element, o?: Element) {
//铺路草地检查
var grassArr = new Array();
//横排检测
for(var i = 0; i < Tool.rowNum; i++) {
//集合横排元素
......@@ -2715,10 +2733,14 @@ export default class MainScene extends Scene {
let re = Tool.fn(arr, this.lattices);
for(var j = 0; j < re.length; j++) {
let len = re[j].length;
if(len >= 3) {
let igrassarr = new Array();
for(var k = 0; k < len; k++) {
let ele = this.lattices[re[j][k]].element;
this.eliminatedElements.push(re[j][k]);
igrassarr.push(re[j][k]);
//是五个的
if(len >= 5) {
if(k == 2) {
......@@ -2737,6 +2759,7 @@ export default class MainScene extends Scene {
}
}
}
grassArr.push(igrassarr);
}
}
}
......@@ -2751,8 +2774,11 @@ export default class MainScene extends Scene {
for(var j = 0; j < re.length; j++) {
let len = re[j].length;
if(len >= 3) {
let igrassarr = new Array();
for(var k = 0; k < len; k++) {
let ele = this.lattices[re[j][k]].element;
igrassarr.push(re[j][k]);
//是五个的,特殊处理
if(len >= 5) {
if(k == 2) {
......@@ -2796,6 +2822,7 @@ export default class MainScene extends Scene {
}
}
}
grassArr.push(igrassarr);
}
}
}
......@@ -2808,6 +2835,7 @@ export default class MainScene extends Scene {
this.pushScoreAni(baseScore * this.commonContinuityTimes, Tool.getPositionByIndex(index))
}
}
this.checkTurfing(grassArr);
return this.eliminatedElements.length > 0;
}
......@@ -5370,6 +5398,10 @@ export default class MainScene extends Scene {
//先赋值指向
let ele = this.lattices[index].element;
//猩猩新增,去除ticker
ele.addDisable();
......@@ -5746,4 +5778,57 @@ export default class MainScene extends Scene {
}
}
checkTurfing(grassArr:Array<Array<number>>){
for(let i=0;i<grassArr.length;i++){
let igrassarr = grassArr[i];
let ihavegrass = false;
let needpuarr = new Array();
for(let j=0;j<igrassarr.length;j++){
var jlat:Lattice = this.lattices[igrassarr[j]];
if(jlat){
if(jlat.grass){
ihavegrass = true;
}else{
needpuarr.push(igrassarr[j]);
}
}
}
if(ihavegrass&&needpuarr.length>0){
for(let p=0;p<needpuarr.length;p++){
let pidx = needpuarr[p];
this.turfing(pidx);
}
}
}
}
//新增铺草地
turfing(index:number){
var lat = this.lattices[index];
if(lat&&lat.element){//消除元素铺草坪
//存在冰块和流沙时,草坪铺不上去
if(lat.ice&&lat.ice.alpha!=0){
return;
}
else if(lat.block&&lat.block.ice&&lat.block.canIceBroken&&lat.block.ice.alpha!=0){
return;
}
else if(lat.sand){
return;
}
if(!lat.grass){
let grassDisplay = Pool.takeOut(RecoverName.GRASS);
if(!grassDisplay){
grassDisplay = new Grass();
}
lat.grass = grassDisplay;
this.mapupContainer.addChild(grassDisplay);
var grasspos = Tool.getPositionByIndex(index);
grassDisplay.x = grasspos[0];
grassDisplay.y = grasspos[1];
}
}
}
}
\ No newline at end of file
......@@ -69,6 +69,7 @@ const judgeActionIndex = (index: number, lattices: Lattice[],worms:number[][]):
!lattices[i].sand &&
!lattices[i].block &&
!lattices[i].ice &&
!lattices[i].grass&&
!lattices[i].element.monster &&
!Tool.judgeInWormHole(i,worms)
)||
......
......@@ -1314,4 +1314,13 @@ export class Tool {
}
return _have;
}
//判断草坪能否铺出去
public static judgeTurfing(lat:Lattice){
if(this.judgeUpsetMove(lat)){//能移动的筛
}else if(lat&&lat.element&&lat.element.type==ElementType.CANNO){
}
}
}
\ No newline at end of file
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//651-675
export const Chapters26: ChapterData[] = [
//651
......@@ -87,6 +88,7 @@ export const Chapters26: ChapterData[] = [
]
}
},
//652
{ baseElementTypes: [ 0, 1, 2, 3 ], bubbleProbability: 0, stepCount: 28, passTarget: { type: 1, elements: [ { type: 9, count: 63 }, { type: 0, count: 102 } ] }, starScores: [], map: {
lattices: [
3, 0, 0, 0, 0, 0, 0, 0, 3,
......@@ -111,7 +113,7 @@ export const Chapters26: ChapterData[] = [
1, 2, 5, 4, 5, 4, 5, 2, 1 ],
baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 16, type: null }, { index: 20, type: null }, { index: 24, type: null }, { index: 30, type: null }, { index: 32, type: null }, { index: 40, type: null } ] } },
//653
{ baseElementTypes: [ 4, 3, 2, 1 ], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [ { type: 9, count: 73 } ] }, starScores: [ 15000, 20000, 25000 ], map: {
lattices: [
3, 3, 3, 3, 3, 3, 3, 3, 3,
......@@ -148,7 +150,7 @@ export const Chapters26: ChapterData[] = [
], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null } ] } },
//671
//654
{ baseElementTypes: [ 1, 2, 3, 4 ], bubbleProbability: 0,
stepCount: 24, passTarget: { type: 1, elements: [ { type: 9, count: 73 }, { type: 1, count: 99 } ] }, starScores: [ 15000, 20000, 25000 ], map: {
lattices: [
......@@ -187,9 +189,9 @@ export const Chapters26: ChapterData[] = [
], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 36, type: null }, { index: 44, type: null } ] } },
//672
//655
{ baseElementTypes: [ 1, 2, 0, 4 ], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [ { type: 22, count: 25 }, { type: 24, count: 25 }, { type: 26, count: 25 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 4, 4, 1, 41, 41, 41, 1, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 4, 4 ], connectedLats: [ [ 31, 49 ] ], conveyor: [], conveyorConnectedLats: [], WORMHOLE: [ [ 37, 38 ], [ 42, 43 ] ], elements: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 1, 13, 13, 13, 13, 13, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 2, 2, 2, 2, 2, 2, 2, 5, 1, 1, 2, 2, 2, 2, 2, 1, 1 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null } ] } },
//654
//656
{ baseElementTypes: [ 0, 1, 2, 3 ], bubbleProbability: 0,
stepCount: 23, passTarget: { type: 1, elements: [
{ type: 1, count: 5 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [
......@@ -220,7 +222,7 @@ export const Chapters26: ChapterData[] = [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 16, type: null }, { index: 26, type: null }, { index: 36, type: null } ] } },
//657
{ baseElementTypes: [ 3, 4, 1, 2 ], bubbleProbability: 0, stepCount: 20, passTarget: { type: 1, elements: [ { type: 9, count: 49 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [
0, 0, 0, 3, 0, 2, 0, 0, 0,
......@@ -253,4 +255,64 @@ export const Chapters26: ChapterData[] = [
0, 0, 0, 0, 0, 0, 0, 0, 0
], recycles: [], generateLats: [ { index: 3, type: null }, { index: 5, type: null }, { index: 10, type: null }, { index: 11, type: null }, { index: 13, type: null }, { index: 16, type: null }, { index: 24, type: null }, { index: 27, type: null }, { index: 35, type: null } ] } },
//658
{
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, 8, 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, 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,
],
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]
},
},
]
......@@ -77,7 +77,7 @@ chapters.forEach((chapter,index) => {
*/
export function getChapterData(index: number): ChapterData {
//没有数据就返回第一关数据
// return chapters[626];
return chapters[658];
return chapters[index] || chapters[1];
}
......
import { ElementType } from "../enum/ElementType";
export class Grass extends egret.Bitmap {
texture;
constructor(){
super();
var texture:egret.Texture = RES.getRes("ele"+ElementType.Grass+"_png");
this.texture = texture;
this.anchorOffsetX = texture.textureWidth/2;
this.anchorOffsetY = texture.textureHeight/2;
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import { Ice } from "./Ice";
import Sand from "../Sand";
import { LatticeType } from "../enum/LatticeType";
import { ElementType } from "../enum/ElementType";
import { Grass } from "./Grass";
/**
* 位置信息直接用一个二维数组记录,然后用row,col取
......@@ -22,6 +23,7 @@ export class Lattice {
*/
block: BaseBlock;
sand: Sand;
grass:Grass;
/**
* 上面的元素(null,消除元素,石头,冰激凌等),
*/
......@@ -86,6 +88,7 @@ export class Lattice {
//重置属性,后面自行赋值
this.ice = null;
this.block = null;
this.grass = null;
this.element = null;
this.up = null;
this.down = null;
......@@ -105,6 +108,7 @@ export class Lattice {
this.ice = null;
this.block = null;
this.sand = null;
this.grass = null;
this.element = null;
this.up = null;
this.down = null;
......
......@@ -61,6 +61,9 @@ export enum ElementType {
CANNO,//38
CANNO_BLOCK,//39
Pongo,//40
Grass,//41
}
export const isMonsterEle = (t: ElementType) => {
......
......@@ -10,6 +10,9 @@ export enum LatticeType {
BLOCK_AND_ICE = 5,
BLOCK_AND_DARK_ICE = 6,
SAND = 7,
GRASS = 8,
BLOCK_AND_GRASS = 9,
}
......@@ -29,9 +32,15 @@ export const isIce = (type: LatticeType) => {
}
export const isBlock = (type: LatticeType) => {
return type == LatticeType.BlOCK || type == LatticeType.BLOCK_AND_ICE || type == LatticeType.BLOCK_AND_DARK_ICE
return type == LatticeType.BlOCK || type == LatticeType.BLOCK_AND_ICE || type == LatticeType.BLOCK_AND_DARK_ICE || type == LatticeType.BLOCK_AND_GRASS;
}
export const isSand = (type: LatticeType) => {
return type == LatticeType.SAND
}
export const onlyGrass = (type:LatticeType)=>{
return type == LatticeType.GRASS;
}
export const isGrass = (type:LatticeType)=>{
return type== LatticeType.GRASS||type==LatticeType.BLOCK_AND_GRASS;
}
\ No newline at end of file
......@@ -89,5 +89,7 @@ export enum RecoverName {
CANNOBLOCKANI = 'CANNOBLOCKANI',//炮台石头破碎
CANNO = 'CANNO',//炮台
CANNOFIRE = 'CANNOFIRE',//炮台发射
CANNOLIGHT = 'CANNOLIGHT'//炮台聚能
CANNOLIGHT = 'CANNOLIGHT',//炮台聚能
GRASS = 'GRASS',
}
\ 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