Commit 5664963a authored by wjf's avatar wjf

l

parent 75755348
......@@ -53,6 +53,13 @@ export class GameGuide extends egret.DisplayObjectContainer {
show() {
var step = this.stepAll - this.stepCount;
this.drawBg(step);
//修改元素的层级,置顶,否则可能点击其他元素
var data = chapterFuns[this.thisObj.chapter];
for (var i = 0; i < data.showIndexs[step].length; i++) {
var index = data.showIndexs[step][i];
var lat = this.thisObj.lattices[index]
if (lat && lat.element) this.thisObj.elementContainer.addChild(lat.element);
}
var handIndexs = chapterFuns[this.thisObj.chapter].handIndexs[step];
this.handAni(handIndexs);
......@@ -62,9 +69,9 @@ export class GameGuide extends egret.DisplayObjectContainer {
var p2 = Tool.getPositionByIndex(handIndexs[1]);
this.msg.y = Math.max(p1[1], p2[1]) + 135;
//定制修改,魔力鸟第九关第一步时
if (this.thisObj.chapter == 9 && step == 0) {
this.msg.y += 80;
}
// if (this.thisObj.chapter == 9 && step == 0) {
// this.msg.y += 80;
// }
this.stepCount--;
}
......@@ -200,9 +207,11 @@ const chapterFuns = {
[20, 29, 38, 30]
],
hideIndexs: [
[2, 11, 19, 18],
[20, 38],
],
handIndexs: [
[21, 20],
[30, 29]
],
msg: [
......
......@@ -45,8 +45,6 @@ import { playGameBg, toggleGameBg } from '../soundCtrl2';
import { createData } from '../startScene/StartScene';
import { DataManager } from './../../libs/tw/manager/DataManager';
import { NetManager } from './../../libs/tw/manager/NetManager';
import { Buried } from './../../libs/tw/util/Buried';
import { GuideMsg } from '../something/uis/GuideMsg';
import { readCache, getCacheKey } from '../mapScene/GuideCon';
import { PropGuideInt } from './PropGuide';
import { StepAni } from '../something/anis/StepAni';
......@@ -62,6 +60,7 @@ import { getChapterData } from '../something/chapters/getChapter';
import { GenerateLatData } from '../something/interface/GenerateLatData';
import { StateType } from '../something/enum/StateType';
import { HairballState } from '../something/states/HairballState';
import { HairballDisAni } from '../something/anis/HairballDisAni';
const aniClass = {
"BoomAni": BoomAni,
......@@ -76,6 +75,7 @@ const aniClass = {
"StepAni": StepAni,
"JellyDisAni": JellyDisAni,
"EggBrokenAni": EggBrokenAni,
"HairballDisAni": HairballDisAni,
}
export const baseScore = 20;
/**
......@@ -612,14 +612,7 @@ export default class MainScene extends Scene {
if (baseType > 4) continue;
let ele: Element = this.lattices[i].element;
if (baseType != null) {
//重置类型,该有的状态保留还原
var isLock = ele.hasState(StateType.LOCK);
var isBubble = ele.hasState(StateType.BUBBLE);
var isHairball = ele.hasState(StateType.HAIRBALL);
ele.reset(baseType);
ele.setState(StateType.LOCK, isLock);
ele.setState(StateType.BUBBLE, isBubble);
ele.setState(StateType.HAIRBALL, isHairball);
ele.resetType(baseType);
}
//特效类型,有气炮的不能加特效
if (!ele.hasState(StateType.BUBBLE)) ele.effectType = arr[0] ? arr[0] - 1 : null;
......@@ -1274,7 +1267,8 @@ export default class MainScene extends Scene {
}
let count = 0;
let countAll = anis.length;
for (let i = 0; i < anis.length; i++) {
//先用后序的吧
for (let i = anis.length - 1; i >= 0; i--) {
let ani: FallAniData = anis[i];
let ele: Element = ani.ele;
let wait: number = ani.wait || 0;
......@@ -1941,6 +1935,8 @@ export default class MainScene extends Scene {
if (hairballState.levelNum == 2) {
hairballState.isActive = true;
} else {
//播放毛球消失动画
this.playAni(RecoverName.HAIRBALLDIS_ANI, p)
//设为无毛球
ele.setState(StateType.HAIRBALL, false)
//算个数
......@@ -1955,8 +1951,10 @@ export default class MainScene extends Scene {
if (ele.temEffectType != null) {
ele.effectType = ele.temEffectType;
ele.temEffectType = null;
//有气泡的需要去掉状态
ele.setState(StateType.BUBBLE, false)
//有气泡的需要去掉状态,
if (ele.hasState(StateType.BUBBLE)) {
ele.setState(StateType.BUBBLE, false)
}
//但是算个数,
this.goElementTarget(ele);
//附近依旧有影响
......
......@@ -719,6 +719,8 @@ export class Tool {
var arr: GenerateLatData[][] = [];
for (var i = 0; i < generateLats.length; i++) {
var generateLat: GenerateLatData = generateLats[i];
//防止为空
generateLat.cus = generateLat.cus || [];
var index = generateLat.index;
if (!lattices[index]) continue
lattices[index].isGenerate = true;
......@@ -726,7 +728,11 @@ export class Tool {
//确实属于哪一列
var col = rc[1];
if (!arr[col]) arr[col] = [];
arr[col].push(generateLat);
arr[col].push({
index: generateLat.index,
type: generateLat.type,
cus: generateLat.cus.slice(),//防止数据被修改
});
}
return arr
// var indexs = [];
......
import { Ani } from "../class/Ani";
import { ImageAni } from "../class/ImageAni";
/**
* 待写
* 毛球消失动效
*/
export class HairballDisAni extends Ani {
/**
* 图片
*/
showImage: ImageAni;
constructor() {
super();
this.aniName = "HairballDisAni";
var arr = []
for (var i = 1; i <= 19; i++) {
arr.push("eleDis" + i + "_png");
}
this.showImage = new ImageAni(arr);
this.addChild(this.showImage)
}
play() {
//重置图片
this.showImage.currentFrame = 0;
this.showImage.source = this.showImage.sourceAll[0];
this.showImage.play(() => {
this.recover();
})
}
}
\ No newline at end of file
......@@ -373,7 +373,7 @@ export const Chapters1: ChapterData[] = [
elements: [
{
type: ElementType.ICE,
count: 17
count: 24
},
]
},
......@@ -610,18 +610,19 @@ export const Chapters1: ChapterData[] = [
0, 20, 0, 10, 10, 20, 20, 10, 10,
],
generateLats: [
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 7, type: [0], cus: [] },
{ index: 8, type: [0], cus: [] },
{ index: 48, type: [0], cus: [] },
{ index: 49, type: [0], cus: [] },
{ index: 50, type: [0], cus: [] },
{ index: 51, type: [0], cus: [] },
{ index: 52, type: [0], cus: [] },
{ index: 53, type: [0], cus: [] },
{ index: 39, type: [0], cus: [] },
{ index: 40, type: [0], cus: [] },
{ index: 41, type: [0], cus: [] },
{ index: 42, type: [0], cus: [] },
{ index: 43, type: [0], cus: [] },
{ index: 44, type: [0], cus: [] },
],
connectedLats: [[3, 21], [4, 22], [5, 23], [6, 24], [7, 25]]
},
},
//11
......@@ -716,7 +717,7 @@ export const Chapters1: ChapterData[] = [
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,
0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
elements: [
......@@ -727,7 +728,7 @@ export const Chapters1: ChapterData[] = [
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,
0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
baseElements: [
......@@ -884,4 +885,120 @@ export const Chapters1: ChapterData[] = [
],
},
},
//15
{
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0,
stepCount: 28,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 18
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 3, 3, 3, 1, 3, 3, 3, 0,
0, 3, 3, 3, 1, 3, 3, 3, 0,
0, 3, 3, 3, 1, 3, 3, 3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 2, 1, 1, 1, 0,
0, 1, 1, 1, 2, 1, 1, 1, 0,
0, 1, 1, 1, 2, 1, 1, 1, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 10, 20, 10, 2, 20, 10, 20, 0,
0, 20, 10, 20, 2, 10, 20, 10, 0,
0, 10, 20, 10, 2, 20, 10, 20, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
generateLats: [
{ index: 10, type: [0], cus: [] },
{ index: 11, type: [0], cus: [] },
{ index: 12, type: [0], cus: [] },
{ index: 13, type: [0], cus: [] },
{ index: 14, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
{ index: 16, type: [0], cus: [] },
],
},
},
//aaaaa
{
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0,
stepCount: 27,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 27
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
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,
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,
],
elements: [
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
],
baseElements: [
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 0, 12, 0, 0, 0, 0,
0, 0, 0, 12, 20, 12, 0, 0, 0,
],
generateLats: [
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
],
},
}
]
\ No newline at end of file
......@@ -8,6 +8,7 @@ import { Pool } from "../Pool";
export class Ani extends egret.DisplayObjectContainer {
/**
* 动效名字,也是实例名称,子类继承重写
* 和回收名字一致
*/
aniName: string;
constructor() {
......
......@@ -11,6 +11,7 @@ import { State } from "./State";
import { StateType } from "../enum/StateType";
import { LockState } from "../states/LockState";
import { HairballState } from "../states/HairballState";
import { BubbleState } from "../states/BubbleState";
/**
......@@ -28,7 +29,7 @@ export class Element extends eui.Component {
/**
* 显示的图片,直接改source,"ele"+type
*/
showImage: eui.Image;
private showImage: eui.Image;
temEffectType: EffectType = null;
/**
......@@ -217,6 +218,45 @@ export class Element extends eui.Component {
}
}
/**
* 只修改类型,不改变其他状态
*/
resetType(type: ElementType) {
//如果重置成特殊元素,或鸡蛋,或石头,或果冻,或棒棒糖,直接用reset方法
if (type == ElementType.CHICKEN_EGG ||
type == ElementType.ROCK ||
type == ElementType.JELLY ||
type == ElementType.LOLLIPOP) {
this.reset(type)
} else {
this._type = type;
//无特效,直接修改
if (this._effectType == null) {
this.changeSource("ele" + type + "_png");
}
//有特效 且不是魔力鸟的
else if (this._effectType != EffectType.MAGICLION) {
switch (this._effectType) {
case EffectType.HORIZONTAL:
case EffectType.VERTICAL:
this.changeSource("ele" + this.type + "Line" + "_png");
break;
case EffectType.EXPLOSIVE:
this.changeSource("ele" + this.type + "Exp" + "_png");
break
}
}
//如果有气泡状态,气泡也要变成相应的
if (this.hasState(StateType.BUBBLE)) {
this.getState(StateType.BUBBLE).reset(type);
//一样要隐藏showImage
this.showImage.alpha = 0;
}
}
}
private removeEffectHas() {
//回收掉原先有的
switch (this._effectType) {
......@@ -272,6 +312,8 @@ export class Element extends eui.Component {
this.states[state].recover();
//置空
this.states[state] = null;
//如果状态是气泡,并且特效不是魔力鸟时,显示showImage,魔力鸟显示原图
if (state == StateType.BUBBLE && this.effectType != EffectType.MAGICLION) this.showImage.alpha = 1;
}
//原先每状态不管
else {
......@@ -296,7 +338,14 @@ export class Element extends eui.Component {
this.states[state] = lockState;
break;
case StateType.BUBBLE:
let bubbleState = Pool.takeOut(RecoverName.BUBBLE_STATE);
if (!bubbleState) {
bubbleState = new BubbleState(data);
} else {
bubbleState.reset(data)
}
this.states[state] = bubbleState;
this.showImage.alpha = 0;
break;
case StateType.HAIRBALL:
let hairBallState = Pool.takeOut(RecoverName.HAIRBALL_STATE);
......
......@@ -84,7 +84,7 @@ export class ImageAni extends eui.Image {
}
/**
* 啥特效就是啥
* 重置开始帧,不播放,好像基本用不到
*/
reset() {
this.isPlay = false;
......
......@@ -12,14 +12,14 @@ export enum RecoverName {
SCORE_ANI = "ScoreAni",
//带回调的动画
//带回调的动画,和不带的合并不了,因为可能还有其他参数
BONUSSHOOT_ANI = "BonusShootAni",
JELLYSPREAD_ANI = "JellySpreadAni",
PIECETOEGG_ANI = "PieceToEggAni",
//元素身上
//元素身上,特效常驻动效
MAGICLIONBG_ANI = "MagicLionBgAni",
HORIZONTALBG_ANI = "HorizontalBgAni",
VERTICALBG_ANI = "VerticalBgAni",
......@@ -28,7 +28,7 @@ export enum RecoverName {
//元素身上的鸡蛋
CHICKEN_EGG = "ChickenEgg",
//所有继承ani的,能单独播放的
//所有继承ani的,能单独播放的,不带回调的
ROCK_ANI = "RockAni",
ICE_ANI = "IceAni",
BOOM_ANI = "BoomAni",
......@@ -41,12 +41,13 @@ export enum RecoverName {
STEP_ANI = "StepAni",
JELLYDIS_ANI = "JellyDisAni",
EGGBROKEN_ANI = "EggBrokenAni",
HAIRBALLDIS_ANI = "HairballDisAni",
//方形遮罩
RECT_MASK = "RectMask",
//状态的回收
LOCK_STATE ="LockState",
BUBBLE_STATE="BubbleState",
HAIRBALL_STATE="HairballState",
LOCK_STATE = "LockState",
BUBBLE_STATE = "BubbleState",
HAIRBALL_STATE = "HairballState",
}
\ No newline at end of file
import { State } from "../class/State";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { ElementType } from "../enum/ElementType";
import { ImageAni } from "../class/ImageAni";
//5种类型对应5种颜色
//位置信息暂时都统一,因为现在所有基础5种元素的长宽都是90,如果以后基础元素图修改
const baseEleWidth = 90;
const baseEleHeight = 90;
//动画时间
const time = 300;
/**
* 变色气泡状态
*/
export class BubbleState extends State {
/**
*
*/
private eleImage: egret.Bitmap;
private eleImageOther: egret.Bitmap;
/**
* 气泡动画
* 不用回收,整个用
*/
private bubbleAni: ImageAni;
/**
* 基础类型
*/
private type: ElementType
constructor(type: ElementType) {
super();
this.type = type
this.eleImage = new egret.Bitmap();
this.eleImage.x = -baseEleWidth / 2;
this.eleImage.y = -baseEleHeight / 2;
this.eleImage.texture = RES.getRes("bubleEle" + type + "_png");
this.addChild(this.eleImage);
this.eleImageOther = new egret.Bitmap();
this.eleImageOther.x = -baseEleWidth / 2;
this.eleImageOther.y = -baseEleHeight / 2;
this.eleImageOther.visible = false;
this.addChild(this.eleImageOther);
//气泡动画,图片再放
this.bubbleAni = new ImageAni([]);
this.bubbleAni.visible = false
this.addChild(this.bubbleAni);
}
/**
* 先隐藏自己的Ele,通过这里的过度动画后再显示,
* 回调里 执行,重置元素基础类型,都执行完的回调
* @param fromType
* @param targetType
* @param callback
*/
play(targetType: ElementType, callback: Function) {
this.eleImageOther.texture = RES.getRes("bubleEle" + targetType + "_png");
this.eleImageOther.visible = true;
this.eleImageOther.alpha = 0;
egret.Tween.get(this.eleImageOther)
.to({ alpha: 1 }, time)
.call(() => {
this.eleImageOther.visible = false;
callback()
})
egret.Tween.get(this.eleImage)
.to({ alpha: 0 }, time)
//显示动画
this.bubbleAni.visible = true;
this.bubbleAni.play(() => {
//隐藏动画
this.bubbleAni.visible = false;
})
}
//重置为指定的类型,直接设置。没有过度动效
reset(type: ElementType) {
this.type = type;
this.eleImage.alpha = 1;
this.eleImage.texture = RES.getRes("bubleEle" + type + "_png");
}
//直接回收
recover() {
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.HAIRBALL_STATE, this);
}
}
\ No newline at end of file
......@@ -45,12 +45,8 @@ export class HairballState extends State {
this.isActive = false;
}
recover() {
//动画是添加进这里的
//回收消失动效
setTimeout(() => {
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.HAIRBALL_STATE, this);
})
if (this.parent) this.parent.removeChild(this);
Pool.recover(RecoverName.HAIRBALL_STATE, this);
}
private changeSource(source: string) {
......
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