Commit a556c3bc authored by wildfirecode's avatar wildfirecode

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

parents 8fc94add f83bc4f4
...@@ -54,6 +54,7 @@ import InviteCutTimePanel from "../../src/panels/InviteCutTimePanel"; ...@@ -54,6 +54,7 @@ import InviteCutTimePanel from "../../src/panels/InviteCutTimePanel";
import RulePanel2 from "./components/RulePanel2"; import RulePanel2 from "./components/RulePanel2";
import ScratchPanel from "../../src/panels/ScratchPanel"; import ScratchPanel from "../../src/panels/ScratchPanel";
import ScratchPrizePanel from "../../src/panels/ScratchPrizePanel"; import ScratchPrizePanel from "../../src/panels/ScratchPrizePanel";
import TurntablePanel from "../../src/panels/TurntablePanel/TurntablePanel";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -98,6 +99,7 @@ export default class MainBase extends eui.UILayer { ...@@ -98,6 +99,7 @@ export default class MainBase extends eui.UILayer {
['inviteRule', { cls: InviteRulePanel }], ['inviteRule', { cls: InviteRulePanel }],
['scratch', { cls: ScratchPanel }], ['scratch', { cls: ScratchPanel }],
['scratchPrize', { cls: ScratchPrizePanel }], ['scratchPrize', { cls: ScratchPrizePanel }],
['turnTable', { cls: TurntablePanel }],
['friend', { cls: FriendPanel }], ['friend', { cls: FriendPanel }],
['ad', { cls: ADPanel }], ['ad', { cls: ADPanel }],
]; ];
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
"resource/skins/TaskPrizeSkin.exml", "resource/skins/TaskPrizeSkin.exml",
"resource/skins/TaskSkin.exml", "resource/skins/TaskSkin.exml",
"resource/skins/ToastSkin.exml", "resource/skins/ToastSkin.exml",
"resource/skins/TurntablePanelSkin.exml",
"resource/skins/VScrollBarSkin.exml" "resource/skins/VScrollBarSkin.exml"
], ],
"path": "resource/default.thm.json" "path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="LoadingSceneSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image scaleX="1" scaleY="1" y="73.35" horizontalCenter="0" source=""/>
<e:Group horizontalCenter="0" verticalCenter="-190" touchEnabled="false">
<e:Image scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" source=""/>
<e:Group id="panel" anchorOffsetX="277" anchorOffsetY="276.5" rotation="0" horizontalCenter="0" verticalCenter="0">
<e:Image scaleX="1" scaleY="1" anchorOffsetX="277" anchorOffsetY="276.5" rotation="0" horizontalCenter="0" verticalCenter="0" source=""/>
<e:Group id="prize0" y="14.28" x="202">
<e:Image id="img0" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab0" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xe33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize1" y="124.33" rotation="-40" x="51">
<e:Image id="img1" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab1" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize2" y="305.71" rotation="-80" x="7">
<e:Image id="img2" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab2" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize3" y="472.4" rotation="-120" x="88">
<e:Image id="img3" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab3" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize4" y="547.74" rotation="-160" x="258">
<e:Image id="img4" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab4" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize5" y="496.44" rotation="-200" x="438">
<e:Image id="img5" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab5" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize6" y="342.33" rotation="-240" x="540.33">
<e:Image id="img6" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab6" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize7" y="157.32" rotation="-280" x="520.6">
<e:Image id="img7" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab7" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
<e:Group id="prize8" y="27.91" rotation="-320" x="388.98">
<e:Image id="img8" y="50" width="83" height="83" rotation="0" horizontalCenter="0"/>
<e:Label id="lab8" text="Label" y="0" size="24" rotation="0" textAlign="center" verticalAlign="middle" anchorOffsetX="75" width="150" anchorOffsetY="0" height="50" skewX="0" textColor="0xE33330" horizontalCenter="0"/>
</e:Group>
</e:Group>
<e:Button id="start_btn" label="" anchorOffsetX="93" anchorOffsetY="140" horizontalCenter="0" verticalCenter="-25">
</e:Button>
</e:Group>
<e:Button id="closeBtn" label="" y="135.31" x="565.89">
<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"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 简单的倒计时 * 简单的倒计时
* 2019.10.24 * 2019.10.24
*/ */
export default class CutTime { export default class CutTimer {
private _timer: egret.Timer = null; private _timer: egret.Timer = null;
private _label: eui.Label = null; private _label: eui.Label = null;
......
...@@ -52,4 +52,74 @@ export default class Utils { ...@@ -52,4 +52,74 @@ export default class Utils {
public static prefixInteger(num, length) { public static prefixInteger(num, length) {
return (Array(length).join('0') + num).slice(-length); return (Array(length).join('0') + num).slice(-length);
} }
/**
* 对象/数组 深拷贝
* @param {Object} src - 来源对象
* @param {Object} dst - 目标对象
* @returns {Object} obj - 拷贝完成的对象
*/
public static deepClone(src, dst = undefined) {
let _obj = dst || (src instanceof Array ? [] : {});
for(let key in src) {
let prop = src[key];
if(prop === _obj) { // 避免相互引用对象导致死循环,如src.a = dst的情况
continue;
}
_obj[key] = ((typeof prop === 'object') ? this.deepClone(prop) : _obj[key] = prop);
// if (typeof prop === 'object') { // 如果这是个对象则递归调用
// _obj[key] = _deepClone(prop);
// } else {
// _obj[key] = prop;
// }
}
return _obj;
};
/**
* 产生一个固定范围的随机数(左闭右开)
* @param start
* @param end
*/
public static Random(start: number, end: number) {
return Math.random() * (end - start) + start;
}
/**
* 产生一个固定范围的随机整数(左闭右开)
* @param start
* @param end
*/
public static RandomInt(start: number, end: number) {
return Math.floor(Math.random() * (end - start) + start);
}
/**
* obj是否在array中
* @param obj
* @param array
*/
public static isInArray(obj: any, array: any[]) {
for(let i in array) {
if(obj == array[i]) {
return true;
}
}
return false;
}
/**
* 简单的碰撞检测
* @param obj1
* @param obj2
*/
public static hitTest(obj1: any, obj2: any): boolean {
let rect1: egret.Rectangle = obj1.getBounds();
let rect2: egret.Rectangle = obj2.getBounds();
rect1.x = obj1.x;
rect1.y = obj1.y;
rect2.x = obj2.x;
rect2.y = obj2.y;
return rect1.intersects(rect2);
}
} }
\ No newline at end of file
...@@ -53,15 +53,14 @@ export class GameGuide extends egret.DisplayObjectContainer { ...@@ -53,15 +53,14 @@ export class GameGuide extends egret.DisplayObjectContainer {
show() { show() {
var step = this.stepAll - this.stepCount; var step = this.stepAll - this.stepCount;
this.drawBg(step); this.drawBg(step);
//修改元素的层级,置顶,否则可能点击其他元素 //修改元素的层级,置顶,否则可能点击其他元素,handIndexs
var data = chapterFuns[this.thisObj.chapter]; var handIndexs = chapterFuns[this.thisObj.chapter].handIndexs[step];
for (var i = 0; i < data.showIndexs[step].length; i++) { for (var i = 0; i < handIndexs.length; i++) {
var index = data.showIndexs[step][i]; var index = handIndexs[i];
var lat = this.thisObj.lattices[index] var lat = this.thisObj.lattices[index]
if (lat && lat.element) this.thisObj.elementContainer.addChild(lat.element); if (lat && lat.element) this.thisObj.elementContainer.addChild(lat.element);
} }
var handIndexs = chapterFuns[this.thisObj.chapter].handIndexs[step];
this.handAni(handIndexs); this.handAni(handIndexs);
this.msg.text = chapterFuns[this.thisObj.chapter].msg[step] || ""; this.msg.text = chapterFuns[this.thisObj.chapter].msg[step] || "";
this.msg.x = (750 - this.msg.textWidth) / 2; this.msg.x = (750 - this.msg.textWidth) / 2;
...@@ -88,7 +87,7 @@ export class GameGuide extends egret.DisplayObjectContainer { ...@@ -88,7 +87,7 @@ export class GameGuide extends egret.DisplayObjectContainer {
} }
} }
private handAni(handIndexs: number) { private handAni(handIndexs: number[]) {
egret.Tween.removeTweens(this.hand) egret.Tween.removeTweens(this.hand)
var p1 = Tool.getPositionByIndex(handIndexs[0]); var p1 = Tool.getPositionByIndex(handIndexs[0]);
var p2 = Tool.getPositionByIndex(handIndexs[1]); var p2 = Tool.getPositionByIndex(handIndexs[1]);
...@@ -274,19 +273,23 @@ const chapterFuns = { ...@@ -274,19 +273,23 @@ const chapterFuns = {
] ]
}, },
//棒棒糖消除 //棒棒糖消除
100: { 17: {
stepCount: 1, stepCount: 2,
showIndexs: [ showIndexs: [
[4, 5, 6, 13], [22, 31, 40, 49, 39],
[68, 49, 58, 67, 76],
], ],
hideIndexs: [ hideIndexs: [
[5, 6], [22, 31, 49],
[49, 58, 76],
], ],
handIndexs: [ handIndexs: [
[13, 4] [39, 40],
[68, 67],
], ],
msg: [ msg: [
"当棒棒糖移至底层时,即可移除棒棒糖" "当棒棒糖移至底层时,即可移除棒棒糖",
"消除棒棒糖下方的动物\n就可以收集棒棒糖啦"
] ]
}, },
//笼子消除 //笼子消除
......
...@@ -521,15 +521,6 @@ export default class MainScene extends Scene { ...@@ -521,15 +521,6 @@ export default class MainScene extends Scene {
else if (elements[i] == 9) { else if (elements[i] == 9) {
ele.setState(StateType.BUBBLE, true, 2) ele.setState(StateType.BUBBLE, true, 2)
} }
else {
//加特效
if (Math.random() < this.chapterData.effectInitProbability) {
ele.effectType = Tool.randomT([0, 1, 2, 3])
if (ele.effectType == EffectType.MAGICLION) {
this.elementContainer.addChildAt(ele, 0);
}
}
}
break; break;
//棒棒糖 //棒棒糖
case 3: case 3:
...@@ -621,7 +612,7 @@ export default class MainScene extends Scene { ...@@ -621,7 +612,7 @@ export default class MainScene extends Scene {
//初始化引导,游戏和道具 //初始化引导,游戏和道具
initGuide() { initGuide() {
//游戏引导 //游戏引导
const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12] const gameGuideChapterNum = [1, 2, 3, 5, 8, 9, 10, 12, 17]
if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) { if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) {
if (!readCache(getCacheKey() + this.chapter)) { if (!readCache(getCacheKey() + this.chapter)) {
this.gameGuide = new GameGuide(this); this.gameGuide = new GameGuide(this);
...@@ -1199,9 +1190,7 @@ export default class MainScene extends Scene { ...@@ -1199,9 +1190,7 @@ export default class MainScene extends Scene {
} }
let latFall; let latFall;
let indexFall; let indexFall;
let type: FallType = FallType.STRIGHT let type: FallType = FallType.STRIGHT
//找联通的up,一期没有复杂的联通,所以动画不用特殊处理 //找联通的up,一期没有复杂的联通,所以动画不用特殊处理
if (lat.up) { if (lat.up) {
var latUnUp = this.lattices[lat.up]; var latUnUp = this.lattices[lat.up];
...@@ -1220,21 +1209,33 @@ export default class MainScene extends Scene { ...@@ -1220,21 +1209,33 @@ export default class MainScene extends Scene {
} }
} }
//找左上 //找左上
if (!latFall && Tool.indexToRc(indexMy)[1] != 0) { let findLeft = () => {
var latLeftUp = this.lattices[indexMy - Tool.colNum - 1]; if (!latFall && Tool.indexToRc(indexMy)[1] != 0) {
if (Tool.judgeFall(latLeftUp)) { var latLeftUp = this.lattices[indexMy - Tool.colNum - 1];
latFall = latLeftUp; if (Tool.judgeFall(latLeftUp)) {
indexFall = indexMy - Tool.colNum - 1; latFall = latLeftUp;
indexFall = indexMy - Tool.colNum - 1;
}
} }
} }
//找右上 //找右上
if (!latFall && Tool.indexToRc(indexMy)[1] != Tool.colNum - 1) { let findRight = () => {
var latRightUp = this.lattices[indexMy - Tool.colNum + 1]; if (!latFall && Tool.indexToRc(indexMy)[1] != Tool.colNum - 1) {
if (Tool.judgeFall(latRightUp)) { var latRightUp = this.lattices[indexMy - Tool.colNum + 1];
latFall = latRightUp; if (Tool.judgeFall(latRightUp)) {
indexFall = indexMy - Tool.colNum + 1; latFall = latRightUp;
indexFall = indexMy - Tool.colNum + 1;
}
} }
} }
//随机一下,先找左或先找右
if (Math.random() > 0.5) {
findLeft();
findRight();
} else {
findRight();
findLeft();
}
//如果latFall存在 //如果latFall存在
if (latFall) { if (latFall) {
//能掉落,记录元素动画 //能掉落,记录元素动画
...@@ -1401,6 +1402,8 @@ export default class MainScene extends Scene { ...@@ -1401,6 +1402,8 @@ export default class MainScene extends Scene {
} }
//生成口定制掉落 //生成口定制掉落
else { else {
//基础元素数组
var baseElementTypes = this.chapterData.baseElementTypes.slice();
//列数 //列数
var col = Tool.indexToRc(index)[1]; var col = Tool.indexToRc(index)[1];
//找出索引是index的数据 //找出索引是index的数据
...@@ -1412,35 +1415,41 @@ export default class MainScene extends Scene { ...@@ -1412,35 +1415,41 @@ export default class MainScene extends Scene {
let one = data.cus.shift() let one = data.cus.shift()
if (one) { if (one) {
var oneData = Tool.praseEleNumber(one); var oneData = Tool.praseEleNumber(one);
type = oneData[0] === null ? Tool.randomT(this.chapterData.baseElementTypes) : oneData[0]; type = oneData[0] === null ? Tool.randomT(baseElementTypes) : oneData[0];
effectType = oneData[1]; effectType = oneData[1];
} }
//否则根据type来定 //否则根据type来定
else { else {
//type没有或type长度没有,随机 //type没有或type长度没有,随机
if (!data.type || !data.type.length) { if (!data.type || !data.type.length) {
type = Tool.randomT(this.chapterData.baseElementTypes) type = Tool.randomT(baseElementTypes)
} }
//type里随机。随机出来如果是0,还是随机 //type里随机。随机出来如果是0,还是随机
else { else {
var code = Tool.randomT(data.type); var code = Tool.randomT(data.type);
if (code) { if (code) {
var codeData = Tool.praseEleNumber(code); var codeData = Tool.praseEleNumber(code);
type = codeData[0] === null ? Tool.randomT(this.chapterData.baseElementTypes) : codeData[0]; type = codeData[0] === null ? Tool.randomT(baseElementTypes) : codeData[0];
effectType = codeData[1]; effectType = codeData[1];
} else { } else {
type = Tool.randomT(this.chapterData.baseElementTypes) type = Tool.randomT(baseElementTypes)
} }
} }
} }
} }
//随机 //随机
else { else {
type = Tool.randomT(this.chapterData.baseElementTypes) type = Tool.randomT(baseElementTypes)
} }
} }
let ele = Tool.getElement(type); let ele = Tool.getElement(type);
ele.effectType = effectType; ele.effectType = effectType;
//没有特效的时候,考虑加气泡
if (effectType == null &&
this.chapterData.bubbleProbability &&
Math.random() < this.chapterData.bubbleProbability) {
ele.setState(StateType.BUBBLE, true, type)
}
return ele; return ele;
} }
...@@ -1621,108 +1630,111 @@ export default class MainScene extends Scene { ...@@ -1621,108 +1630,111 @@ export default class MainScene extends Scene {
this.eliminate(); this.eliminate();
}, 200) }, 200)
} else { } else {
//执行掉落 //没有可消除元素,执行掉落
setTimeout(() => { setTimeout(() => {
this.fall(() => { this.fall(() => {
//掉落后有消除 //掉落停止回调
if (this.threeMatch()) { this.fallCallback();
this.eliminate()
return
}
//鸡蛋的操作,无鸡蛋,或鸡蛋无小鸡 直接执行回调,
//有小鸡飞出要走threeMatch,有eliminate,没有直接走回调
AiControl.ins.eggMotion(this, () => {
//如果早已通关,正在结算
if (this.hasPassed) {
//如果原先特效还有,
if (!this.isCountingTime) {
this.terminateSteps();
}
//如果只有步数转化的,不能再进结算,
else {
//通关了
//提交分数等
var json = this.getSubmitJson()
this.submit(json)
}
return
}
//判断是否已达目标
this.hasPassed = this.judgePass();
// console.log(this.hasPassed)
//如果已达目标
if (this.hasPassed) {
//通关就不允许退出按钮
this.quitBtn.touchEnabled = false;
//连消基数为1
this.commonContinuityTimes = 1;
this.effectContinuityTimes = 1;
if (movieClips["bonusTime"]) {
this.addChild(movieClips["bonusTime"])
movieClips["bonusTime"].gotoAndPlay(1, true)
setTimeout(() => {
this.terminateSteps();
if (movieClips["bonusTime"].parent) {
this.removeChild(movieClips["bonusTime"])
}
}, 1930)
} else {
this.addChild(this.bonusTime);
this.bonusTime.play(() => {
this.removeChild(this.bonusTime)
this.terminateSteps();
})
}
return
}
//出累计一步分数的toast;
this.oneStepScoreToast();
//连消置0
this.commonContinuityTimes = 0;
this.effectContinuityTimes = 0;
//判断步数是否为0;
if (this.steps == 0) {
//失败弹框
playSound(SoundType.fail);
PanelCtrl.instance.show("failed", { level: this.chapter });
return
}
//额外加一步ai果冻的操作,然后再执行检查死图
AiControl.ins.jellyMotion(this, () => {
//检查死图
this.warningCop = Tool.dieMapCheck(this.lattices);
if (!this.warningCop) {
//检查一边是否已死
if (Tool.alreadyDie(this.lattices)) {
showToast("元素已无法消除")
setTimeout(() => {
playSound(SoundType.fail);
PanelCtrl.instance.show("failed", { level: this.chapter });
}, 1000)
} else {
//死图。替换顺序,出toast
showToast("没有可以消除的元素")
// PanelCtrl.instance.show(ModuleTypes.TOAST_PANEL, { msg: "没有可以消除的元素", isHideMask: true })
setTimeout(() => {
this.upsetElement()
}, 1000)
}
} else {
//如果还有游戏引导
if (this.gameGuide) {
this.addChild(this.gameGuide)
this.gameGuide.show()
};
//允许移动
this.enableMouseEvt(true)
}
})
})
}); });
}, 200) }, 200)
} }
} }
/**
* 掉落完后的操作
*/
fallCallback() {
//掉落后有消除,执行消除
if (this.threeMatch()) {
this.eliminate()
return
}
//鸡蛋的ai操作
AiControl.ins.eggMotion(this, () => {
//如果早已通关,正在结算
if (this.hasPassed) {
//如果原先特效还有,
if (!this.isCountingTime) {
this.terminateSteps();
}
//如果只有步数转化的,不能再进结算,
else {
//通关了
//提交分数等
var json = this.getSubmitJson()
this.submit(json)
}
return
}
//判断是否已达目标
this.hasPassed = this.judgePass();
// console.log(this.hasPassed)
//如果已达目标
if (this.hasPassed) {
//连消基数为1
this.commonContinuityTimes = 1;
this.effectContinuityTimes = 1;
if (movieClips["bonusTime"]) {
this.addChild(movieClips["bonusTime"])
movieClips["bonusTime"].gotoAndPlay(1, true)
setTimeout(() => {
this.terminateSteps();
if (movieClips["bonusTime"].parent) {
this.removeChild(movieClips["bonusTime"])
}
}, 1930)
} else {
this.addChild(this.bonusTime);
this.bonusTime.play(() => {
this.removeChild(this.bonusTime)
this.terminateSteps();
})
}
return
}
//出累计一步分数的toast;
this.oneStepScoreToast();
//连消置0
this.commonContinuityTimes = 0;
this.effectContinuityTimes = 0;
//判断步数是否为0;
if (this.steps == 0) {
//失败弹框
playSound(SoundType.fail);
PanelCtrl.instance.show("failed", { level: this.chapter });
return
}
//额外加一步ai果冻的操作,然后再执行检查死图
AiControl.ins.jellyMotion(this, () => {
//检查死图
this.warningCop = Tool.dieMapCheck(this.lattices);
if (!this.warningCop) {
//检查一边是否已死
if (Tool.alreadyDie(this.lattices)) {
showToast("元素已无法消除")
setTimeout(() => {
playSound(SoundType.fail);
PanelCtrl.instance.show("failed", { level: this.chapter });
}, 1000)
} else {
//死图。替换顺序,出toast
showToast("没有可以消除的元素")
// PanelCtrl.instance.show(ModuleTypes.TOAST_PANEL, { msg: "没有可以消除的元素", isHideMask: true })
setTimeout(() => {
this.upsetElement()
}, 1000)
}
} else {
//如果还有游戏引导
if (this.gameGuide) {
this.addChild(this.gameGuide)
this.gameGuide.show()
};
//允许移动
this.enableMouseEvt(true)
}
})
})
}
/** /**
* 特效元素的组合效果 * 特效元素的组合效果
*/ */
......
...@@ -65,7 +65,7 @@ export default class MapScene extends Scene { ...@@ -65,7 +65,7 @@ export default class MapScene extends Scene {
} }
// 邀请有礼角标倒计时 // 邀请有礼角标倒计时
private timer: egret.Timer; private inviteTimer: egret.Timer;
private cutTime: number; private cutTime: number;
async start(data?) { async start(data?) {
...@@ -294,6 +294,10 @@ export default class MapScene extends Scene { ...@@ -294,6 +294,10 @@ export default class MapScene extends Scene {
if(this['pic']) if(this['pic'])
egret.Tween.removeTweens(this['pic']); egret.Tween.removeTweens(this['pic']);
if(this.inviteTimer){
this.inviteTimer.stop();
this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this);
}
} }
getScrollV(lastOrder, stageHeight) { getScrollV(lastOrder, stageHeight) {
...@@ -542,8 +546,8 @@ export default class MapScene extends Scene { ...@@ -542,8 +546,8 @@ export default class MapScene extends Scene {
return; return;
} }
let flag = res.data.completeFlag; let flag = res.data.completeFlag;
if(this.timer) { if(this.inviteTimer) {
this.timer.stop(); this.inviteTimer.stop();
} }
switch(true) { switch(true) {
case (flag == 0): // 未完成 显示倒计时 case (flag == 0): // 未完成 显示倒计时
...@@ -551,10 +555,10 @@ export default class MapScene extends Scene { ...@@ -551,10 +555,10 @@ export default class MapScene extends Scene {
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
this["inviteTips"].visible = true; this["inviteTips"].visible = true;
this.cutTime = res.data.endTime - res.data.sysTime + 5000; this.cutTime = res.data.endTime - res.data.sysTime + 5000;
this.timer = new egret.Timer(1000, 0); this.inviteTimer = new egret.Timer(1000, 0);
this.timer.addEventListener(egret.TimerEvent.TIMER, this.cutTimer, this); this.inviteTimer.addEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this);
this.timer.start(); this.inviteTimer.start();
this.cutTimer(); this.inviteCutTimer();
break; break;
case (flag == 1): // 完成未开奖 待领奖 显示待领奖 case (flag == 1): // 完成未开奖 待领奖 显示待领奖
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
...@@ -590,12 +594,12 @@ export default class MapScene extends Scene { ...@@ -590,12 +594,12 @@ export default class MapScene extends Scene {
// 倒计时 // 倒计时
private cutTimer() { private inviteCutTimer() {
let timer = this.convertTime(this.cutTime -= 1000); let timer = this.convertTime(this.cutTime -= 1000);
if(timer.hour === "00" if(timer.hour === "00"
&& timer.min === "00" && timer.min === "00"
&& timer.sec === "00") { && timer.sec === "00") {
this.timer.stop(); this.inviteTimer.stop();
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
} }
this["inviteTips"].text = `${timer.hour}:${timer.min}:${timer.sec}`; this["inviteTips"].text = `${timer.hour}:${timer.min}:${timer.sec}`;
...@@ -642,7 +646,7 @@ export default class MapScene extends Scene { ...@@ -642,7 +646,7 @@ export default class MapScene extends Scene {
////////////////////////////////////////////////// 大转盘 ////////////////////////////////////////////////// ////////////////////////////////////////////////// 大转盘 //////////////////////////////////////////////////
onTap_turnTableBtn() { onTap_turnTableBtn() {
PanelCtrl.instance.show('turnTable')
} }
protected initEvents() { protected initEvents() {
......
...@@ -184,6 +184,14 @@ export default class InvitePanel extends Panel { ...@@ -184,6 +184,14 @@ export default class InvitePanel extends Panel {
return 'Invite' return 'Invite'
} }
destroy() {
super.destroy();
if(this.timer){
this.timer.stop();
this.timer.removeEventListener(egret.TimerEvent.TIMER, this.cutTimer, this);
}
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -5,11 +5,11 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -5,11 +5,11 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { iswx } from "../iswx"; import { iswx } from "../iswx";
import Utils from "../Utils"; import Utils from "../Utils";
import ScratchRulePanel from "./ScratchRulePanel"; import ScratchRulePanel from "./ScratchRulePanel";
import CutTime from "../CutTime"; import CutTimer from "../CutTimer";
export default class ScratchPanel extends Panel { export default class ScratchPanel extends Panel {
private invite_img: egret.Texture; private invite_img: egret.Texture;
private cutTimer: CutTime; private cutTimer: CutTimer;
constructor(data) { constructor(data) {
super(); super();
...@@ -122,11 +122,11 @@ export default class ScratchPanel extends Panel { ...@@ -122,11 +122,11 @@ export default class ScratchPanel extends Panel {
this["list"].dataProvider = new eui.ArrayCollection(this.data.invitationUser); this["list"].dataProvider = new eui.ArrayCollection(this.data.invitationUser);
// 倒计时 // 倒计时
this.cutTimer = new CutTime(this["cutTimeLabel"], "将在hh:mm:ss后消失", () => { this.cutTimer = new CutTimer(this["cutTimeLabel"], "将在hh:mm:ss后消失", () => {
this.hidePanel(); this.hidePanel();
} }
); );
let cutTime = this.data.endTime - this.data.sysTime + 5000; let cutTime = this.data.endTime - this.data.sysTime + 3000;
if(!this.cutTimer.start(cutTime)) { if(!this.cutTimer.start(cutTime)) {
this.cutTimer.stop(); this.cutTimer.stop();
this.cutTimer.start(cutTime); this.cutTimer.start(cutTime);
...@@ -167,6 +167,11 @@ export default class ScratchPanel extends Panel { ...@@ -167,6 +167,11 @@ export default class ScratchPanel extends Panel {
}); });
} }
destroy() {
super.destroy();
this.cutTimer.stop();
}
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
return [this['closeBtn']] return [this['closeBtn']]
} }
......
let RotaryData = {
key: [
],
data: {
}
};
export default RotaryData;
import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
import { DataManager } from "../../../libs/tw/manager/DataManager";
import RotaryData from './RotaryData';
import Panel from "../../../libs/new_wx/components/Panel";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../../libs/new_wx/types/sceneTypes";
import hdGameDoDojoin from "../../../libs/new_tw/ctrls/hdGameDoDojoin";
import submit from "../../../libs/new_tw/ctrls/submit";
import Loading from "../../../libs/new_wx/components/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import Utils from "../../Utils";
export default class TurntablePanel extends Panel {
public panel:eui.Group;
public start_btn:eui.Button;
public closeBtn:eui.Button;
public get skinKey() {
return 'TurntablePanel'
}
constructor(data?) {
super();
this.data = data;
}
start(data?) {
super.start();
}
initEvents() {
super.initEvents();
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
GDispatcher.addEvent('queryPrize', this.queryPrize, this);
GDispatcher.addEvent('panelEffect', this.panelEffect, this);
}
onTouchTap_closeBtn() {
console.log(1111);
super.onTouchTap_closeBtn();
}
removeEvents() {
super.removeEvents();
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
GDispatcher.removeEvent('queryPrize', this.queryPrize, this);
GDispatcher.removeEvent('panelEffect', this.panelEffect, this);
}
onTapStart() {
this.setBtnTouch(false); // 锁定按钮
Loading.instace.show();
GDispatcher.dispatchEvent('queryPrize');
}
// 设置全部按钮是否可以点击
private setBtnTouch(touchEnabled: boolean) {
this.start_btn.touchEnabled = touchEnabled;
}
/**
* 开始抽奖
*/
private queryPrize() {
egret.Tween.removeTweens(this.panel);
this.doJoin();
}
/**
* 开始游戏
*/
private doJoin() {
/////////////////////////////////////////// 开始转盘并查询奖品 ///////////////////////////////////////////
// hdGameDoDojoin((success, res) => {
//
// if(!success) {
// Loading.instace.hide();
// this.setBtnTouch(true);
// return;
// }
// submit((success, res) => {
// Loading.instace.hide();
// if(!success) {
// this.setBtnTouch(true);
// return;
// }
// // if(!res.lottery || res.lottery.type == 'thanks') {
// // PanelCtrl.instance.show(ModuleTypes.GAME_FAIL_NO_PRIZE_PANEL);
// // } else {
// // PanelCtrl.instance.show(ModuleTypes.GAME_FAIL_PRIZE_PANEL, res.lottery);
// // }
// this.rotateByPrize(res.lotteryId, () => {
// if(!res.lottery || res.lottery.type == 'thanks') { // 如果未中奖
// PanelCtrl.instance.show(ModuleTypes.NO_PRIZE_PANEL);
// this.setBtnTouch(true); // 开启按钮
// } else {
// PanelCtrl.instance.show(ModuleTypes.PRIZE_PANEL, res.lottery);
// GDispatcher.dispatchEvent('getCount'); // 更新免费抽奖次数
// this.setBtnTouch(true); // 开启按钮
// }
// });
// }, 2);
// });
}
/**
* 根据奖项转转盘
* @param prizeId
* @param callFun - 缓动回调
*/
private rotateByPrize(prizeId, callFun: Function) {
egret.Tween.removeTweens(this.panel);
// let key = RotaryData.key[prizeId]; // 转盘数据的key
let index = ~~(Math.random() * RotaryData.data[prizeId].length);
let rs = RotaryData.data[prizeId][index]; // 奖品在转盘上的范围
let r = Utils.Random(rs.start, rs.end) + Utils.RandomInt(9, 15) * 360;
let t = Utils.Random(5000, 8000);
this.rotate(r, t, callFun);
}
/**
* 开始一次旋转
* @param rotation - 角度
* @param time - 时间
* @param callFun - 缓动回调
*/
private rotate(rotation: number, time: number, callFun: Function) {
let tw = egret.Tween.get(this.panel);
tw.to({rotation: rotation}, time, egret.Ease.cubicInOut).wait(500).call(callFun);
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.onLoad();
}
protected onLoad(): void {
this.initUI();
}
private initUI(): void {
this.getPrizeInfo(); // 查询奖品
this.initEffect();
}
private initEffect() {
this.panelEffect();
}
private panelEffect() {
egret.Tween.get(this.panel).to({rotation: 360}, 20000).call(() => {
this.panelEffect();
});
}
protected async preLoadRes() {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* 获得所有奖品信息
*/
private getPrizeInfo() {
/////////////////////////////////////////// 查询奖品加入转盘数据 ///////////////////////////////////////////
// let data = DataManager.ins.ajaxElementData.options;
// let options = Utils.deepClone(data);
// for(let i = 0; i < options.length; i++) {
// let v = options[i];
// if(v.scoreArea == "1,1") {
// options.splice(i--, 1);
// }
// }
// for(let i = 0; i < options.length; i++) {
// let v = options[i];
// RotaryData.key.push(v.id);
// RotaryData.data[v.id] = [{start: i * 40 - 15, end: i * 40 + 15}];
// this[`img${i}`].source = v.logo;
// this[`lab${i}`].text = v.name;
// }
console.log(RotaryData);
}
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -11,7 +11,7 @@ export const Chapters1: ChapterData[] = [
//1引导基本消除 //1引导基本消除
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -68,7 +68,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -68,7 +68,7 @@ export const Chapters1: ChapterData[] = [
//2引导冰块消除 //2引导冰块消除
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 6, stepCount: 6,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -125,7 +125,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -125,7 +125,7 @@ export const Chapters1: ChapterData[] = [
//3引导石头消除 //3引导石头消除
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 20, stepCount: 20,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -183,7 +183,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -183,7 +183,7 @@ export const Chapters1: ChapterData[] = [
//4 //4
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -243,7 +243,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -243,7 +243,7 @@ export const Chapters1: ChapterData[] = [
//5 直线引导 //5 直线引导
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -307,7 +307,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -307,7 +307,7 @@ export const Chapters1: ChapterData[] = [
//6 //6
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -366,7 +366,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -366,7 +366,7 @@ export const Chapters1: ChapterData[] = [
//7 //7
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -427,7 +427,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -427,7 +427,7 @@ export const Chapters1: ChapterData[] = [
//8 引导爆炸 //8 引导爆炸
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -494,7 +494,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -494,7 +494,7 @@ export const Chapters1: ChapterData[] = [
//9 引导双特效 //9 引导双特效
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 27, stepCount: 27,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -559,7 +559,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -559,7 +559,7 @@ export const Chapters1: ChapterData[] = [
//10 引导魔力鸟 //10 引导魔力鸟
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 27, stepCount: 27,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -628,7 +628,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -628,7 +628,7 @@ export const Chapters1: ChapterData[] = [
//11 //11
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -692,7 +692,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -692,7 +692,7 @@ export const Chapters1: ChapterData[] = [
//12 //12
{ {
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -764,7 +764,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -764,7 +764,7 @@ export const Chapters1: ChapterData[] = [
//13 //13
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -826,7 +826,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -826,7 +826,7 @@ export const Chapters1: ChapterData[] = [
//14 //14
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -888,7 +888,7 @@ export const Chapters1: ChapterData[] = [ ...@@ -888,7 +888,7 @@ export const Chapters1: ChapterData[] = [
//15 //15
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 28, stepCount: 28,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -945,10 +945,10 @@ export const Chapters1: ChapterData[] = [ ...@@ -945,10 +945,10 @@ export const Chapters1: ChapterData[] = [
], ],
}, },
}, },
//aaaaa //16
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0, bubbleProbability: 0,
stepCount: 27, stepCount: 27,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: PassType.ELEMENT_TARGET,
...@@ -962,15 +962,15 @@ export const Chapters1: ChapterData[] = [ ...@@ -962,15 +962,15 @@ export const Chapters1: ChapterData[] = [
starScores: [4000, 8000, 12000], starScores: [4000, 8000, 12000],
map: { map: {
lattices: [ lattices: [
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 2, 2, 2, 1, 1, 0,
1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 2, 2, 2, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0,
], ],
elements: [ elements: [
0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0,
...@@ -1000,5 +1000,249 @@ export const Chapters1: ChapterData[] = [ ...@@ -1000,5 +1000,249 @@ export const Chapters1: ChapterData[] = [
{ index: 5, type: [0], cus: [] }, { index: 5, type: [0], cus: [] },
], ],
}, },
} },
//17 引导棒棒糖
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 27,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.LOLLIPOP,
count: 4
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
elements: [
0, 1, 3, 1, 3, 1, 3, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 2, 2, 2, 3, 2, 2, 2, 0,
0, 2, 2, 2, 1, 2, 2, 2, 0,
0, 2, 2, 1, 1, 1, 2, 2, 0,
0, 2, 2, 2, 1, 2, 2, 2, 0,
0, 2, 2, 2, 1, 2, 2, 2, 0,
0, 2, 2, 1, 1, 1, 2, 2, 0,
0, 0, 2, 2, 1, 2, 2, 0, 0,
],
baseElements: [
0, 10, 3, 10, 3, 10, 3, 10, 0,
0, 20, 30, 20, 30, 20, 30, 20, 0,
0, 2, 2, 2, 3, 2, 2, 2, 0,
0, 2, 2, 2, 20, 2, 2, 2, 0,
0, 2, 2, 20, 30, 40, 2, 2, 0,
0, 2, 2, 2, 20, 2, 2, 2, 0,
0, 2, 2, 2, 30, 2, 2, 2, 0,
0, 2, 2, 40, 20, 30, 2, 2, 0,
0, 0, 2, 2, 30, 2, 2, 0, 0,
],
generateLats: [
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 1, type: [0], cus: [] },
{ index: 2, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 7, type: [0], cus: [] },
],
recycles: [74, 75, 76, 77, 78, 70, 64]
},
},
//18
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 28,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.LOLLIPOP,
count: 4
},
]
},
starScores: [4000, 8000, 12000],
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, 0, 0, 1, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 0,
],
elements: [
0, 0, 1, 3, 1, 3, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 2, 2, 1, 2, 2, 1, 1,
1, 1, 2, 2, 1, 2, 2, 1, 1,
1, 1, 0, 0, 1, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 1, 1, 1, 1, 1, 2, 2,
0, 2, 1, 1, 1, 1, 1, 2, 0,
0, 2, 1, 1, 1, 1, 1, 2, 0,
],
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,
],
generateLats: [
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 2, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
],
recycles: [54, 62, 73, 74, 75, 76, 77, 78, 79],
connectedLats: [[29, 47], [30, 48], [32, 50], [33, 51]]
},
},
//19
{
baseElementTypes: [0, 1, 2, 4],
bubbleProbability: 0,
stepCount: 28,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 33
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 2, 1, 1, 1, 1, 1, 2, 1,
1, 2, 1, 3, 3, 3, 1, 2, 1,
1, 2, 1, 3, 3, 3, 1, 2, 1,
1, 2, 1, 3, 3, 3, 1, 2, 1,
1, 2, 1, 1, 1, 1, 1, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
],
elements: [
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 1, 1,
1, 1, 2, 0, 0, 0, 2, 1, 1,
1, 1, 2, 0, 0, 0, 2, 1, 1,
1, 1, 2, 0, 0, 0, 2, 1, 1,
1, 1, 2, 2, 2, 2, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 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,
],
generateLats: [
{ index: 0, type: [0], cus: [] },
{ index: 1, type: [0], cus: [] },
{ index: 2, type: [0], cus: [] },
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 7, type: [0], cus: [] },
{ index: 8, type: [0], cus: [] },
],
},
},
//20
{
baseElementTypes: [0, 1, 2, 4],
bubbleProbability: 0,
stepCount: 32,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.LOLLIPOP,
count: 4
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 1, 0, 1, 0, 1, 0, 0, 0,
1, 0, 1, 0, 1, 0, 1, 0, 0,
0, 1, 0, 1, 0, 1, 0, 0, 0,
1, 0, 1, 0, 1, 0, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1,
],
elements: [
0, 3, 0, 3, 0, 3, 0, 0, 0,
2, 0, 2, 0, 2, 0, 2, 0, 0,
0, 2, 0, 2, 0, 2, 0, 0, 0,
2, 0, 2, 0, 2, 0, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 1, 2, 1, 2, 1, 2, 0, 1,
1, 2, 1, 2, 1, 2, 1, 0, 1,
],
baseElements: [
0, 3, 0, 3, 0, 3, 0, 0, 0,
2, 0, 2, 0, 2, 0, 2, 0, 0,
0, 2, 0, 2, 0, 2, 0, 0, 0,
2, 0, 2, 0, 2, 0, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0,
2, 22, 2, 22, 2, 22, 2, 0, 13,
22, 2, 22, 2, 22, 2, 22, 0, 11,
],
generateLats: [
{ index: 1, type: [0], cus: [] },
{ index: 3, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 71, type: [0], cus: [] },
{ index: 37, type: [0], cus: [] },
{ index: 39, type: [0], cus: [] },
{ index: 41, type: [0], cus: [] },
],
recycles: [72, 73, 74, 77, 75, 76, 78]
},
},
] ]
\ No newline at end of file
...@@ -8,31 +8,255 @@ import { ElementType } from "../enum/ElementType"; ...@@ -8,31 +8,255 @@ import { ElementType } from "../enum/ElementType";
export const Chapters2: ChapterData[] = [ export const Chapters2: ChapterData[] = [
//21 //21
{ {
baseElementTypes: [0, 1, 2, 4],
bubbleProbability: 0,
stepCount: 30,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 56
},
]
},
starScores: [4000, 8000, 12000],
map: { map: {
lattices: [ lattices: [
0, 3, 3, 3, 3, 3, 3, 3, 0,
0, 3, 3, 3, 3, 3, 3, 3, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
1, 1, 1, 0, 0, 0, 1, 1, 1,
],
elements: [
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 2, 1, 1, 1, 1, 1, 2, 0,
0, 2, 1, 1, 1, 1, 1, 2, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 2, 2, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
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,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
generateLats: [
{ index: 1, type: [0], cus: [] },
{ index: 2, type: [0], cus: [] },
{ index: 3, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 5, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 7, type: [0], cus: [] },
],
},
},
//22
{
baseElementTypes: [0, 1, 2, 3],
bubbleProbability: 0,
stepCount: 30,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ROCK,
count: 34
},
{
type: ElementType.CHICKEN,
count: 50
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
],
elements: [
0, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
2, 2, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 2
],
baseElements: [
0, 0, 31, 0, 24, 0, 31, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 20, 31, 20, 0, 0, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0,
2, 2, 30, 2, 2, 2, 2, 2, 2,
2, 2, 2, 30, 2, 2, 2, 2, 2,
2, 2, 2, 2, 30, 2, 2, 2, 2,
2, 2, 2, 2, 2, 30, 2, 2, 2,
2, 2, 2, 2, 2, 2, 30, 2, 2
],
generateLats: [
{ index: 2, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 36, type: [0], cus: [] },
{ index: 37, type: [0], cus: [] },
{ index: 38, type: [0], cus: [] },
{ index: 39, type: [0], cus: [] },
{ index: 41, type: [0], cus: [] },
{ index: 42, type: [0], cus: [] },
{ index: 43, type: [0], cus: [] },
{ index: 44, type: [0], cus: [] },
], ],
// generateLats: , connectedLats: [[2, 21], [4, 22], [6, 23]]
connectedLats: [], },
},
//23
{
baseElementTypes: [0, 1, 2, 3, 4],
bubbleProbability: 0,
stepCount: 22,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [ elements: [
{
type: ElementType.LOLLIPOP,
count: 12
},
] ]
}, },
starScores: [4000, 8000, 12000],
map: {
lattices: [
0, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
],
elements: [
0, 0, 3, 0, 3, 0, 3, 0, 0,
0, 0, 3, 0, 3, 0, 3, 0, 0,
0, 1, 2, 1, 2, 1, 2, 1, 0,
0, 1, 2, 1, 2, 1, 2, 1, 0,
0, 1, 2, 1, 2, 1, 2, 1, 0,
0, 1, 2, 1, 2, 1, 2, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0,
],
baseElements: [
0, 0, 3, 0, 3, 0, 3, 0, 0,
0, 0, 3, 0, 3, 0, 3, 0, 0,
0, 10, 2, 30, 2, 20, 2, 10, 0,
0, 30, 2, 30, 2, 20, 2, 10, 0,
0, 20, 2, 20, 2, 10, 2, 30, 0,
0, 10, 2, 20, 2, 10, 2, 20, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
40, 40, 50, 40, 50, 40, 50, 40, 40,
0, 50, 40, 50, 40, 50, 40, 50, 0,
],
generateLats: [
{ index: 2, type: [0], cus: [] },
{ index: 4, type: [0], cus: [] },
{ index: 6, type: [0], cus: [] },
{ index: 63, type: [0], cus: [] },
{ index: 64, type: [0], cus: [] },
{ index: 65, type: [0], cus: [] },
{ index: 66, type: [0], cus: [] },
{ index: 67, type: [0], cus: [] },
{ index: 68, type: [0], cus: [] },
{ index: 69, type: [0], cus: [] },
{ index: 70, type: [0], cus: [] },
{ index: 71, type: [0], cus: [] },
],
recycles: [46, 47, 48, 49, 50, 51, 52]
},
},
//24
{
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1, bubbleProbability: 0,
stepCount: 30, stepCount: 27,
passTarget: { passTarget: {
type: PassType.SCORE_TARGET, type: PassType.ELEMENT_TARGET,
score: 6000, elements: [
{
type: ElementType.ICE,
count: 31
},
]
},
starScores: [4000, 8000, 12000],
map: {
lattices: [
2, 0, 2, 2, 1, 0, 3, 3, 3,
2, 0, 0, 0, 0, 0, 3, 3, 3,
0, 0, 0, 0, 0, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
0, 0, 1, 1, 1, 0, 3, 3, 3,
],
elements: [
1, 0, 2, 2, 2, 0, 2, 0, 2,
1, 0, 0, 0, 0, 0, 2, 0, 2,
0, 0, 0, 0, 0, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 0, 2, 0,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
],
baseElements: [
11, 0, 2, 2, 2, 0, 2, 0, 2,
23, 0, 0, 0, 0, 0, 2, 0, 2,
0, 0, 0, 0, 0, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 0, 2, 0,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
0, 0, 2, 2, 2, 0, 2, 0, 2,
],
generateLats: [
{ index: 0, type: [0], cus: [] },
{ index: 2, type: [0], cus: [33] },
{ index: 3, type: [0], cus: [21] },
{ index: 4, type: [0], cus: [] },
],
connectedLats: [[2, 29], [3, 30], [4, 31], [74, 6], [75, 7], [76, 8]]
}, },
starScores: [2000, 4000, 6000]
}, },
] ]
\ No newline at end of file
...@@ -5,7 +5,7 @@ import { ChapterData } from "../interface/ChapterData"; ...@@ -5,7 +5,7 @@ import { ChapterData } from "../interface/ChapterData";
//所有的关卡 //所有的关卡
const chapters: ChapterData[] = [].concat( const chapters: ChapterData[] = [].concat(
Chapters1, Chapters1,
// Chapters2, Chapters2,
) )
/** /**
* 获取关卡数据,返回关卡数据 * 获取关卡数据,返回关卡数据
......
...@@ -4,6 +4,8 @@ import { ElementType } from "../enum/ElementType"; ...@@ -4,6 +4,8 @@ import { ElementType } from "../enum/ElementType";
/** /**
* 关卡数据接口 * 关卡数据接口
* ,,注意有些带数组的数据,避免被修改,需要用slice克隆操作
* 比如基础元素类型,定制掉落数组
*/ */
export interface ChapterData { export interface ChapterData {
/** /**
...@@ -12,12 +14,13 @@ export interface ChapterData { ...@@ -12,12 +14,13 @@ export interface ChapterData {
map: MapData; map: MapData;
/** /**
* 基础元素数量3-5,种类是否随机 * 基础元素数量3-5,种类是否随机
* 基础类型和ElementType一致 0到4
*/ */
baseElementTypes: ElementType[]; baseElementTypes: ElementType[];
/** /**
* 初始特效生成几率5-20% * 气泡生成概率0到1
*/ */
effectInitProbability: number; bubbleProbability?: number;
/** /**
* 总步数 * 总步数
*/ */
......
...@@ -56,7 +56,7 @@ export interface MapData { ...@@ -56,7 +56,7 @@ export interface MapData {
/** /**
* 棒棒糖回收口 * 棒棒糖回收口
* * 格子索引
*/ */
recycles?: number[]; recycles?: number[];
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import { ChickenEgg } from "../class/ChickenEgg"; ...@@ -9,6 +9,7 @@ import { ChickenEgg } from "../class/ChickenEgg";
import { HatchAni } from "../anis/HatchAni"; import { HatchAni } from "../anis/HatchAni";
import { PieceToEggAni } from "../anis/PieceToEggAni"; import { PieceToEggAni } from "../anis/PieceToEggAni";
import { StateType } from "../enum/StateType"; import { StateType } from "../enum/StateType";
import { BubbleAni } from "../anis/BubbleAni";
//孵鸡的数量 //孵鸡的数量
const chickenNum: number = 4 const chickenNum: number = 4
...@@ -38,7 +39,7 @@ export class AiControl { ...@@ -38,7 +39,7 @@ export class AiControl {
/** /**
* 用于判断格子中 * 用于判断格子中
* 是否有果冻, * 是否有果冻,
* 是否有鸡蛋, * 是否有鸡蛋,所有带鸡蛋的格子的索引
* 是否有毛球, * 是否有毛球,
* 是否有变色气泡, * 是否有变色气泡,
* 必须在初始化元素后执行,每关进入游戏都会初始化 * 必须在初始化元素后执行,每关进入游戏都会初始化
...@@ -223,9 +224,12 @@ export class AiControl { ...@@ -223,9 +224,12 @@ export class AiControl {
indexs.push(i); indexs.push(i);
} }
} }
//没有气泡,直接回调,
if (!indexs.length) { if (!indexs.length) {
//标记无气泡
this.hasBubble = false;
callback();
return
} }
let count = 0; let count = 0;
let countAll = indexs.length; let countAll = indexs.length;
...@@ -234,16 +238,26 @@ export class AiControl { ...@@ -234,16 +238,26 @@ export class AiControl {
let index = indexs[a]; let index = indexs[a];
let lat = thisObj.lattices[index]; let lat = thisObj.lattices[index];
let ele = lat.element; let ele = lat.element;
let fromType= ele.type;
//计算type //计算type
let type: ElementType = 1; let type: ElementType = 1;
//直接重置类型,为了后续计算,但是要隐藏,待动画播放完显示 //直接重置类型,为了后续计算,但是要隐藏,待动画播放完显示
ele.resetType(type); ele.resetType(type);
ele.visible = false; ele.visible = false;
///重写 //变色动画
ele.getState(StateType.BUBBLE).play(type, () => { let bubbleAni: BubbleAni = Pool.takeOut(RecoverName.JELLYSPREAD_ANI)
if (!bubbleAni) {
//播完重置类型 bubbleAni = new BubbleAni()
ele.resetType(type) }
//位置信息
var p = Tool.getPositionByIndex(index);
bubbleAni.x = p[0];
bubbleAni.y = p[1];
thisObj.addChild(bubbleAni);
//播放动画
bubbleAni.play(fromType,type, () => {
//显示
ele.visible = true;
count++; count++;
if (count == countAll) { if (count == countAll) {
callback(); callback();
...@@ -339,6 +353,8 @@ function judgeSpread(index: number, lattices: Lattice[]): number { ...@@ -339,6 +353,8 @@ function judgeSpread(index: number, lattices: Lattice[]): number {
return null return null
} }
// function getBubble
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"invitationId": "活动id", "invitationId": "活动id",
"invitationCount": 5, "invitationCount": 5,
"img": "http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg", "img": "http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg",
"sysTime": 1570673805000, "sysTime": 1570673808000,
"endTime": 1570673810000, "endTime": 1570673810000,
"invitationUser": [ "invitationUser": [
{ {
......
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