Commit 74a28db1 authored by wjf's avatar wjf

l

parent 7ed69a67
This diff is collapsed.
......@@ -14,9 +14,16 @@ import { StateType } from "./enum/StateType";
export class Tool {
/**
* 每格掉落时间
* 掉落速度这个定
*/
public static latDeltaTime:number = 90;
/**
* 总行数
*/
public static latDeltaTime = 90;
public static rowNum = 9;
/**
* 总列数
*/
public static colNum = 9;
/**
* 格子宽度
......
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
import { EffectType } from "../enum/EffectType";
import { Element } from "../class/Element";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
/**
* 元素向下的动画
* 没有遮罩
* @param eleC
* @param p
* @param con
* @param callback
*/
export function EleDownAni(
eleC: Element,
p: number[],
wait: number,
con: egret.DisplayObjectContainer,
isUp: boolean = false,
deltaTime:number,
callback?: Function
) {
let ele = Tool.getElement(eleC.type);
ele.effectType = eleC.effectType;
ele.x = p[0];
ele.y = p[1] - Tool.height * (isUp ? 0 : 1);
egret.Tween.get(ele)
.wait(wait)
.call(()=>{
con.addChild(ele);
})
.to({ x: p[0], y: p[1] + Tool.height * (isUp ? 1 : 0) }, deltaTime)
.call(() => {
//回收元素
con.removeChild(ele);
Pool.recover(RecoverName.ELEMENT, ele);
//回调
callback && callback();
})
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ export function EleMaskAni(
wait: number,
con: egret.DisplayObjectContainer,
isUp: boolean = false,
deltaTime:number,
callback?: Function
) {
let ele = Tool.getElement(eleC.type);
......@@ -37,7 +38,7 @@ export function EleMaskAni(
.call(()=>{
con.addChild(ele);
})
.to({ x: p[0], y: p[1] + Tool.height * (isUp ? 1 : 0) }, Tool.latDeltaTime)
.to({ x: p[0], y: p[1] + Tool.height * (isUp ? 1 : 0) }, deltaTime)
.call(() => {
//回收元素
con.removeChild(ele);
......
import { Ani } from "../class/Ani";
import { ImageAni } from "../class/ImageAni";
import { ElementType } from "../enum/ElementType";
//原点已是中心
export class IceAni extends Ani {
......@@ -10,7 +11,7 @@ export class IceAni extends Ani {
constructor() {
super();
this.aniName = "IceAni";
this.showImage = new ImageAni(["ele7_png", "ice2_png", "ice3_png", "ice4_png", "ice5_png", "ice6_png"]);
this.showImage = new ImageAni(["ele" + ElementType.ICE + "_png", "ice2_png", "ice3_png", "ice4_png", "ice5_png", "ice6_png"]);
this.addChild(this.showImage)
}
......
......@@ -3,6 +3,7 @@ import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { playSound, SoundType } from "../../soundCtrl";
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
const offsetX = 91 / 2;
const offsetY = 62 / 2;
......@@ -20,7 +21,7 @@ export class PieceToEggAni extends egret.DisplayObjectContainer {
eggPiece5: egret.Bitmap;
constructor() {
super()
var arr = ["ele9_png", "eggPiece1_png", "eggPiece2_png", "eggPiece3_png", "eggPiece4_png", "eggPiece5_png"];
var arr = ["ele" + ElementType.CHICKEN_EGG + "_png", "eggPiece1_png", "eggPiece2_png", "eggPiece3_png", "eggPiece4_png", "eggPiece5_png"];
var objs = ["showImage", "eggPiece1", "eggPiece2", "eggPiece3", "eggPiece4", "eggPiece5"];
for (var i = 0; i < arr.length; i++) {
......
import { Ani } from "../class/Ani";
import { ImageAni } from "../class/ImageAni";
import { ElementType } from "../enum/ElementType";
//原点已是中心
export class RockAni extends Ani {
......@@ -10,7 +11,7 @@ export class RockAni extends Ani {
constructor() {
super();
this.aniName = "RockAni";
this.showImage = new ImageAni(["ele5_png", "rock2_png", "rock3_png", "rock4_png", "rock5_png", "rock6_png"]);
this.showImage = new ImageAni(["ele" + ElementType.ROCK + "_png", "rock2_png", "rock3_png", "rock4_png", "rock5_png", "rock6_png"]);
this.addChild(this.showImage)
}
......
import { ElementType } from "../enum/ElementType";
//四种状态的图片
const images = {
3: "ele9_png",
3: "ele"+ElementType.CHICKEN_EGG+"_png",
2: "eggStatus2_png",
1: "eggStatus1_png",
0: "eggStatus0_png"
......
......@@ -161,7 +161,7 @@ export class Element extends eui.Component {
this.showImage.y = -texture.textureHeight / 2;
//特殊逻辑,因为魔力鸟动效要旋转,所以隐藏原图showImage,还有鸡蛋
if (source == "magicLion_png" || source == "ele9_png") {
if (source == "magicLion_png" || source == "ele" + ElementType.CHICKEN_EGG + "_png") {
this.showImage.alpha = 0;
} else {
this.showImage.alpha = 1;
......
......@@ -54,7 +54,8 @@ export const submitTran = {
4: 8,
5: 9,
6: 3,
7: 2,
9: 2,
10: 10
}
// SCORE(1, "分数"),
......@@ -66,3 +67,4 @@ export const submitTran = {
// LION(7, "狮子"),
// PIG(8, "猪"),
// STONE(9, "石头")
// GREYBALL(10, "灰色")
/**
* 掉落元素类型
* 没用了
*/
export enum FallEleType {
RANELE = 0,//随机元素无特效
RANEFF,//随机元素加随机特效
RABBIT,//兔子 下面的顺序和ElementType前5保持一致,不要随便修改
CHICKEN,//鸡
CATTLE,//牛
LION,//狮子
PIG,//猪
}
\ 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