Commit c8de83bc authored by wildfirecode's avatar wildfirecode

Merge branch 'dev' of gitlab2.dui88.com:wanghongyuan/xiaoxiaole into dev

parents e0ec061f d9e23f9b
...@@ -292,6 +292,7 @@ export default class MainBase extends eui.UILayer { ...@@ -292,6 +292,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("lineLight" + i + "_png") RES.getResAsync("lineLight" + i + "_png")
} }
var arr = [ var arr = [
"rectLatWhite",
"fesRedBigLight", "fesRedBombSta1", "fesRedCap", "fesRedDown", "fesRedSmallLight", "fesRedUp", "xingxingbi", "fesRedBigLight", "fesRedBombSta1", "fesRedCap", "fesRedDown", "fesRedSmallLight", "fesRedUp", "xingxingbi",
"tinyRedLeft", "tinyRedMid", "tinyRedRight", "tinyRedLeft", "tinyRedMid", "tinyRedRight",
"festivalTargetBg", "festivalTargetBg",
......
...@@ -700,8 +700,8 @@ export default class MainScene extends Scene { ...@@ -700,8 +700,8 @@ export default class MainScene extends Scene {
//初始化节日元素 //初始化节日元素
initFestivalEle(): boolean { initFestivalEle(): boolean {
//添加节日元素,条件可能会变 //添加节日元素,条件可能会变
if (getRedBombTimes() && if (fesChapterData.indexOf(this.chapter >> 0) > -1 &&
fesChapterData.indexOf(this.chapter >> 0) > -1 && getRedBombTimes() &&
Math.random() > 0.5 && Math.random() > 0.5 &&
this.lattices[festivalIndex] && //格子必须有 this.lattices[festivalIndex] && //格子必须有
(Tool.judgeSetFesEle(this.lattices[festivalIndex]) || !this.lattices[festivalIndex].element) //没有元素也行 (Tool.judgeSetFesEle(this.lattices[festivalIndex]) || !this.lattices[festivalIndex].element) //没有元素也行
...@@ -2798,7 +2798,7 @@ export default class MainScene extends Scene { ...@@ -2798,7 +2798,7 @@ export default class MainScene extends Scene {
} }
//时间再调 //时间再调
// setTimeout(() => { // setTimeout(() => {
callback(); callback();
// }, 80) // }, 80)
} }
/** /**
......
...@@ -269,13 +269,13 @@ export class Tool { ...@@ -269,13 +269,13 @@ export class Tool {
if (!lat || !lat.element) { if (!lat || !lat.element) {
return false return false
} }
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋,或者大节日元素 //上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋,或者大节日元素
else if (lat.element.type == ElementType.ROCK || else if (lat.element.type == ElementType.ROCK ||
lat.element.hasState(StateType.LOCK) || lat.element.hasState(StateType.LOCK) ||
lat.element.type == ElementType.JELLY || lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.CHICKEN_EGG || lat.element.type == ElementType.CHICKEN_EGG ||
lat.element.type == ElementType.FESTIVALELE_BIG || lat.element.type == ElementType.FESTIVALELE_BIG //||
lat.element.type == ElementType.FESTIVALELE_SMALL // lat.element.type == ElementType.FESTIVALELE_SMALL
) { ) {
return false 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