Commit 1ea97d83 authored by wjf's avatar wjf

l

parent b19ea4af
......@@ -292,6 +292,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("lineLight" + i + "_png")
}
var arr = [
"rectLatWhite",
"fesRedBigLight", "fesRedBombSta1", "fesRedCap", "fesRedDown", "fesRedSmallLight", "fesRedUp", "xingxingbi",
"tinyRedLeft", "tinyRedMid", "tinyRedRight",
"festivalTargetBg",
......
......@@ -269,13 +269,13 @@ export class Tool {
if (!lat || !lat.element) {
return false
}
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋,或者大节日元素
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋,或者大节日元素
else if (lat.element.type == ElementType.ROCK ||
lat.element.hasState(StateType.LOCK) ||
lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.CHICKEN_EGG ||
lat.element.type == ElementType.FESTIVALELE_BIG ||
lat.element.type == ElementType.FESTIVALELE_SMALL
lat.element.type == ElementType.FESTIVALELE_BIG //||
// lat.element.type == ElementType.FESTIVALELE_SMALL
) {
return false
}
......
import { Lattice } from "../class/Lattice";
import { Tool } from "../Tool";
const whiteRectPool: WhiteRect[] = []
/**
* 格子波纹的动画
* @param lattices
* @param container
* @param callback
*/
export function RectsWaveAni(
lattices: Lattice[],
container: egret.DisplayObjectContainer,
callback?: Function,
centerIndex: number = 40,
) {
var loops: WhiteRect[][] = [];
var rc = Tool.indexToRc(centerIndex);
//格子间距 0到最大的格子
var num = 0;
var maxNum = Math.max(rc[0], rc[1], Tool.rowNum - rc[0] - 1, Tool.colNum - rc[1] - 1)
//所有格子都填上
while (num < maxNum) {
//每一圈所有格子索引
var indexs: number[] = [];
var rowMax = rc[0] + num;
var rowMin = rc[0] - num;
var colMax = rc[1] + num;
var colMin = rc[1] - num;
num++;
var colIndexs = rangeIndexs(
colMin >= 0 ? colMin : 0,
colMax < Tool.colNum ? colMax : Tool.colNum - 1
)
var rowIndexs = rangeIndexs(
rowMin >= 0 ? rowMin : 0,
rowMax < Tool.rowNum ? rowMax : Tool.rowNum - 1,
false
)
//上排,行数一致,列数在之内
if (rowMin >= 0) {
for (var i = 0; i < colIndexs.length; i++) {
var index = Tool.rcToIndex(rowMin, colIndexs[i]);
if (lattices[index]) indexs.push(index)
}
}
//下排
if (rowMax < Tool.rowNum) {
for (var i = 0; i < colIndexs.length; i++) {
var index = Tool.rcToIndex(rowMax, colIndexs[i]);
if (lattices[index]) indexs.push(index)
}
}
//左边
if (colMin >= 0) {
for (var i = 0; i < rowIndexs.length; i++) {
var index = Tool.rcToIndex(colMin, rowIndexs[i]);
if (lattices[index]) indexs.push(index)
}
}
//右边
if (colMax < Tool.colNum) {
for (var i = 0; i < rowIndexs.length; i++) {
var index = Tool.rcToIndex(colMax, rowIndexs[i]);
if (lattices[index]) indexs.push(index)
}
}
var loop = []
//根据索引
for (var i = 0; i < indexs.length; i++) {
var index = indexs[i];
var p = Tool.getPositionByIndex(index);
let rect = whiteRectPool.shift();
if (!rect) rect = new WhiteRect();
rect.alpha = 0;
rect.x = p[0];
rect.y = p[1];
container.addChild(rect);
loop.push(rect);
}
//总
loops.push(loop);
}
//动画
}
class WhiteRect extends egret.Bitmap {
constructor() {
super();
var texture: egret.Texture = RES.getRes("rectLatWhite_png");
this.texture = texture;
this.x = -texture.textureWidth / 2;
this.y = -texture.textureHeight / 2;
}
}
function rangeIndexs(min: number, max: number, include: boolean = true) {
var nums = [];
if (include) nums.push(min);
var num: number = min;
while (++num < max) nums.push(num);
if (include) nums.push(max);
return nums
}
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