Commit 8e17097d authored by wjf's avatar wjf

l

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