Commit 8e17097d authored by wjf's avatar wjf

l

parent b4165376
...@@ -22,3 +22,4 @@ ...@@ -22,3 +22,4 @@
# doc/*.txt # doc/*.txt
# 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt
node_modules node_modules
bin-release
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -6,7 +6,6 @@ import wait from "../../new_tc/wait"; ...@@ -6,7 +6,6 @@ import wait from "../../new_tc/wait";
import { DataManager } from "../../tw/manager/DataManager"; import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager"; import { NetManager } from "../../tw/manager/NetManager";
import Panel from "./Panel"; import Panel from "./Panel";
import { handleVideo } from "../../../src/myVideo/videoCtrl";
import Loading from "./Loading"; import Loading from "./Loading";
import { showToast } from "../ctrls/toastCtrl"; import { showToast } from "../ctrls/toastCtrl";
export default class PrizePanel extends Panel { export default class PrizePanel extends Panel {
...@@ -73,38 +72,28 @@ export default class PrizePanel extends Panel { ...@@ -73,38 +72,28 @@ export default class PrizePanel extends Panel {
//新增看视频双倍 //新增看视频双倍
this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(6)) NetManager.ins.clickLog(getlogItem(6))
handleVideo( NetManager.ins.getTuiaAd(
(s) => {
if (s) {
//居中
this['goBtn'].horizontalCenter = 0;
//隐藏
this['doubleBtn'].visible = false;
Loading.instace.show()
NetManager.ins.getIncentiveAward(
(s) => {
Loading.instace.hide()
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
}, window['collectRuleId']);
} else {
showToast("加倍失败");
}
},
25
)
} else {
showToast("广告未成功观看,无法加倍领取");
}
},
() => { () => {
//居中
this['goBtn'].horizontalCenter = 0;
//隐藏
this['doubleBtn'].visible = false;
Loading.instace.show()
NetManager.ins.getIncentiveAward( NetManager.ins.getIncentiveAward(
() => { }, (s) => {
Loading.instace.hide()
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
}, window['collectRuleId']);
} else {
showToast("加倍失败");
}
},
25 25
) )
}, },
window["slotid"] () => { showToast("广告未成功观看,无法加倍领取"); }
) )
}, this) }, this)
} }
......
...@@ -94,15 +94,34 @@ export class NetManager extends ABNetManager { ...@@ -94,15 +94,34 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
/**
public getTuiaAd(rewardFn, closeFn) { *
* @param rewardFn 已完成活动,执行
* @param closeFn 未完成关闭
* @param comCloseFn 已完成活动,返回的提示,一般是toast或游戏内的逻辑,暂不用
*/
public getTuiaAd(rewardFn: Function, closeFn: Function/*, comCloseFn?*/) {
this['tuiaRewardMark'] = false;
let _rewardFn = () => {
// rewardFn();
//这里只标记吧,下面返回再执行
this['tuiaRewardMark'] = true;
console.log("观看成功")
}
let _closeFn = () => {
if (!this['tuiaRewardMark']) {
closeFn();
} else {
rewardFn();
}
}
window["TAIsdk"].init({ window["TAIsdk"].init({
appKey: window["appKeyTuia"] || '2ZjLbhEBCFAzBbihEtxLEq25mXKw',//固定,到时修改 appKey: window["appKeyTuia"] || '2ZjLbhEBCFAzBbihEtxLEq25mXKw',//固定,到时修改
slotId: window["slotIdTuia"] || '324689', //到时修改 slotId: window["slotIdTuia"] || '324689', //到时修改
deviceId: getUrl('deviceId'), deviceId: getUrl('deviceId'),
userId: window["CFG"].uid, userId: window["CFG"].uid,
rewardCallback: rewardFn, rewardCallback: _rewardFn,
closeCallback: closeFn, closeCallback: _closeFn,
extParams: {}, extParams: {},
debug: false, debug: false,
// newWebviewFn: newWebview, // newWebviewFn: newWebview,
......
...@@ -707,6 +707,12 @@ export default class MainScene extends Scene { ...@@ -707,6 +707,12 @@ export default class MainScene extends Scene {
Tool.removeEle(i, this.emptys); Tool.removeEle(i, this.emptys);
} }
} }
//针对如果地图没有棒棒糖0,但是通关目标有,需要标记生成
if (this.passElements &&
this.passElements[ElementType.LOLLIPOP] &&
!this.lollipopCount) {
this.lollipopMark = true
}
} }
} }
//重置基础元素及特效类型 //重置基础元素及特效类型
...@@ -2079,9 +2085,7 @@ export default class MainScene extends Scene { ...@@ -2079,9 +2085,7 @@ export default class MainScene extends Scene {
this.magicRotateData = [rotateData]; this.magicRotateData = [rotateData];
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if (Tool.judgeBaseEle(lat) && //是基础元素 if (Tool.judgeMagicEliminate(lat) &&
!lat.doorClosed &&//石门非关闭状态
lat.element.effectType != EffectType.MAGICLION && //不能是魔力鸟特效
lat.element.type == other.type //类型相等 lat.element.type == other.type //类型相等
) { ) {
//一个魔力鸟时其实不用加,因为石头或果冻的不会进入判断 //一个魔力鸟时其实不用加,因为石头或果冻的不会进入判断
...@@ -2350,9 +2354,7 @@ export default class MainScene extends Scene { ...@@ -2350,9 +2354,7 @@ export default class MainScene extends Scene {
this.magicRotateData.push(rotateData); this.magicRotateData.push(rotateData);
//对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除 //对于魔力鸟的效果有不一样的,旋转,该组元素要旋转消除
for (var i = 0; i < this.lattices.length; i++) { for (var i = 0; i < this.lattices.length; i++) {
if (Tool.judgeBaseEle(this.lattices[i]) && //是基础元素 if (Tool.judgeMagicEliminate(this.lattices[i]) &&
!this.lattices[i].doorClosed &&//石门非关闭状态
this.lattices[i].element.effectType != EffectType.MAGICLION && //不是魔力鸟
this.lattices[i].element.type == type //类型相等 this.lattices[i].element.type == type //类型相等
) { ) {
if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) { if (this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) {
...@@ -2823,7 +2825,7 @@ export default class MainScene extends Scene { ...@@ -2823,7 +2825,7 @@ export default class MainScene extends Scene {
for (let i = 0; i < indexs.length; i++) { for (let i = 0; i < indexs.length; i++) {
let index = indexs[i]; let index = indexs[i];
let lat = this.lattices[index]; let lat = this.lattices[index];
if (lat && lat.element && checkFun(lat) && !lat.doorClosed) { if (lat && lat.element && !lat.doorClosed && checkFun(lat)) {
//添加进消除队列,注意重复 //添加进消除队列,注意重复
if (this.eliminatedElements.indexOf(index) == -1) this.eliminatedElements.push(index) if (this.eliminatedElements.indexOf(index) == -1) this.eliminatedElements.push(index)
} }
......
...@@ -26,7 +26,6 @@ import MapTopPart from "./MapTopPart"; ...@@ -26,7 +26,6 @@ import MapTopPart from "./MapTopPart";
import RedBagAni, { createRedBagIcon } from "./RedBagAni"; import RedBagAni, { createRedBagIcon } from "./RedBagAni";
import { createEffect2MovieClip } from "../effect/createEffect2"; import { createEffect2MovieClip } from "../effect/createEffect2";
import { NetName } from "../../libs/tw/enum/NetName"; import { NetName } from "../../libs/tw/enum/NetName";
import { handleVideo } from "../myVideo/videoCtrl";
import { getUrl } from "../myVideo/getDefaultConfig"; import { getUrl } from "../myVideo/getDefaultConfig";
let doHelpFlag = false; let doHelpFlag = false;
...@@ -57,75 +56,38 @@ export default class MapScene extends Scene { ...@@ -57,75 +56,38 @@ export default class MapScene extends Scene {
NetManager.ins.getIconInfo((s, res) => { NetManager.ins.getIconInfo((s, res) => {
//成功才显示,且有剩余次数remainAwardTimes //成功才显示,且有剩余次数remainAwardTimes
if (s && res.data && res.data.remainAwardTimes) { if (s && res.data && res.data.remainAwardTimes) {
//领奖类型:0:武汉 1:推啊 this["tuiaGroup"].visible = true;
//武汉 NetManager.ins.showLog(getlogItem(13))
if (res.data.type == 0) { this["tuiaGroup"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this["wuhanGroup"].visible = true; NetManager.ins.clickLog(getlogItem(13))
NetManager.ins.showLog(getlogItem(14)) NetManager.ins.getTuiaAd(
this["wuhanGroup"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { () => {
NetManager.ins.clickLog(getlogItem(14)) Loading.instace.show();
handleVideo( NetManager.ins.getIconAward((succ, ress) => {
(s) => { Loading.instace.hide();
if (s) { if (succ) {
Loading.instace.show(); PanelCtrl.instance.show("DailyIconPrizePanel");
NetManager.ins.getIconAward((succ, ress) => { //如果次数没了就隐藏icon
Loading.instace.hide(); if (!ress.data.remainAwardTimes) {
if (succ) { this["tuiaGroup"].visible = false;
PanelCtrl.instance.show("DailyIconPrizePanel"); }
//如果次数没了就隐藏icon
if (!ress.data.remainAwardTimes) {
this["wuhanGroup"].visible = false;
}
} else {
showToast("领取失败");
}
})
} else { } else {
showToast("广告未成功观看,无法领取奖励"); showToast("领取失败");
} }
}, })
() => { NetManager.ins.getIconAward(() => { }) }, //关闭弹框
window["slotidIcon"] // window['TAIsdk'].iframeNode.remove()
) // setTimeout(function () {
}, this) // window['TAIsdk'].iframeNode.src = ''
} // })
//推啊 // window['TAIsdk'].closeBtn.style.display = 'none'
else if (res.data.type == 1) { },
this["tuiaGroup"].visible = true; () => {
NetManager.ins.showLog(getlogItem(13)) showToast("活动未完成,无法领取奖励");
this["tuiaGroup"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { }
NetManager.ins.clickLog(getlogItem(13)) )
this['tuiaRewardMark'] = false; }, this)
NetManager.ins.getTuiaAd(
() => {
Loading.instace.show();
NetManager.ins.getIconAward((succ, ress) => {
Loading.instace.hide();
if (succ) {
PanelCtrl.instance.show("DailyIconPrizePanel");
//如果次数没了就隐藏icon
if (!ress.data.remainAwardTimes) {
this["tuiaGroup"].visible = false;
}
} else {
showToast("领取失败");
}
})
this['tuiaRewardMark'] = true;
//关闭弹框
// window['TAIsdk'].iframeNode.remove()
// setTimeout(function () {
// window['TAIsdk'].iframeNode.src = ''
// })
// window['TAIsdk'].closeBtn.style.display = 'none'
},
() => {
//上面没回调过。就显示toast
if (!this['tuiaRewardMark']) showToast("活动未完成,无法领取奖励");
}
)
}, this)
}
} }
}) })
......
...@@ -4,7 +4,6 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -4,7 +4,6 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import getHomeData from "../getHomeData"; import getHomeData from "../getHomeData";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import AdSmallComp from "../mapScene/AdSmallComp"; import AdSmallComp from "../mapScene/AdSmallComp";
import { handleVideo } from "../myVideo/videoCtrl";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import Loading from "../../libs/new_wx/components/Loading"; import Loading from "../../libs/new_wx/components/Loading";
import { updateMainTimer } from "../../libs/new_wx/MainBase"; import { updateMainTimer } from "../../libs/new_wx/MainBase";
...@@ -40,39 +39,29 @@ export default class BoxPanel extends Panel { ...@@ -40,39 +39,29 @@ export default class BoxPanel extends Panel {
this['close2Btn'].visible = false; this['close2Btn'].visible = false;
this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(12)) NetManager.ins.clickLog(getlogItem(12))
handleVideo( NetManager.ins.getTuiaAd(
(s) => {
if (s) {
this['close2Btn'].visible = true;
this['doubleBtn'].visible = false;
Loading.instace.show()
NetManager.ins.getIncentiveAward(
(s) => {
Loading.instace.hide()
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
showToast("加倍失败");
this.hidePanel();
}
},
22
)
} else {
showToast("广告未成功观看,无法加倍领取");
}
},
() => { () => {
this['close2Btn'].visible = true;
this['doubleBtn'].visible = false;
Loading.instace.show()
NetManager.ins.getIncentiveAward( NetManager.ins.getIncentiveAward(
() => { }, (s) => {
Loading.instace.hide()
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
showToast("加倍失败");
this.hidePanel();
}
},
22 22
) )
}, },
window["slotid"] () => { showToast("广告未成功观看,无法加倍领取"); },
) )
}, this) }, this)
......
...@@ -2,7 +2,6 @@ import Panel from "../../libs/new_wx/components/Panel"; ...@@ -2,7 +2,6 @@ import Panel from "../../libs/new_wx/components/Panel";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import { addRankFriendList } from "../mapScene/RankFriendList"; import { addRankFriendList } from "../mapScene/RankFriendList";
import { changeMapScene } from "../startScene/StartScene"; import { changeMapScene } from "../startScene/StartScene";
import { handleVideo } from "../myVideo/videoCtrl";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
...@@ -33,17 +32,12 @@ export default class FailedPanel extends Panel { ...@@ -33,17 +32,12 @@ export default class FailedPanel extends Panel {
this["videoBtn"].visible = true; this["videoBtn"].visible = true;
this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(4)) NetManager.ins.clickLog(getlogItem(4))
handleVideo( NetManager.ins.getTuiaAd(
(s) => { () => {
if (s) { this.hidePanel();
this.hidePanel(); data.complete();
data.complete();
} else {
showToast("广告未成功观看,请继续观看");
}
}, },
() => { }, () => { showToast("广告未成功观看,无法复活"); }
window["slotid"]
) )
}, this); }, this);
} }
......
...@@ -3,7 +3,6 @@ import { DataManager } from "../../libs/tw/manager/DataManager"; ...@@ -3,7 +3,6 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
import { addAdComp } from "./BoxPanel"; import { addAdComp } from "./BoxPanel";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { handleVideo } from "../myVideo/videoCtrl";
import Loading from "../../libs/new_wx/components/Loading"; import Loading from "../../libs/new_wx/components/Loading";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import { updateMainTimer } from "../../libs/new_wx/MainBase"; import { updateMainTimer } from "../../libs/new_wx/MainBase";
...@@ -51,38 +50,29 @@ export default class SignPrizePanel extends Panel { ...@@ -51,38 +50,29 @@ export default class SignPrizePanel extends Panel {
this['close2Btn'].visible = false; this['close2Btn'].visible = false;
this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["doubleBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(8)) NetManager.ins.clickLog(getlogItem(8))
handleVideo( NetManager.ins.getTuiaAd(
(s) => {
if (s) {
Loading.instace.show();
NetManager.ins.getIncentiveAward(
(s) => {
Loading.instace.hide();
this['close2Btn'].visible = true;
this['doubleBtn'].visible = false;
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
showToast("加倍失败");
this.hidePanel();
}
},
21
)
} else {
showToast("广告未成功观看,无法加倍领取");
}
},
() => { () => {
Loading.instace.show();
NetManager.ins.getIncentiveAward( NetManager.ins.getIncentiveAward(
() => { }, (s) => {
21) Loading.instace.hide();
this['close2Btn'].visible = true;
this['doubleBtn'].visible = false;
if (s) {
showToast("翻倍成功");
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
showToast("加倍失败");
this.hidePanel();
}
},
21
)
}, },
window["slotid"] () => { showToast("广告未成功观看,无法加倍领取") }
) )
}, this) }, this)
} }
......
...@@ -18,7 +18,6 @@ import { addRankFriendList } from "../mapScene/RankFriendList"; ...@@ -18,7 +18,6 @@ import { addRankFriendList } from "../mapScene/RankFriendList";
import { addAdComp } from "./BoxPanel"; import { addAdComp } from "./BoxPanel";
import { getChapterData } from "../something/chapters/getChapter"; import { getChapterData } from "../something/chapters/getChapter";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { handleVideo } from "../myVideo/videoCtrl";
export default class StartPanel extends Panel { export default class StartPanel extends Panel {
static currlevel; static currlevel;
...@@ -194,57 +193,42 @@ export default class StartPanel extends Panel { ...@@ -194,57 +193,42 @@ export default class StartPanel extends Panel {
onTap_video1btn() { onTap_video1btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)) NetManager.ins.clickLog(getlogItem(2))
handleVideo( NetManager.ins.getTuiaAd(
(s) => { () => {
if (s) { this['video1btn'].visible = false;
this['video1btn'].visible = false; this.videoProp[1] = 1;
this.videoProp[1] = 1; this['nums1Txt'].text = (this.hammer + this.videoProp[1]) + "";
this['nums1Txt'].text = (this.hammer + this.videoProp[1]) + ""; showToast("增加一个锤子道具")
showToast("增加一个锤子道具")
} else {
showToast("广告未成功观看,道具领取失败")
}
}, },
() => { }, () => { showToast("广告未成功观看,道具领取失败") },
window["slotid"]
) )
} }
//炸弹 //炸弹
onTap_video2btn() { onTap_video2btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)) NetManager.ins.clickLog(getlogItem(2))
handleVideo( NetManager.ins.getTuiaAd(
(s) => { () => {
if (s) { this['video2btn'].visible = false;
this['video2btn'].visible = false; this.videoProp[0] = 1;
this.videoProp[0] = 1; this['nums2Txt'].text = (this.boom + this.videoProp[0]) + "";
this['nums2Txt'].text = (this.boom + this.videoProp[0]) + ""; showToast("增加一个炸弹道具")
showToast("增加一个炸弹道具")
} else {
showToast("广告未成功观看,道具领取失败")
}
}, },
() => { }, () => { showToast("广告未成功观看,道具领取失败") }
window["slotid"]
) )
} }
//步数 //步数
onTap_video3btn() { onTap_video3btn() {
//看视频按钮点击 //看视频按钮点击
NetManager.ins.clickLog(getlogItem(2)) NetManager.ins.clickLog(getlogItem(2))
handleVideo( NetManager.ins.getTuiaAd(
(s) => { () => {
if (s) { this['video3btn'].visible = false;
this['video3btn'].visible = false; this.videoProp[2] = 1;
this.videoProp[2] = 1; this['nums3Txt'].text = (this.boom + this.videoProp[2]) + "";
this['nums3Txt'].text = (this.boom + this.videoProp[2]) + ""; showToast("增加一个增加步数道具")
showToast("增加一个增加步数道具")
} else {
showToast("广告未成功观看,道具领取失败")
}
}, },
() => { }, () => { showToast("广告未成功观看,道具领取失败") }
window["slotid"]
) )
} }
......
...@@ -60,19 +60,14 @@ export default class VideoBuyPanel extends Panel { ...@@ -60,19 +60,14 @@ export default class VideoBuyPanel extends Panel {
this["videoBtn"].visible = true; this["videoBtn"].visible = true;
this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this["videoBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(10)) NetManager.ins.clickLog(getlogItem(10))
handleVideo( NetManager.ins.getTuiaAd(
(s) => { () => {
if (s) { this.hidePanel();
this.hidePanel(); //回调
//回调 data.complete(true);
data.complete(true); showToast("领取成功")
showToast("领取成功")
} else {
showToast("广告未成功观看,道具领取失败")
}
}, },
() => { }, () => { showToast("广告未成功观看,道具领取失败") }
window["slotid"]
) )
}, this); }, this);
} else { } else {
......
...@@ -397,6 +397,55 @@ export class Tool { ...@@ -397,6 +397,55 @@ export class Tool {
return false; return false;
} }
/**
* 判断鸡蛋孵小鸡可飞入的索引
* 基础元素,无任何状态,类型不为鸡,石门非关闭
* @param lat
*/
public static judgeSetChicken(lat: Lattice): boolean {
if (Tool.judgeBaseEle(lat) &&
!lat.element.hasAnyState() &&
lat.element.type !== ElementType.CHICKEN &&
!lat.doorClosed
) {
return true;
}
return false;
}
/**
* 判断可被单魔力鸟效果消除的元素
* 是基础元素,非石门关闭,非魔力鸟,(基础类型的判断自行添加)
* @param lat
*/
public static judgeMagicEliminate(lat: Lattice): boolean {
if (Tool.judgeBaseEle(lat) && //是基础元素
!lat.doorClosed &&//石门非关闭状态
lat.element.effectType != EffectType.MAGICLION //不能是魔力鸟特效
) {
return true;
}
return false
}
/**
* 判断
* 果冻可蔓延、
* 毛球可分裂、
* 毛球可跳动
* 的方向格子索引,暂时都一致,不区分
* 是基础元素,无任何状态,石门非关闭
* @param lat
*/
public static judgeAiActionDirection(lat: Lattice): boolean {
if (Tool.judgeBaseEle(lat) &&
!lat.element.hasAnyState() &&
!lat.doorClosed
) {
return true;
}
return false;
}
/** /**
* 判断元素是否可被手势选中和交换 * 判断元素是否可被手势选中和交换
......
...@@ -27,6 +27,8 @@ const chickenNum: number = 4; ...@@ -27,6 +27,8 @@ const chickenNum: number = 4;
//节日大红包的小红包数量 //节日大红包的小红包数量
export const fesELeSmallNum: number = 6; export const fesELeSmallNum: number = 6;
//很多motion在石门关闭时都不能触发,暂时就只有石门,以后有多出来的再独立封装
export class AiControl { export class AiControl {
private static _ins: AiControl private static _ins: AiControl
/** /**
...@@ -198,7 +200,7 @@ export class AiControl { ...@@ -198,7 +200,7 @@ export class AiControl {
var lat = thisObj.lattices[a]; var lat = thisObj.lattices[a];
//是基础元素,但是不能有任何状态, 考虑修改小红包属性为可fall, //是基础元素,但是不能有任何状态, 考虑修改小红包属性为可fall,
if (Tool.judgeBaseEle(lat) && if (Tool.judgeBaseEle(lat) &&
!lat.element.hasAnyState()&& !lat.element.hasAnyState() &&
!lat.doorClosed //石门未关闭 !lat.doorClosed //石门未关闭
) { ) {
redIndexs.push(a); redIndexs.push(a);
...@@ -376,13 +378,7 @@ export class AiControl { ...@@ -376,13 +378,7 @@ export class AiControl {
for (var a = 0; a < thisObj.lattices.length; a++) { for (var a = 0; a < thisObj.lattices.length; a++) {
var lat = thisObj.lattices[a]; var lat = thisObj.lattices[a];
//是基础元素,但是不能有任何状态,去掉鸡,且石门未关闭 //是基础元素,但是不能有任何状态,去掉鸡,且石门未关闭
if (Tool.judgeBaseEle(lat) && if (Tool.judgeSetChicken(lat)) chickenIndexs.push(a);
!lat.element.hasAnyState() &&
lat.element.type !== ElementType.CHICKEN&&
!lat.doorClosed
) {
chickenIndexs.push(a);
}
} }
//如果没有能飞的格子,直接回调 //如果没有能飞的格子,直接回调
if (!chickenIndexs.length) { if (!chickenIndexs.length) {
...@@ -745,7 +741,7 @@ function judgeFesEleBigExist(lattices: Lattice[]) { ...@@ -745,7 +741,7 @@ function judgeFesEleBigExist(lattices: Lattice[]) {
} }
/** /**
* 判断气泡是否存在 * 判断气泡是否存在,废弃了,气泡会再生,提前判断无意义
* @param lattices * @param lattices
*/ */
function judgeBubbleExist(lattices: Lattice[]) { function judgeBubbleExist(lattices: Lattice[]) {
...@@ -814,12 +810,7 @@ function judgeActionIndex(index: number, lattices: Lattice[]): number { ...@@ -814,12 +810,7 @@ function judgeActionIndex(index: number, lattices: Lattice[]): number {
while (arr.length) { while (arr.length) {
var rand = Math.floor(Math.random() * arr.length); var rand = Math.floor(Math.random() * arr.length);
var i = arr.splice(rand, 1)[0]; var i = arr.splice(rand, 1)[0];
if (Tool.judgeBaseEle(lattices[i]) && if (Tool.judgeAiActionDirection(lattices[i])) return i;
!lattices[i].element.hasAnyState() &&
!lattices[i].doorClosed
) {
return i
}
} }
return null return 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