Commit 37e9d57a authored by zjz1994's avatar zjz1994

新增猩猩元素暂存

parent 994e22eb
......@@ -311,6 +311,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele36_png");
RES.getResAsync("ele38_png");
RES.getResAsync("ele39_png");
RES.getResAsync("ele40_png");
for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png")
}
......
......@@ -239,6 +239,10 @@
{
"keys": "help_blood_1_btn_png,help_blood_1_text_png,help_blood_fail_btn_png,help_blood_fail_text_png,help_blood_fail_text2_png,help_blood_fail_text3_png,help_blood_fail_text4_png,help_blood_success_text_png,help_blood_success_text2_png,help_card_bg_png,help_card_prize_png,help_closebtn1_png,help_invite2_btn_png,help_invite2_btn2_png,help_invite2_text_png,help_invite2_text2_png,help_invite2_text3_png,help_invite2_text4_png,help_invite_bg_png,help_invite_btn1_png,help_invite_fail_btn_png,help_invite_fail_text1_png,help_invite_fail_text2_png,help_invite_fail_text3_png,help_invite_fail_text4_png,help_invite_success_btn_png,help_invite_success_txt_png,help_invite_text_png,help_light_png",
"name": "helpGroup"
},
{
"name": "preload",
"keys": "ele40_png"
}
],
"resources": [
......@@ -5367,6 +5371,11 @@
"url": "assets/common/commom_share1.png",
"type": "image",
"name": "commom_share1_png"
},
{
"name": "ele40_png",
"type": "image",
"url": "assets/mainScene/ele40.png"
}
]
}
\ No newline at end of file
......@@ -802,7 +802,6 @@ export default class MainScene extends Scene {
arrow.y = p[1];
});
}
}
//初始化地图格子数据,包括生成口,联通口
......@@ -899,6 +898,9 @@ export default class MainScene extends Scene {
this.cannoArr = new Array();
//没有就根据地图格子随机元素
var elements = this.chapterData.map.elements || Tool.setNumber01(this.chapterData.map.lattices.slice());
//猩猩初始时加入
var pongoArr:Array<{tl:number,tr:number,bl:number,br:number}> = new Array();
for(var i = 0; i < elements.length; i++) {
//如果对应格子为空,直接跳过,
if(!this.lattices[i]) continue;
......@@ -1051,6 +1053,22 @@ export default class MainScene extends Scene {
this.elementContainer.addChild(canno_block);
this.lattices[i].element = canno_block;
break;
case ElementConfigType.Pongo:
let inpart = this.checkEleInAcreatePongo(i,pongoArr);
if(inpart=="tl"){//创建新猩猩
var onepongodata = this.createOnePongoByTl(i);
pongoArr.push(onepongodata);
}else{
console.log("是已经创建的猩猩的一部分")
}
//猩猩每部分默认被锁住
let pongo:Element = Tool.getElement(ElementType.Pongo);
pongo.x = p[0];
pongo.y = p[1];
this.elementContainer.addChild(pongo);
pongo.setPongoPart(inpart);
this.lattices[i].element = pongo;
break;
default:
//其他标识按空元素记
this.emptys.push(i);
......@@ -1382,6 +1400,7 @@ export default class MainScene extends Scene {
// ele.type != ElementType.ROCK &&
ele.type != ElementType.CANNO &&
ele.type != ElementType.CANNO_BLOCK &&
ele.type != ElementType.Pongo &&
!ele.hasState(StateType.BLOCK_LOCK) && //石门无法消除
ele.type != ElementType.LOLLIPOP) {
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, fun, this);
......@@ -3219,6 +3238,10 @@ export default class MainScene extends Scene {
else if (ele.type == ElementType.CANNO_BLOCK){
this.removeCannoBlock(index);
}
//猩猩
else if(ele.type == ElementType.Pongo){
console.log("消除猩猩");
}
}
}
//从消除列表移除
......@@ -4239,4 +4262,54 @@ export default class MainScene extends Scene {
}
return addver;
}
//新增大猩猩,猩猩有4部分组成
/**
* 判断当前idx是否是已经创建的大猩猩的一部分
* @param idx
* @param arr
*/
checkEleInAcreatePongo(idx:number,arr:Array<{tl:number,tr:number,bl:number,br:number}>){
var inacreate:boolean = false;
var kpart:string = "tl";
for(var i=0;i<arr.length;i++){
var ipongo = arr[i];
for(var k in ipongo){
var kpar = ipongo[k];
if(kpar==idx){
kpart = k;
inacreate = true;
break;
}
}
}
return kpart;
}
/**
* 创建一个大猩猩
* @param idx
*/
createOnePongoByTl(idx:number){
var tlpongorc = Tool.indexToRc(idx);
var tlpongorow = tlpongorc[0];
var tlpongocol = tlpongorc[1];
var trpongorow = tlpongorow;
var trpongocol = tlpongocol+1;
var blpongorow = tlpongorow+1;
var blpongocol = tlpongocol;
var brpongorow = blpongorow;
var brpongocol = blpongocol+1;
var pongodata = {
tl:idx,
tr:Tool.rcToIndex(trpongorow,trpongocol),
bl:Tool.rcToIndex(blpongorow,blpongocol),
br:Tool.rcToIndex(brpongorow,brpongocol)
}
return pongodata;
}
}
\ No newline at end of file
......@@ -302,7 +302,8 @@ export class Tool {
lat.element.type == ElementType.FESTIVALELE_BIG ||
// lat.element.type == ElementType.FESTIVALELE_SMALL
lat.element.type == ElementType.CANNO ||
lat.element.type == ElementType.CANNO_BLOCK
lat.element.type == ElementType.CANNO_BLOCK ||
lat.element.type == ElementType.Pongo
) {
return false
}
......@@ -366,7 +367,8 @@ export class Tool {
lat.element.type == ElementType.JELLY_MONSTER ||
lat.element.type == ElementType.FIREWORKS_SHOOTER ||
lat.element.type == ElementType.CANNO ||
lat.element.type == ElementType.CANNO_BLOCK
lat.element.type == ElementType.CANNO_BLOCK ||
lat.element.type == ElementType.Pongo
) {
return false
}
......@@ -467,7 +469,8 @@ export class Tool {
ele.type == ElementType.FESTIVALELE_BIG ||
ele.type == ElementType.FESTIVALELE_SMALL ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
ele.type == ElementType.CANNO_BLOCK ||
ele.type == ElementType.Pongo
) {
return false;
}
......@@ -495,7 +498,8 @@ export class Tool {
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN) ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
ele.type == ElementType.CANNO_BLOCK ||
ele.type == ElementType.Pongo
) {
return false;
}
......@@ -517,7 +521,8 @@ export class Tool {
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN) ||
ele.type == ElementType.CANNO ||
ele.type == ElementType.CANNO_BLOCK
ele.type == ElementType.CANNO_BLOCK ||
ele.type == ElementType.Pongo
) {
return false;
}
......
import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//576-600
export const Chapters23: ChapterData[] = [
//测试576
{
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, 23, 23, 1, 1, 1, 1,
0, 1, 1, 23, 23, 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, 0, 0, 20, 20, 10, 20,
0, 20, 10, 0, 0, 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]
},
},
//576
{ baseElementTypes: [ 0, 1, 2, 3, 4 ], bubbleProbability: 0, stepCount: 29, passTarget: { type: 1, elements: [ { type: 34, count: 25 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 3, 3 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], elements: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, 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, 14, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 18, 18, 18, 18, 18, 1, 2 ], 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: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 10, type: null }, { index: 30, type: null }, { index: 32, type: null } ] } },
//577
......
......@@ -71,7 +71,9 @@ chapters.forEach((chapter,index) => {
*/
export function getChapterData(index: number): ChapterData {
//没有数据就返回第一关数据
return chapters[index] || chapters[551];
//todo
return chapters[576];
return chapters[index] || chapters[576];
}
var a = {
......
......@@ -216,6 +216,43 @@ export class Element extends eui.Component {
var roanum = Tool.getCannoRoaByDir(cannodir);
this.cannobox.rotation = roanum;
}
//猩猩的哪个部分
inPongoPart:string;
/**
* 设置为猩猩的一部分
* @param part
*/
setPongoPart(part:string){
this.inPongoPart = part;
console.log("我是猩猩的"+part);
if(part=="tl"){
var source = "ele40_png";
var texture: egret.Texture = RES.getRes(source);
if (!texture) { return console.error("未找到纹理",source,this.type); }
this.showImage.texture = texture
this.showImage.x = -texture.textureWidth/4;
this.showImage.y = -texture.textureHeight/4;
}
var state = StateType.PongoLockState;
if(this.hasState(state)){
this.states[state].reset(part);
}
else{
var stateData = stateDatas[state];
var recoverName:RecoverName = stateData.recoverName;
var className = stateData.className;
let stateEx = Pool.takeOut(recoverName);
if(!stateEx){
stateEx = new className();
}
this.states[state] = stateEx;
stateEx.reset(part);
//视图添加
this.addChild(this.states[state]);
}
}
changeShowCannoStat(){
this.cannolab.text = this._cannoStat+"";
// this.changeMvPlay(this._cannoStat);
......@@ -466,7 +503,12 @@ export class Element extends eui.Component {
this._type = type;
this.showImage = new eui.Image();
if(type==ElementType.Pongo){//猩猩不设默认图
}else{
this.changeSource("ele" + this.type + "_png");
}
this.addChild(this.showImage);
this.cannobox = new eui.Group();
......
......@@ -74,5 +74,5 @@ export enum ElementConfigType {
CANNO_DIR_RIGHT = 21,
/** 大炮石头 */
CANNO_BLOCK = 22,
xingxing = 23,
Pongo = 23,
}
\ No newline at end of file
......@@ -60,6 +60,7 @@ export enum ElementType {
FLOWER,//37
CANNO,//38
CANNO_BLOCK,//39
Pongo,//40
}
export const isMonsterEle = (t: ElementType) => {
......
......@@ -74,6 +74,7 @@ export enum RecoverName {
HAIRBALLGREY_STATE = "HairballGreyState",
HAIRBALLBLACK_STATE = "HairballBlackState",
HAIRBALLBROWN_STATE = "HairballBrownState",
PongoLock_State = "PongoLock_State",
BLOCK_STATE = "BLOCK_STATE",
......
......@@ -6,6 +6,7 @@ import { HairballBrownState } from "../states/HairballBrownState";
import { HairballBlackState } from "../states/HairballBlackState";
import { BlockLockState } from "../states/BlockLockState";
import { HoneyState } from "../states/HoneyState";
import { PongoLockState } from "../states/PongoLockState";
/**
* 状态类型
......@@ -18,6 +19,7 @@ export enum StateType {
HAIRBALLBLACK,//黑色毛球 ,两次消除,一次闭眼
BLOCK_LOCK,//石门盖住状态
HONEY,//蜂蜜
PongoLockState,//猩猩部位被封住
}
......@@ -30,4 +32,5 @@ export const stateDatas: { recoverName: RecoverName, className: any }[] = [
{ recoverName: RecoverName.HAIRBALLBLACK_STATE, className: HairballBlackState },
{ recoverName: RecoverName.BLOCK_STATE, className: BlockLockState },
{ recoverName: RecoverName.HONEY_STATE, className: HoneyState },
{ recoverName: RecoverName.PongoLock_State, className: PongoLockState },
]
\ No newline at end of file
import { State } from "../class/State";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
export class PongoLockState extends State{
private showImage:egret.Bitmap;
constructor() {
super();
this.showImage = new egret.Bitmap();
this.addChild(this.showImage);
}
/**
* 需要根据猩猩部分来区分显示
* @param inPongoPart
*/
reset(inPongoPart:string) {
console.log("设置状态--猩猩的部位",inPongoPart);
var texture: egret.Texture = RES.getRes("lockVine_png");
if(this.showImage&&this.showImage.parent){
}else{
this.showImage = new egret.Bitmap();
this.addChild(this.showImage);
}
this.showImage.texture = texture;
this.showImage.x = -texture.textureWidth / 2;
this.showImage.y = -texture.textureHeight / 2
}
recover() {
egret.Tween.get(this)
.to({ alpha: 0 }, 750)
.call(() => {
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.PongoLock_State, this);
})
}
}
\ 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