Commit f14b20bc authored by 邱旭's avatar 邱旭

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

parents 70d6d9a1 f8629686
......@@ -119,6 +119,10 @@
{
"key": "data.url",
"value": "common_prop3_png"
},
{
"key": "data.url2",
"value": "common_prop3_png"
}
]
},
......
......@@ -2,7 +2,7 @@ import getShowOffPic from "../../../src/getShowOffPic";
import { iswx } from "../../../src/iswx";
import { getlogItem } from "../../../src/Main";
import { addRankFriendList } from "../../../src/mapScene/RankFriendList";
import setGray from "../../../src/setGray";
import { showShare } from "../../../src/shareCtrl";
import { changeMapScene } from "../../../src/startScene/StartScene";
import wait from "../../new_tc/wait";
......@@ -13,10 +13,8 @@ export default class NoPrizePanel extends Panel {
_level;
start(data) {
super.start();
setGray(this['pica']);
setGray(this['picb']);
setGray(this['picc']);
this._level = parseInt(data.level + '');
this['lvTxt'].text = `关卡${this._level}`
this['shareBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(16));
if (iswx()) {
......@@ -38,8 +36,7 @@ export default class NoPrizePanel extends Panel {
changeMapScene();
}, this);
addRankFriendList(84,735.52,this);
addRankFriendList(84,917.46,this);
}
showlog() {
......@@ -49,10 +46,6 @@ export default class NoPrizePanel extends Panel {
onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
changeMapScene();
// if (this._level + 1 <= 70)
// SceneCtrl.instance.change(ModuleTypes.START_SCENE, { level: this._level + 1 });
// else
// SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn']] }
......@@ -79,7 +72,7 @@ export default class NoPrizePanel extends Panel {
await this.playAni3();
}
if (nums >= 1) {
this['light'].visible = true;
this['light'].visible = false;
egret.Tween.get(this['light']).set({ scaleX: 0, scaleY: 0, alpha: 0, }).to({ scaleX: 1, scaleY: 1, alpha: 1 }, 300).call(() => {
egret.Tween.get(this['light'], { loop: true }).to({ rotation: 360 }, 3000);
});
......@@ -88,7 +81,7 @@ export default class NoPrizePanel extends Panel {
async playAni1() {
return new Promise(r => {
egret.Tween.get(this['pic1']).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 400, egret.Ease.getBackOut(1)).call(r)
egret.Tween.get(this['pic1']).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: -1, scaleY: 1 }, 400, egret.Ease.getBackOut(1)).call(r)
})
}
async playAni2() {
......@@ -98,7 +91,7 @@ export default class NoPrizePanel extends Panel {
}
async playAni3() {
return new Promise(r => {
egret.Tween.get(this['pic3']).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: -1, scaleY: 1 }, 400, egret.Ease.getBackOut(1)).call(r)
egret.Tween.get(this['pic3']).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 400, egret.Ease.getBackOut(1)).call(r)
})
}
destroy() {
......
......@@ -15,8 +15,11 @@ export default class PrizePanel extends Panel {
const { categoryType, img, num, propType,realValue } = option;// 2次数 3道具 4元宝 5实物 6优惠券 7虚拟商品
this['propnums'].text = 'x1';
if(num)
this['propnums2'].text = 'x1';
if(num){
this['propnums'].text = 'x' + num;
this['propnums2'].text = 'x' + num;
}
switch (categoryType) {
case 2:
this['blood'].visible = true;
......@@ -24,13 +27,14 @@ export default class PrizePanel extends Panel {
break;
case 3:
this['numsgroup'].visible = true;
this['img'].visible = true;
this.data.url = `turnprize_icon${propType}_png`;
this['img2'].visible = true;
this.data.url2 = `common_prop${propType}_png`;
break;
case 4:
this['numsgroup'].visible = true;
this['numsgroup'].visible = false;
this['propnums2'].visible = true;
this['money'].visible = true;
this['propnums'].text = 'x' + realValue;
this['propnums2'].text = realValue;
break;
default:
this['img'].visible = true;
......@@ -42,6 +46,7 @@ export default class PrizePanel extends Panel {
start(data) {
super.start();
this._level = parseInt(data.level + '');
this['lvTxt'].text = `关卡${this._level}`
this.updateOption(data.option);
......@@ -66,7 +71,7 @@ export default class PrizePanel extends Panel {
this.setStar(hc_submitData.stars);
addRankFriendList(84,869.74,this);
addRankFriendList(84,889.74,this);
}
showlog() {
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="NoPrizeSkin" width="750" height="1000" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Component y="735.52" skinName="ADSmallSkin" x="84" visible="false"/>
<e:Component y="917.46" skinName="ADSmallSkin" x="84" visible="false"/>
<e:Image id="light" source="common_prizelight_png" x="374.19" y="329.51" anchorOffsetX="375.76" anchorOffsetY="327.27"/>
<e:Image y="109.55" source="擦肩而过弹窗 _png" horizontalCenter="0.5"/>
<e:Button id="closeBtn" label="" x="617" y="279">
<e:Button id="closeBtn" label="" x="609" y="344.28">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
......@@ -11,13 +11,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Image id="picb" source="点亮 副本 2_png" x="142" y="179"/>
<e:Image id="pica" source="点亮 副本 2_png" x="608" y="179" scaleX="-1"/>
<e:Image id="picc" source="点亮_png" y="130" x="280"/>
<e:Image id="pic1" source="点亮 副本 2_png" x="218" y="237" anchorOffsetX="76" anchorOffsetY="58"/>
<e:Image id="pic3" source="点亮 副本 2_png" x="534" y="235" scaleX="-1" anchorOffsetX="74" anchorOffsetY="56"/>
<e:Image id="pic2" source="点亮_png" y="200" horizontalCenter="0" anchorOffsetX="98" anchorOffsetY="70"/>
<e:Button id="shareBtn" label="" y="588" horizontalCenter="-145.5">
<e:Button id="shareBtn" label="" y="766" horizontalCenter="-145.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="按钮 副本 3_png" source.down="按钮 副本 3_png" source.disabled="按钮 副本 3_png"/>
......@@ -25,7 +19,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="goBtn" label="" y="588" horizontalCenter="144">
<e:Button id="goBtn" label="" y="766" horizontalCenter="144">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="按钮 副本 4_png" source.down="按钮 副本 4_png" source.disabled="按钮 副本 4_png"/>
......@@ -33,5 +27,12 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Image id="picb" x="286" y="391.28" source="点亮 副本 2gray_png" scaleX="-1"/>
<e:Image id="pica" x="465.48" y="384.28" source="点亮 副本 2gray_png"/>
<e:Image id="picc" y="367.28" source="点亮gray_png" x="310"/>
<e:Image id="pic1" source="点亮 副本 2_png" x="214.18" y="443.39" anchorOffsetX="81.82" anchorOffsetY="60.61" scaleX="-1"/>
<e:Image id="pic3" source="点亮 副本 2_png" x="528.24" y="446.89" scaleX="1" anchorOffsetX="71.76" anchorOffsetY="66.61"/>
<e:Image id="pic2" source="点亮_png" y="440.01" anchorOffsetX="73.94" anchorOffsetY="74.73" x="375.94"/>
<e:Label id="lvTxt" text="关卡1" y="326" textColor="0xFF841B" horizontalCenter="0.5"/>
<w:Config id="1690063a75e"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PrizeSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="169005181d0"/>
<e:Component y="869.74" skinName="ADSmallSkin" x="84" visible="false"/>
<e:Component y="889.74" skinName="ADSmallSkin" x="84" visible="false"/>
<e:Image id="light" source="common_prizelight_png" x="374.19" y="253.76" anchorOffsetX="375.76" anchorOffsetY="327.27" visible="false"/>
<e:Image source="prizePanelbg_png" y="61.15" scale9Grid="87,543,522,23" height="839" x="28"/>
<e:Image id="img" width="508" height="225" source="{data.url}" horizontalCenter="0" y="515.76"/>
<e:Image id="img" width="508" height="225" source="{data.url}" horizontalCenter="0" y="515.76" visible="false"/>
<e:Image id="img2" horizontalCenter="0" y="515.76" source="{data.url2}" scaleX="0.7" scaleY="0.7" visible="false"/>
<e:Image id="money" y="516.2" scaleX="0.6" scaleY="0.6" source="common_money_png" x="150" visible="false"/>
<e:Image id="blood" y="522.8" horizontalCenter="1" source="common_blood_png" scaleX="0.6" scaleY="0.6" visible="false"/>
<e:Image id="blood" y="518.8" horizontalCenter="1.5" source="common_blood_png" scaleX="0.7" scaleY="0.7" visible="false"/>
<e:Group id="numsgroup" x="396.38" y="518.4" visible="false">
<e:Image id="numsbg" source="signprize_numsbg_png" x="0" y="0"/>
<e:Label id="propnums" text="X8" size="22" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" textAlign="center"/>
</e:Group>
<e:Label id="propnums2" text="30" textColor="0x885037" bold="true" y="649.08" width="75" textAlign="right" x="287.16" visible="false"/>
<e:Label id="propnums2" text="30" textColor="0x885037" bold="true" y="651.08" width="75" textAlign="right" x="287.16" visible="false"/>
<e:Button id="closeBtn" label="" x="608" y="287.25">
<e:skinName>
<e:Skin states="up,down,disabled">
......
This diff is collapsed.
......@@ -32,7 +32,7 @@ export function MagicRotateAni(ele: Element, p: number[], con: egret.DisplayObje
//算角度,弧度,x正方向为0,0到2pi,逆时针为正
var vec0 = [1, 0]
var vec1 = [deltaX, deltaY]
var rotation = getRot(vec0, vec1);
var rotation = getRotByTwoVectors(vec0, vec1);
if (deltaY > 0) {
rotation = pi2 - rotation;
}
......@@ -81,7 +81,7 @@ function rotationAcodPoint(p: number[], rotation: number, point: number[] = [0,
* @param vec1
* @param vec2
*/
function getRot(vec1: number[], vec2: number[]) {
export function getRotByTwoVectors(vec1: number[], vec2: number[]) {
var a = Math.sqrt(vec1[0] * vec1[0] + vec1[1] * vec1[1])
var b = Math.sqrt(vec2[0] * vec2[0] + vec2[1] * vec2[1])
var ab = vec1[0] * vec2[0] + vec1[1] * vec2[1]
......
import { ImageAni } from "../class/ImageAni";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { playSound, SoundType } from "../../soundCtrl";
import { Element } from "../class/Element";
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
export const stepPosition: number[] = [125, 115];
/**
* 需要回调的
* 手动修改this.shoot.rotation=
*/
export class FesRedShootAni extends egret.DisplayObjectContainer {
light: LightingAni;
imageAni: ImageAni;
imageAniCon: egret.DisplayObjectContainer
constructor() {
super()
this.light = new LightingAni();
this.addChild(this.light);
var arr = []
for (var i = 1; i <= 10; i++) {
arr.push("fesEleSmallDis" + i + "_png");
}
this.imageAniCon = new egret.DisplayObjectContainer();
this.imageAni = new ImageAni(arr);
this.imageAniCon.addChild(this.imageAni);
this.addChild(this.imageAniCon);
this.imageAni.visible = false
}
reset() {
this.light.visible = true;
this.imageAni.visible = false;
this.light.scaleX = 0.2;
}
play(startP: number[], ele: Element, callback: Function) {
this.reset()
//算角度
var r = Tool.getForwardRotation(startP, [ele.x, ele.y])
this.light.rotation = r * 180 / Math.PI;
this.light.x = startP[0];
this.light.y = startP[1];
this.imageAniCon.x = ele.x;
this.imageAniCon.y = ele.y;
//247
var dis = Math.sqrt(
(startP[0] - ele.x) * (startP[0] - ele.x) +
(startP[1] - ele.y) * (startP[1] - ele.y)
)
var scaleX = dis / 247;
egret.Tween.get(this.light)
.to({ scaleX: scaleX, }, 400)
.call(() => {
ele.reset(ElementType.FESTIVALELE_SMALL);
ele.scaleX = ele.scaleY = 0.1
egret.Tween.get(ele)
.to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut)
//回调
callback();
this.imageAni.visible = true;
this.imageAni.play(() => {
if (this.$parent) {
this.$parent.removeChild(this)
};
Pool.recover(RecoverName.FESREDSHOOT_ANI, this)
})
setTimeout(() => {
this.light.visible = false;
}, 200)
})
}
}
class LightingAni extends egret.Bitmap {
sourceAll: string[];
currentFrame: number;
totalFrames: number;
isPlay: boolean;
startTime: number
/**
* 所有时间,帧数按每秒30
*/
allTime: number
/**
* 播放完的回调
*/
constructor() {
super();
var arr = [];
for (var i = 1; i <= 13; i++) {
arr.push("lineLight" + i + "_png")
}
this.anchorOffsetX = 23;
this.anchorOffsetY = 27;
this.sourceAll = arr;
this.texture = RES.getRes(this.sourceAll[0])
this.currentFrame = 0;
this.totalFrames = arr.length;
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
this.startTime = Date.now()
this.allTime = this.sourceAll.length / 30 * 1000;
}
onEnterFrame() {
if (!this.stage) return
var dataNow = Date.now();
var deltaTime = dataNow - this.startTime;
var scale = deltaTime / this.allTime;
if (scale >= 1) {
this.startTime = Date.now()
this.currentFrame = 0;
} else {
this.currentFrame = (scale * this.sourceAll.length) >> 0;
}
this.texture = RES.getRes(this.sourceAll[this.currentFrame])
}
}
......@@ -494,15 +494,15 @@ export const Chapters6: ChapterData[] = [
starScores: [5000, 12000, 20000],
map: {
lattices: [
3, 3, 3, 0, 0, 0, 3, 3, 3,
3, 3, 3, 0, 0, 0, 3, 3, 3,
3, 3, 0, 0, 0, 0, 0, 3, 3,
0, 0, 0, 3, 3, 3, 0, 0, 0,
3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 0, 3, 3, 3, 3,
3, 3, 3, 0, 3, 0, 3, 3, 3,
0, 3, 0, 3, 3, 3, 0, 3, 0,
0, 3, 3, 3, 3, 3, 3, 3, 0
2, 2, 2, 0, 0, 0, 2, 2, 2,
2, 2, 2, 0, 0, 0, 2, 2, 2,
2, 2, 0, 0, 0, 0, 0, 2, 2,
0, 0, 0, 2, 2, 2, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 0, 2, 2, 2, 2,
2, 2, 2, 0, 2, 0, 2, 2, 2,
0, 2, 0, 2, 2, 2, 0, 2, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0
],
connectedLats: [[73, 0], [74, 1], [75, 2], [77, 6], [78, 7], [79, 8]],
elements: [
......@@ -550,7 +550,7 @@ export const Chapters6: ChapterData[] = [
{
baseElementTypes: [0, 1, 2, 3, 4],
bubbleProbability: 0.1,
stepCount: 30,
stepCount: 40,
passTarget: { type: 1, elements: [{ type: 6, count: 8 }] },
starScores: [5000, 12000, 21000],
map: {
......
......@@ -512,7 +512,7 @@ export const Chapters8: ChapterData[] = [
},
//157
{
baseElementTypes: [0, 1, 2, 3, 4], bubbleProbability: 0, stepCount: 26, passTarget: { type: 1, elements: [{ type: 6, count: 13 }] }, starScores: [5000, 12000, 21000], map: { lattices: [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, 0, 0, 0, 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], connectedLats: [[30, 48], [31, 49], [32, 50], [74, 18], [78, 26]], elements: [1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [75, 76, 77], generateLats: [{ index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 10, type: null }, { index: 16, type: null }, { index: 18, type: null }, { index: 26, type: null }] }
baseElementTypes: [0, 1, 2, 3, 4], bubbleProbability: 0, stepCount: 36, passTarget: { type: 1, elements: [{ type: 6, count: 13 }] }, starScores: [5000, 12000, 21000], map: { lattices: [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, 0, 0, 0, 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], connectedLats: [[30, 48], [31, 49], [32, 50], [74, 18], [78, 26]], elements: [1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [75, 76, 77], generateLats: [{ index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 10, type: null }, { index: 16, type: null }, { index: 18, type: null }, { index: 26, type: null }] }
},
//158
{
......
......@@ -24,6 +24,8 @@ export enum RecoverName {
HAIRBALLJUMP_ANI = "HairballJumpAni", //三种毛球是一样的动画
FESREDBOMBSHOW_ANI = "FesRedBombShowAni",
FESREDSHOOT_ANI="FesRedShootAni",
//元素身上,特效常驻动效
......
......@@ -14,9 +14,16 @@ import { Element } from "../class/Element";
import { HairballBrownState } from "../states/HairballBrownState";
import { HairballJumpAni } from "../anis/HairballJumpAni";
import { HairballBrownDivideAni } from "../anis/HairballBrownDivideAni";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import { getRotByTwoVectors } from "../anis/MagicRotateAni";
import { FesRedShootAni } from "../anisCall/FesRedShootAni";
//孵鸡的数量
const chickenNum: number = 4
const chickenNum: number = 4;
//节日大红包的小红包数量
export const fesELeSmallNum: number = 6;
export class AiControl {
private static _ins: AiControl
......@@ -43,6 +50,10 @@ export class AiControl {
*/
private hasHairball: boolean;
/**
* 判断是否还有节日大红包,不可再生
*/
private hasFesEleBig: boolean;
/**
* 用于判断格子中
* 是否有果冻,
......@@ -57,6 +68,115 @@ export class AiControl {
// this.hasBubble = judgeBubbleExist(lattices);
this.hasHairball = judgeHairballExist(lattices);
this.eggs = getEggs(lattices);
this.hasFesEleBig = judgeFesEleBigExist(lattices)
}
fesEleMotion(thisObj: MainScene, callback: Function) {
//无节日大红包,直接回调,气泡能生成,不能直接判断
if (!this.hasFesEleBig) {
callback();
return
}
//找出所有的节日大红包
var indexs: number[] = [];
for (var i = 0; i < thisObj.lattices.length; i++) {
var lat = thisObj.lattices[i];
if (lat &&
lat.element &&
lat.element.type == ElementType.FESTIVALELE_BIG //&&
// lat.element.festivalEle.isActive
) {
indexs.push(i);
}
}
//没有节日大红包,直接回调
if (!indexs.length) {
//标记无节日大红包
this.hasFesEleBig = false;
callback();
return
}
if (!thisObj.lattices[indexs[0]].element.festivalEle.isActive) {
callback();
return
}
//找出6个能飞的小红包
var redIndexs: number[] = [];
for (var a = 0; a < thisObj.lattices.length; a++) {
var lat = thisObj.lattices[a];
//是基础元素,但是不能有任何状态,
if (Tool.judgeBaseEle(lat) &&
!lat.element.hasAnyState() &&
!lat.isGenerate //且格子不是生成口
) {
redIndexs.push(a);
}
}
//打乱索引
redIndexs.sort(function () { return (0.5 - Math.random()); });
let six: any[] = redIndexs.splice(0, fesELeSmallNum);
//如果不足6个,就修改thisObj里的
if (six.length < fesELeSmallNum) {
thisObj.festivalTargetNum = fesELeSmallNum;
thisObj.festivalTarget.count = fesELeSmallNum;
//如果是0;就直接发接口吧
if (!six.length) {
NetManager.ins.hc_redBombAward((success) => {
if (success) thisObj.redBombPanelMark = true;
});
callback();
return
}
}
//变成对象
for (var i = 0; i < six.length; i++) six[i] = { index: six[i] };
//暂时只有一个大红包,
let index = indexs[0];
var p = Tool.getPositionByIndex(index);
var vec0 = [1, 0];
//计算角度
for (var i = 0; i < six.length; i++) {
var po = Tool.getPositionByIndex(six[i].index);
var deltaX = po[0] - p[0];
var deltaY = po[1] - p[1];
// var dis = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
//算角度,弧度,x正方向为0,0到2pi,逆时针为正
var vec1 = [deltaX, deltaY]
var rotation = getRotByTwoVectors(vec0, vec1);
if (deltaY > 0) rotation = Math.PI * 2 - rotation;
six[i].rotation = rotation;
}
//排序
six.sort(function (a, b) { return b.rotation - a.rotation });
//还原为索引
for (var i = 0; i < six.length; i++) six[i] = six[i].index;
//动画
thisObj.redBombLightAni(index, () => {
let count = 0;
let countAll = six.length;
for (let a = 0; a < six.length; a++) {
let endIndex = six[a];
let lat = thisObj.lattices[endIndex];
let ele = lat.element;
let fesRedShootAni: FesRedShootAni = Pool.takeOut(RecoverName.FESREDSHOOT_ANI)
if (!fesRedShootAni) fesRedShootAni = new FesRedShootAni();
setTimeout(() => {
thisObj.addChild(fesRedShootAni);
fesRedShootAni.play(p, ele, () => {
if (++count == countAll) {
thisObj.removeOperation(index);
thisObj.fall(() => {
//掉落停止回调
thisObj.fallCallback();
});
// callback();
}
})
}, 100 * a)
}
})
}
jellyMotion(thisObj: MainScene, callback: Function) {
......@@ -515,6 +635,17 @@ function judgeHairballExist(lattices: Lattice[]) {
}
return false;
}
function judgeFesEleBigExist(lattices: Lattice[]) {
for (var i = 0; i < lattices.length; i++) {
var lattice = lattices[i]
if (lattice &&
lattice.element &&
lattice.element.type == ElementType.FESTIVALELE_BIG
) return true
}
return false;
}
/**
* 判断气泡是否存在
* @param lattices
......
......@@ -7,14 +7,14 @@
"option": {
"id": "41",
"day": null,
"realValue":87,
"realValue":999,
"categoryType": 5,
"title": "游戏次数2",
"rate": "10",
"minValue": null,
"maxValue": null,
"coinType": 1,
"propType": 2,
"propType": 3,
"num": null,
"img": "//yun.dui88.com/images/201910/e6pmpk2pne.png",
"appItemId": null,
......
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