Commit b0423c68 authored by wildfirecode's avatar wildfirecode

1

parents b0cb602e 587ee86b
......@@ -135,8 +135,8 @@
];
// localStorage.clear();
window['imgver'] = '11112';
window['total_level'] = 10 + 10 * 29; /// TODO 14 不能变 总数必须大于总的关卡数
window['last_level'] = 300;//必须大于等于total_level ///TODO 标记最后一关,等于最后一关即可
window['total_level'] = 10 + 10 * 32; /// TODO 14 不能变 总数必须大于总的关卡数
window['last_level'] = 325;//必须大于等于total_level ///TODO 标记最后一关,等于最后一关即可
var sharePic = document.getElementById('pic');
......
......@@ -286,7 +286,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele" + i + "Line" + "_png")
RES.getResAsync("ele" + i + "Exp" + "_png")
}
for (var i = 0; i < 20; i++) {
for (var i = 0; i < 21; i++) {
RES.getResAsync("ele" + i + "_png")
}
for (var i = 1; i <= 27; i++) {
......@@ -451,6 +451,7 @@ export default class MainBase extends eui.UILayer {
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
}
catch (e) {
console.error(e);
......
This diff is collapsed.
......@@ -8,7 +8,7 @@ import Loading from "../libs/new_wx/components/Loading";
class FriendWxShare extends ComponentBase {
start() {
const data = getHomeData();
this['lvTxt'].text = data.levels.length ==0 ? 1 : data.levels.length;
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length;
this['avatar'].mask = this['avatarMask'];
const { data: user } = DataManager.ins.getData('hc_userInfo');
this['avatar'].source = user.avatar;
......@@ -36,6 +36,6 @@ export const getFriendShareUrl = async (parent?: egret.DisplayObjectContainer) =
img.src = base64;
Loading.instace.hide();
}, 200);
})
}
\ No newline at end of file
......@@ -98,6 +98,7 @@ import { createCandyDis1Ani } from '../something/anis/candy/createCandyDis1Ani';
import { createCandyDis2Ani } from '../something/anis/candy/createCandyDis2Ani';
import { createCandyDis3Ani } from '../something/anis/candy/createCandyDis3Ani';
import { createCandyDis4Ani } from '../something/anis/candy/createCandyDis4Ani';
import jellyMonsterAI from './jellyMonsterAI';
const aniClass = {
"BoomAni": BoomAni,
......@@ -752,6 +753,15 @@ export default class MainScene extends Scene {
this.elementContainer.addChild(jelly);
this.lattices[i].element = jelly;
break;
//果冻怪物
case ElementConfigType.JELLY_MONSTER:
let monster: Element = Tool.getElement(ElementType.JELLY_MONSTER)
monster.x = p[0];
monster.y = p[1];
this.elementContainer.addChild(monster);
this.lattices[i].element = monster;
monster.resetMonster();
break;
//鸡蛋
case ElementConfigType.CHICKEN_EGG:
let egg: Element = Tool.getElement(ElementType.CHICKEN_EGG)
......@@ -1956,11 +1966,21 @@ export default class MainScene extends Scene {
}
//消除结束之后检查石门
await this.checkAllBlock();
//检查糖果
const candyResult = await this.checkAllCandy();
if (candyResult) {
if (candyResult) {//是不是有融化了的
this.eliminate();
return
};
//果冻怪物
let jellyMonsterAIResult = 0;
if (!this.jellyBrokenMark) {
jellyMonsterAIResult = await jellyMonsterAI(this);//0说明怪物没有地方可吐了
console.log('干刚才吐了几个', jellyMonsterAIResult);
if (jellyMonsterAIResult > 0) //吐了果冻相当于破了个果冻,那么不再蔓延
this.jellyBrokenMark = true;
}
//再检查一次
if (this.threeMatch()) {
this.eliminate()
......@@ -2401,10 +2421,13 @@ export default class MainScene extends Scene {
}
//果冻
else if (ele.type == ElementType.JELLY) {
this.removeJelly(index);
this.removeJelly(index, ele.isMonsterJelly);
//算个数
this.goElementTarget(ele.type, [ele.x, ele.y]);
}
// else if (ele.type == ElementType.MONSTER_JELLY) {
// this.removeMonsterJelly(index);
// }
//鸡蛋
else if (ele.type == ElementType.CHICKEN_EGG) {
//额外逻辑,
......@@ -3010,13 +3033,21 @@ export default class MainScene extends Scene {
* 果冻的移除,包括动效
* @param index
*/
removeJelly(index: number) {
removeJelly(index: number, isMonsterJelly: boolean) {
this.jellyBrokenMark = true;
this.removeOperation(index);
//播放动效,果冻的特效,待写
this.playAni(RecoverName.JELLYDIS_ANI, Tool.getPositionByIndex(index))
if (isMonsterJelly)
this.playAni(RecoverName.ELEDIS_ANI, Tool.getPositionByIndex(index))
else
this.playAni(RecoverName.JELLYDIS_ANI, Tool.getPositionByIndex(index))
}
// removeMonsterJelly(index: number) {
// this.jellyBrokenMark = true;
// this.removeOperation(index);
// this.playAni(RecoverName.ELEDIS_ANI, Tool.getPositionByIndex(index))
// }
//移除小红包,包括动效,还有个数累计等等。发接口,等等
removeFestivalEleSmall(index: number) {
let ele = this.removeOperation(index);
......
import { Element } from "../something/class/Element";
import { Lattice } from "../something/class/Lattice";
import { ElementType } from "../something/enum/ElementType";
import { AiControl } from "../something/logic/AiControl";
import { Tool } from "../something/Tool";
import MainScene from "./MainScene";
import jellyMonsterAni from "./jellyMonsterAni";
export default async (thisObj: MainScene) => {
//找到所有的怪物
//不用判断石门下是否有果冻
//找出所有果冻索引
var indexs: number[] = [];
for (var i = 0; i < thisObj.lattices.length; i++) {
var lattice = thisObj.lattices[i]
if (lattice && lattice.element && lattice.element.type == ElementType.JELLY_MONSTER) {
indexs.push(i);
}
}
//获取果冻动画,0是自身索引,1是终点索引
let spreads: number[][] = [];
for (const fromIndex of indexs) {
var toIndex = judgeActionIndex(fromIndex, thisObj.lattices);
//考虑0,判断null,有就break
if (toIndex != null) {
//能蔓延,返回自身索引和蔓延的索引
spreads.push([fromIndex, toIndex]);
}
}
if (spreads.length > 0)
AiControl.ins.setHasJelly(true);
var i = Math.floor(Math.random() * spreads.length);
let spread;
if (spreads.length > 0) {
spread = spreads.splice(i, 1)[0];
const [fromIndex, toIndex] = spread;
const fromEle: Element = thisObj.lattices[fromIndex].element;//起始元素
const endEle: Element = thisObj.lattices[toIndex].element; //终点元素
await fromEle.toAction();//准备开始吹
await jellyMonsterAni(thisObj,[fromEle.x,fromEle.y],[endEle.x,endEle.y]);
endEle.reset(ElementType.JELLY);
endEle.isMonsterJelly = true;
}
if (spread)
return 1;
return 0;
}
/**
* 判断可蔓延的方向,并返回蔓延终点的格子索引
* 判断可分裂的方向,并返回分裂终点的格子索引
* 判断可跳动的方向,并返回跳动终点的格子索引
*
* 4个方向随机,
* 得是基础元素,且无任何状态,可以有特效
* @param index
* @return 没有返回null,注意判断时可能有0
*/
function judgeActionIndex(index: number, lattices: Lattice[]): number {
//四个方向尽量随机
var arr = [index - Tool.colNum, index + Tool.colNum];
var rc = Tool.indexToRc(index);
var col = rc[1];
//列数大于0才可能有左边格子
if (col > 0) arr.push(index - 1);
//列数不为最右边
if (col < Tool.colNum - 1) arr.push(index + 1);
while (arr.length) {
var rand = Math.floor(Math.random() * arr.length);//随机4个方向
var i = arr.splice(rand, 1)[0];
if (Tool.judgeBaseEle(lattices[i]) &&
!lattices[i].element.hasAnyState() && !lattices[i].element.candy) {
return i
}
}
return null
}
\ No newline at end of file
import MainScene from "./MainScene";
export default (thisobj: MainScene, from: number[], to: number[]) => {
//每次只有一个怪物吹气泡
return new Promise((r) => {
const tex: egret.Texture = RES.getRes("ele20_png");
const pic = new egret.Bitmap(tex);
pic.anchorOffsetX = tex.textureWidth / 2;
pic.anchorOffsetY = tex.textureHeight;
pic.x = from[0];
pic.y = from[1] + 20;
thisobj.addChild(pic);
egret.Tween.get(pic).set({ scaleX: 0, scaleY: 0 })
.to({ scaleX: 1.1, scaleY: 0.9 }, 300)
.to({ scaleX: 0.9, scaleY: 1.1 }, 100)
.to({ scaleX: 1.05, scaleY: 0.95 }, 100)
.to({ scaleX: 1, scaleY: 1 }, 100)
.wait(300)
.set({ anchorOffsetY: tex.textureHeight / 2, y: from[1] + 20 - tex.textureHeight / 2 })
.to({x:to[0],y:to[1]},500)
.to({ scaleX: 0.9, scaleY: 1.1 }, 100)
.to({ scaleX: 1.05, scaleY: 0.95 }, 100)
.to({ scaleX: 1, scaleY: 1 }, 100).call(r)
// r();
});
}
\ No newline at end of file
......@@ -440,7 +440,7 @@ export default class MapScene extends Scene {
updateSign() {
const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if (signInfoVO&&signInfoVO.continueDay < 7) { //表示明天还可以签到
if (signInfoVO && signInfoVO.continueDay < 7) { //表示明天还可以签到
this['sign_s1'].visible = signInfoVO.todaySigned == 0;
this['sign_s2'].visible = !this['sign_s1'].visible;
} else {
......
......@@ -6,7 +6,6 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export default class BackIndexPanel extends Panel {
start(data) {
super.start();
}
onTouchTap_closeBtn() {
......
......@@ -45,14 +45,14 @@ export default class HbCutTime extends Panel {
}
private hbRainBaseInfo(updateData?) {
if(updateData && updateData.data){
if (updateData && updateData.data) {
this.data.res = updateData;
}
const success = updateData ? updateData.success : this.data.res.success;
const res = updateData || this.data.res;
const data = (updateData && updateData.data) || this.data.res.data;
if(!success) {
if (!success) {
this.ok_btn.source = 'hbCutTime_btn_soon_png';
this.tipImage.source = 'hbCutTime_cutLine_disable_png';
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
......@@ -60,7 +60,7 @@ export default class HbCutTime extends Panel {
}
this.cutTimer = this.cutTimer || new CutTimer(this.cutTimeLabel, 'hh时mm分ss秒', async () => {
const getData = await this.getData(); //重新获取数据
if(getData.success) {
if (getData.success) {
this.hbRainBaseInfo(getData);
} else {
this.hidePanel(); //没有数据关闭窗口
......@@ -69,9 +69,9 @@ export default class HbCutTime extends Panel {
});
const sysTime = res.timestamp; // 当前系统时间
let time;
if(data.currentSession) {
if (data.currentSession) {
time = data.currentSession.endTime - sysTime + 3000;
if(data.canJoin) {
if (data.canJoin) {
this.ok_btn.source = 'hbCutTime_btn_enable_png';
NetManager.ins.showLog(getlogItem(58));
this.btnEffect();
......@@ -81,18 +81,18 @@ export default class HbCutTime extends Panel {
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
}
this.tipImage.source = 'hbCutTime_cutLine_enable_png';
if(!this.cutTimer.start(time)) {
if (!this.cutTimer.start(time)) {
this.cutTimer.stop();
this.cutTimer.start(time);
}
} else if(data.nextSession) {
} else if (data.nextSession) {
egret.Tween.removeTweens(this.ok_btn);
this.ok_btn.scaleX = this.ok_btn.scaleY = 1;
time = data.nextSession.startTime - sysTime + 3000;
this.ok_btn.source = 'hbCutTime_btn_soon_png';
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
this.tipImage.source = 'hbCutTime_cutLine_disable_png';
if(!this.cutTimer.start(time)) {
if (!this.cutTimer.start(time)) {
this.cutTimer.stop();
this.cutTimer.start(time);
}
......@@ -105,8 +105,8 @@ export default class HbCutTime extends Panel {
private btnEffect() {
egret.Tween.removeTweens(this.ok_btn);
egret.Tween.get(this.ok_btn).to({scaleX: 0.9, scaleY: 1.1}, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this.ok_btn).to({scaleX: 1, scaleY: 1}, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this.ok_btn).to({ scaleX: 0.9, scaleY: 1.1 }, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this.ok_btn).to({ scaleX: 1, scaleY: 1 }, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this.ok_btn).to({
scaleX: 0.9618,
scaleY: 1.0618
......@@ -123,7 +123,7 @@ export default class HbCutTime extends Panel {
}
destroy() {
if(this.cutTimer) {
if (this.cutTimer) {
this.cutTimer.stop();
}
super.destroy();
......@@ -163,11 +163,11 @@ export default class HbCutTime extends Panel {
onTouchOK() {
NetManager.ins.clickLog(getlogItem(58));
try {
if(window['getRST']) window['getRST']();
} catch(error) {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
PanelCtrl.instance.show('HbGame', {needScore: this.data.res.data.currentSession.limitScore});
PanelCtrl.instance.show('HbGame', { needScore: this.data.res.data.currentSession.limitScore });
}
protected get closeBtns(): eui.Button[] {
......
......@@ -65,10 +65,10 @@ export default class HbGame extends Panel {
// 加分
private addScore(score: number) {
this.score += score;
egret.Tween.get(this.scoreGroup).to({scaleX: 1.3, scaleY: 1.3}, 100).call(() => {
egret.Tween.get(this.scoreGroup).to({ scaleX: 1.3, scaleY: 1.3 }, 100).call(() => {
this.scoreLabelStr += score;
this.scoreLabel.text = `${this.scoreLabelStr}`;
egret.Tween.get(this.scoreGroup).to({scaleX: 1, scaleY: 1}, 100);
egret.Tween.get(this.scoreGroup).to({ scaleX: 1, scaleY: 1 }, 100);
});
}
......@@ -82,8 +82,8 @@ export default class HbGame extends Panel {
private hbDoJoin() {
let session = DataManager.ins.getData(NetName.HBRAIN_BASEINFO).data.currentSession.sessionIndex;
try {
if(window['getRST']) window['getRST']();
} catch(error) {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
NetManager.ins.hbRainDoJoin((success, res) => {
......@@ -92,51 +92,51 @@ export default class HbGame extends Panel {
}, window['collectRuleId']);
const data = res.data;
const code = res.code;
if(!success) {
switch(true) {
if (!success) {
switch (true) {
case (code == "600015"): // 网络错误 //命中风控参与规则
PanelCtrl.instance.show("HbNoPrize", {type: 2});
PanelCtrl.instance.show("HbNoPrize", { type: 2 });
break;
case (code == "600016"): // 游戏分数提交失败~如有疑问,请联系客服 // 苏宁风控 命中
PanelCtrl.instance.show("HbNoPrize", {type: 2});
PanelCtrl.instance.show("HbNoPrize", { type: 2 });
break;
case (code == "600054"): // 红包雨活动暂未开启
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600055"): // 红包雨场次配置异常
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600056"): // 当前红包雨场次不存在
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600057"): // 当前红包雨场次已结束
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600058"): // 分数未达到目标
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600059"): // 红包炸弹活动暂未开启
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600060"): // 当前场次参与次数达到上限
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600061"): // 红包炸弹配置异常
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
case (code == "600062"): // 红包炸弹已经全部领取
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
default:
PanelCtrl.instance.show("HbNoPrize", {type: 1});
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
break;
}
return;
}
if(!data || !data.option || data.categoryType == 1) {
PanelCtrl.instance.show("HbNoPrize", {type: 1});
if (!data || !data.option || data.categoryType == 1) {
PanelCtrl.instance.show("HbNoPrize", { type: 1 });
} else {
let _data = Utils.deepClone(data);
_data.score = this.score;
......@@ -165,11 +165,11 @@ export default class HbGame extends Panel {
let totalTime: number = this.totalTime;
let lastT = new Date().getTime();
let dt = 0;
egret.startTick(function(timeStamp: number): boolean {
egret.startTick(function (timeStamp: number): boolean {
dt = (new Date().getTime() - lastT) / 1000;
cTime += dt;
if(cTime > totalTime){
if (cTime > totalTime) {
cTime = 0;
}
angle = 360 * cTime / totalTime;
......@@ -197,13 +197,13 @@ export default class HbGame extends Panel {
private timeCallFun() {
this.cutTimeLabel.text = `${--this.time}`;
if(this.time <= 0) {
if (this.time <= 0) {
this.gameOver();
}
if(this.time == 3) {
if (this.time == 3) {
let _y = this.cutTimerGroup.y;
egret.Tween.get(this.cutTimerGroup, {loop: true}).to({y: _y + 10}, 100).call(() => {
egret.Tween.get(this.cutTimerGroup).to({y: _y}, 100);
egret.Tween.get(this.cutTimerGroup, { loop: true }).to({ y: _y + 10 }, 100).call(() => {
egret.Tween.get(this.cutTimerGroup).to({ y: _y }, 100);
})
}
}
......@@ -220,18 +220,18 @@ export default class HbGame extends Panel {
obj.anchorOffsetY = 377 / 2;
this.readyGroup.visible = true;
obj.source = "hbGame_3_png", obj.scaleX = obj.scaleY = _scaleMin, obj.alpha = 1;
egret.Tween.get(obj).to({scaleX: 1, scaleY: 1, alpha: 1}, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1}, t2).call(() => {
egret.Tween.get(obj).to({ scaleX: 1, scaleY: 1, alpha: 1 }, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({ scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1 }, t2).call(() => {
obj.source = "hbGame_2_png", obj.scaleX = obj.scaleY = _scaleMin, obj.alpha = 1;
egret.Tween.get(obj).to({scaleX: 1, scaleY: 1, alpha: 1}, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1}, t2).call(() => {
egret.Tween.get(obj).to({ scaleX: 1, scaleY: 1, alpha: 1 }, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({ scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1 }, t2).call(() => {
obj.source = "hbGame_1_png", obj.scaleX = obj.scaleY = _scaleMin, obj.alpha = 1;
egret.Tween.get(obj).to({scaleX: 1, scaleY: 1, alpha: 1}, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1}, t2).call(() => {
egret.Tween.get(obj).to({ scaleX: 1, scaleY: 1, alpha: 1 }, t1, _ease).wait(tw).call(() => {
egret.Tween.get(obj).to({ scaleX: _scaleMax, scaleY: _scaleMax, alpha: 0.1 }, t2).call(() => {
this.readyGroup.visible = false;
this.startGame();
egret.Tween.get(this.timeBtn).to({y: 8}, 100).call(() => {
egret.Tween.get(this.timeBtn).to({y: 0}, 100);
egret.Tween.get(this.timeBtn).to({ y: 8 }, 100).call(() => {
egret.Tween.get(this.timeBtn).to({ y: 0 }, 100);
});
})
});
......@@ -243,7 +243,7 @@ export default class HbGame extends Panel {
private readyTipsEffect() {
this.readyGroup.alpha = 0;
egret.Tween.get(this.readyGroup).to({alpha: 1}, 300).call(() => this.readyTimeEffect());
egret.Tween.get(this.readyGroup).to({ alpha: 1 }, 300).call(() => this.readyTimeEffect());
}
protected onSkinComplete() {
......
......@@ -11,9 +11,9 @@ import { NetManager } from "../../../libs/tw/manager/NetManager";
* 红包雨奖励
*/
export default class HbPrize extends Panel {
public ok_btn:eui.Button;
public closeBtn:eui.Button;
public tipLabel:eui.Label;
public ok_btn: eui.Button;
public closeBtn: eui.Button;
public tipLabel: eui.Label;
constructor(data) {
super();
......@@ -31,10 +31,10 @@ export default class HbPrize extends Panel {
}
updateOption(option: any) {
const { categoryType, img, num, propType,realValue } = option;// 2次数 3道具 4元宝 5实物 6优惠券 7虚拟商品
const { categoryType, img, num, propType, realValue } = option;// 2次数 3道具 4元宝 5实物 6优惠券 7虚拟商品
this['propnums'].text = 'x1';
if(num)
if (num)
this['propnums'].text = 'x' + num;
switch (categoryType) {
case 2:
......@@ -81,7 +81,7 @@ export default class HbPrize extends Panel {
onTouchOK() {
NetManager.ins.clickLog(getlogItem(59));
if((getHomeData().levels.length + 1) > window['last_level']) {
if ((getHomeData().levels.length + 1) > window['last_level']) {
changeMapScene();
super.hidePanel();
return;
......
......@@ -25,7 +25,7 @@ export default class RainMgr {
this.timer.stop(); // 停止计时器
// 隐藏全部掉落物品
for(let v of this.rainGroup.$children) {
for (let v of this.rainGroup.$children) {
v.visible = false;
}
}
......@@ -43,16 +43,16 @@ export default class RainMgr {
// 添加掉落物品
private addRain() {
let num = Utils.RandomInt(3, 6);
for(let i = 0; i < num; i++) {
for (let i = 0; i < num; i++) {
let newRainObj = this.rainPool.get();
if(!newRainObj) {
if (!newRainObj) {
newRainObj = new RainObj({
key: RainData.key[~~(Math.random() * RainData.key.length)],
rainGroup: this.rainGroup,
pool:this.rainPool,
pool: this.rainPool,
});
}
setTimeout(()=>{
setTimeout(() => {
newRainObj.addStage((this.rainGroup.width) / num * i + 100, Utils.RandomInt(6, 9) / 10);
}, Utils.RandomInt(0, 8) * 100);
}
......@@ -60,16 +60,16 @@ export default class RainMgr {
private addPool() {
this.rainPool = new Pooling();
for(let v of RainData.key) {
for (let v of RainData.key) {
let num = 1;
if(v == 'hongbao'){
if (v == 'hongbao') {
num = 45;
}
for(let i = 0; i < num; i++) {
for (let i = 0; i < num; i++) {
let newObj = new RainObj({
key: v,
rainGroup: this.rainGroup,
pool:this.rainPool,
pool: this.rainPool,
});
this.rainPool.push(newObj);
}
......
......@@ -8,11 +8,13 @@ export default class TargetItemRenderer extends eui.ItemRenderer {
dataChanged(){
for (let i = 0; i <11; i++) {
this['icon' + i].visible=false;
}
try {
this['icon' + this.data.type].visible=true;
} catch (error) {
}
this['icon' + this.data.type].visible=true;
this['txt'].text = `X${this.data.count }`;
}
......
......@@ -16,7 +16,7 @@ export class RegTriangle extends RegPolygon {
constructor(length, view) {
super(length, view);
this.type="regTriangle";
this.type = "regTriangle";
this.pointLength = this.length * sqrt3 / 3;
this.sideLength = this.length * sqrt3 / 6;
}
......
......@@ -274,6 +274,7 @@ export class Tool {
lat.element.hasState(StateType.LOCK) ||
lat.element.hasState(StateType.BLOCK_LOCK) ||
lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.JELLY_MONSTER ||
lat.element.type == ElementType.CHICKEN_EGG ||
lat.element.type == ElementType.FESTIVALELE_BIG //||
// lat.element.type == ElementType.FESTIVALELE_SMALL
......@@ -297,6 +298,7 @@ export class Tool {
!lat.element.hasState(StateType.HAIRBALLGREY) &&
!lat.element.hasState(StateType.HAIRBALLBROWN) &&
!lat.element.hasState(StateType.BLOCK_LOCK) &&
lat.element.type != ElementType.JELLY_MONSTER &&
lat.element.type != ElementType.FESTIVALELE_SMALL
) {
return true
......@@ -334,7 +336,8 @@ export class Tool {
return false
}
//上方元素为冰淇淋
else if (lat.element.type == ElementType.LOLLIPOP) {
else if (lat.element.type == ElementType.LOLLIPOP ||
lat.element.type == ElementType.JELLY_MONSTER) {
return false
}
//剩下情况
......@@ -410,6 +413,7 @@ export class Tool {
ele.hasState(StateType.HAIRBALLBLACK) ||
ele.hasState(StateType.HAIRBALLBROWN) ||
ele.type == ElementType.JELLY ||
ele.type == ElementType.JELLY_MONSTER ||
ele.type == ElementType.CHICKEN_EGG ||
ele.type == ElementType.FESTIVALELE_BIG ||
ele.type == ElementType.FESTIVALELE_SMALL
......@@ -430,6 +434,7 @@ export class Tool {
ele.type == ElementType.JELLY ||
ele.type == ElementType.CHICKEN_EGG ||
ele.type == ElementType.LOLLIPOP ||
ele.type == ElementType.JELLY_MONSTER ||
ele.type == ElementType.FESTIVALELE_BIG ||
ele.type == ElementType.FESTIVALELE_SMALL ||
ele.hasState(StateType.LOCK) ||
......
......@@ -36,7 +36,14 @@ export class JellySpreadAni extends egret.DisplayObjectContainer {
this.addChild(this.shoot);
}
play(startP: number[], cloneEle: Element, callback: Function) {
play(startP: number[], cloneEle: Element, callback: Function, isMonsterJelly) {
if (isMonsterJelly) {
this.targetImage.texture = RES.getRes('ele20_png');
this.oriImage.texture = RES.getRes('ele20_png');
} else {
this.targetImage.texture = RES.getRes("ele" + ElementType.JELLY + "_png");
this.oriImage.texture = RES.getRes("ele" + ElementType.JELLY + "_png");
}
this.x = startP[0];
this.y = startP[1];
//终点位置全局先赋值出来,判断用
......
This diff is collapsed.
......@@ -25,12 +25,81 @@ import { createCandyDis1Ani } from "../anis/candy/createCandyDis1Ani";
import { createCandyDis2Ani } from "../anis/candy/createCandyDis2Ani";
import { createCandyDis3Ani } from "../anis/candy/createCandyDis3Ani";
import { createCandyDis4Ani } from "../anis/candy/createCandyDis4Ani";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
/**
* 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点
* 最好到时按,底图,动效,气泡,笼子,毛球,进行分层,如果多个状态要共存时,必须分层,到时气泡的动画,要写再自己的层里
*/
export class Element extends eui.Component {
_mv;
async resetMonster() {
this.changeSource('empty_png');
this.showImage.alpha = 0;
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
this._mv = mv;
this.addChild(mv);
mv.anchorOffsetX = 150;
mv.anchorOffsetY = 150;
mv.x = - 3;
mv.y = - 6;
this.toStandByAction();
}
private _isMonsterJelly: boolean;
set isMonsterJelly(val: boolean) {
this._isMonsterJelly = val;
this.changeSource('ele20_png')
}
get isMonsterJelly() {
return this._isMonsterJelly;
}
toStandByAction() {
if (!this._mv) return;
const mv = this._mv;
const cb = () => {
if (mv.currentFrame == 360) { //向上吹
mv.gotoAndPlay(1, true);
}
};
this._mv.addEventListener(egret.Event.ENTER_FRAME, cb, this);
mv.gotoAndPlay(1, true);
}
toAction() {
return new Promise((r) => {
if (!this._mv) {
r();
return;
}
var p = Tool.getPositionByIndex(this.index);
const mv = this._mv;
const cb = () => {
if (mv.currentFrame == 508) { //向上吹
this.toStandByAction();
}
if (mv.currentFrame == 391) {
r();
// const tex: egret.Texture = RES.getRes("ele20_png");
// const pic = new egret.Bitmap(tex);
// pic.anchorOffsetX = tex.textureWidth / 2;
// pic.anchorOffsetY = tex.textureHeight;
// pic.x = p[0];
// pic.y = p[1];
// this.stage.addChild(pic);
// egret.Tween.get(pic).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1.1, scaleY: 1.1 }, 300).wait(1000).call(()=>{
// pic.parent.removeChild(pic);
// });
}
};
this._mv.addEventListener(egret.Event.ENTER_FRAME, cb, this);
mv.gotoAndPlay(361, true);
});
}
private _candy: Candy;
resetToCandyView(baseElement: CandyBaseElementType) {
const res = transElementRes(baseElement);
......@@ -68,8 +137,8 @@ export class Element extends eui.Component {
const cb = () => {
r();
};
this.showImage.alpha=0;
this.candy.visible=false;
this.showImage.alpha = 0;
this.candy.visible = false;
var p = Tool.getPositionByIndex(this.index);
if (this.type == ElementType.RABBIT)
createCandyDis0Ani(p[0], p[1], this.stage, cb);
......@@ -253,6 +322,7 @@ export class Element extends eui.Component {
changeSource(source: string) {
// this.showImage.source = source;
var texture: egret.Texture = RES.getRes(source);
if (!texture) { return; }
this.showImage.texture = texture
this.showImage.x = -texture.textureWidth / 2;
......
......@@ -52,6 +52,10 @@ export enum ElementConfigType {
* 糖果
*/
CANDY = 11,
/**
* 果冻怪
*/
JELLY_MONSTER = 12,
}
// export const isCandy = (t: ElementConfigType) => {
......
......@@ -35,6 +35,9 @@ export enum ElementType {
CANDY_CATTLE,//牛
CANDY_LION,//狮子
CANDY_PIG,//猪
MONSTER_JELLY1,
JELLY_MONSTER,
}
export enum CandyBaseElementType {
......
......@@ -40,6 +40,7 @@ export class AiControl {
* 判断是否还有果冻,暂时不考虑果冻无中生有,否则逻辑修改
*/
private hasJelly: boolean;
setHasJelly(val) { this.hasJelly = val }
/**
* 提前记录所有的鸡蛋的索引,因为鸡蛋数量不会改变
*/
......@@ -217,13 +218,13 @@ export class AiControl {
for (var i = 0; i < thisObj.lattices.length; i++) {
var lattice = thisObj.lattices[i]
//没有格子或没有元素或不是果冻 跳过
if (lattice && lattice.element && lattice.block && lattice.block.isLock() && lattice.element.type == ElementType.JELLY ) {
if (lattice && lattice.element && lattice.block && lattice.block.isLock() && lattice.element.type == ElementType.JELLY) {
blocked.push(i);
}
if (!lattice || !lattice.element || lattice.element.type != ElementType.JELLY || (lattice.block && lattice.block.isLock())) continue
indexs.push(i);
}
console.log('没有被锁的果冻数量',indexs.length,'被锁果冻数量',blocked.length,)
console.log('没有被锁的果冻数量', indexs.length, '被锁果冻数量', blocked.length)
//如果没有果冻,直接回调
if (!indexs.length && blocked.length == 0) {
//标记为无果冻
......@@ -253,7 +254,7 @@ export class AiControl {
//果冻蔓延动画
let jellySpreadAni: JellySpreadAni = Pool.takeOut(RecoverName.JELLYSPREAD_ANI)
if (!jellySpreadAni) {
jellySpreadAni = new JellySpreadAni()
jellySpreadAni = new JellySpreadAni();
}
thisObj.addChild(jellySpreadAni);
//起始元素
......@@ -265,6 +266,8 @@ export class AiControl {
//对后续有影响的数据必须提交更新,视图不对就隐藏先,动画里加上对应视图,动画播放回调里去掉动画视图,显示数据视图;
//将终点元素变成果冻,,
endEle.reset(ElementType.JELLY);
if (fromEle.isMonsterJelly)
endEle.isMonsterJelly = true;
//隐藏元素
fromEle.visible = false;
endEle.visible = false;
......@@ -277,7 +280,7 @@ export class AiControl {
endEle.visible = true;
//执行回调
callback()
})
}, fromEle.isMonsterJelly)
}
/**
* 鸡蛋得孵化逻辑
......@@ -728,7 +731,7 @@ function judgeActionIndex(index: number, lattices: Lattice[]): number {
var rand = Math.floor(Math.random() * arr.length);
var i = arr.splice(rand, 1)[0];
if (Tool.judgeBaseEle(lattices[i]) &&
!lattices[i].element.hasAnyState()) {
!lattices[i].element.hasAnyState() && !lattices[i].element.candy) {
return i
}
}
......
{
"success": 1,
"success": 0,
"code": "600074",
"desc": "用户未达到回归奖励领取条件",
"timestamp": 1578472496421,
......
......@@ -1512,6 +1512,131 @@
"levelNum": 300,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 301,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 302,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 303,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 304,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 305,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 306,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 307,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 308,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 309,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 310,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 311,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 312,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 313,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 314,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 315,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 316,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 317,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 318,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 319,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 320,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 321,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 322,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 323,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 324,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 325,
"maxScore": 47440,
"stars": 1
}
],
"remainProp": [
......
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