Commit 5d968947 authored by wjf's avatar wjf

l

parent 23c57f37
......@@ -105,10 +105,10 @@ export class Element extends eui.Component {
// console.log(this)
}
}
magicLionBgAni: MagicLionBgAni;
horizontalBgAni: HorizontalBgAni;
verticalBgAni: VerticalBgAni;
explosiveBgAni: ExplosiveBgAni;
private magicLionBgAni: MagicLionBgAni;
private horizontalBgAni: HorizontalBgAni;
private verticalBgAni: VerticalBgAni;
private explosiveBgAni: ExplosiveBgAni;
/**
* 索引
*/
......@@ -166,8 +166,10 @@ export class Element extends eui.Component {
this.showImage.x = -texture.textureWidth / 2;
this.showImage.y = -texture.textureHeight / 2;
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage,还有鸡蛋
if (source == "magicLion_png" || source == "ele" + ElementType.CHICKEN_EGG + "_png") {
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage,还有鸡蛋,还有特殊节日元素大
if (source == "magicLion_png" ||
source == "ele" + ElementType.CHICKEN_EGG + "_png" ||
source == "ele" + ElementType.FESTIVALELE_BIG + "_png") {
this.showImage.alpha = 0;
} else {
this.showImage.alpha = 1;
......
import { ElementType } from "../enum/ElementType";
//三种状态的图片,剩三种了
const images = {
2: "ele" + ElementType.CHICKEN_EGG + "_png",
1: "eggStatus1_png",
0: "eggStatus0_png"
}
/**
* 节日元素
*
*/
export class FestivalEle extends eui.Component {
private showImage: eui.Image;
/**
* 是否要分裂了
*/
isActive: boolean;
/**
* 状态变化 2 1 0 再往后,可分裂
*/
private _statusNum: number;
get statusNum() {
return this._statusNum
}
set statusNum(value: number) {
if (value >= 0) {
this._statusNum = value;
//修改图片
if (this.showImage.source != images[this._statusNum]) {
this.changeSource(images[this._statusNum]);
}
} else {
this._statusNum = 0;
this.isActive = true;
}
}
constructor(n: number = 2) {
super()
this.showImage = new eui.Image();
this.addChild(this.showImage)
this.changeSource(images[n]);
this.isActive = false;
this._statusNum = n;
}
changeSource(source: string) {
var texture: egret.Texture = RES.getRes(source);
this.showImage.texture = texture
this.showImage.anchorOffsetX = texture.textureWidth / 2;
this.showImage.anchorOffsetY = texture.textureHeight / 2 + 20;
this.showImage.y = 20
}
shakeAni() {
this.showImage.rotation = 0;
egret.Tween.get(this.showImage)
.to({ rotation: 10 }, 80)
.to({ rotation: -8 }, 160)
.to({ rotation: 5 }, 160)
.to({ rotation: 0 }, 50)
}
reset(n: number = 2) {
this.changeSource(images[n]);
this.isActive = false;
this._statusNum = n;
}
}
\ No newline at end of file
/**
* 元素类型 <=4就是基础元素
* 枚举尽量从后面添加,否则要改很多东西,submitTran重新对应,ele图片重新对应,开始弹框目标实现等等,没改全后果自负
* 修改索引时,需要修改ele的图片,和通关目标类。飞入特效类
* 讲道理应该只有基础类型和特殊类型,但是为了通关目标也放入了冰块,元素身上的状态,
*/
export enum ElementType {
//基础5种元素
......@@ -25,10 +25,16 @@ export enum ElementType {
HAIRBALLGREY,//灰色毛球10
HAIRBALLBROWN,//褐色毛球11
HAIRBALLBLACK,//黑色毛球12
//特殊元素 ,节日元素
FESTIVALELE_BIG, //节日元素大中间一个13
FESTIVALELE_SMALL //节日元素飞溅的小元素14
}
/**
* 5种基本元素的数组,每项是ElementType的枚举值
* 判断某类型是否是基础类型用FiveBaseElementTypes.indexOf(baseType) > -1
*/
export const FiveBaseElementTypes: ElementType[] = [
ElementType.RABBIT,
......
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