觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

297 lines
15 KiB

import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
import EventMgr from "../../../FrameWork/Event/EventMgr";
import User from "../../../FrameWork/User/User";
import AppPlatform from "../../../FrameWork/Util/AppPlatform";
import Common5 from "../../../Platform/th/Common5";
import JuQingManager from "../../JuQingChat/JuQingManager";
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
import BagManager from "../../Manager/BagManager";
import InterfaceManager from "../../Manager/InterfaceManager";
import ProbabilityManager from "../../Manager/ProbabilityManager";
import NewGuideScript from "../../NewGuide/NewGuideScript";
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
import GameBase from "../../SCommon/GameBase";
import GetAward from "../../SCommon/GetAward";
const { ccclass, property } = cc._decorator;
@ccclass
export default class KuaiDiZhan extends GameBase {
// @property(cc.Node)
// zhaoMuNode: cc.Node = null;
_dt: number = 0
isAnim: boolean = false;
// onLoad () {}
start() {
// this.refreshZhaoMuTime()
// this.showShouYiNode()
// EventMgr.onEvent_custom(ryw_Event.refreshZhaoMuTimes, () => {
// this.showShouYiNode()
// this.refreshZhaoMuTime()
// }, this)
let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo();
if (taskInfo.Id == MainTaskIdEnum.MainTask_303 && (BagManager.getBagGoodNums(3004) <= 0 || BagManager.getBagGoodNums(3005) <= 0)) {
let node = this.node.getChildByName('bottomBtnNode').getChildByName('btn_start');
this.guideView([node]);
}
if (taskInfo.Id == MainTaskIdEnum.MainTask_303) {
if (BagManager.getBagGoodNums(3004) > 0 && BagManager.getBagGoodNums(3005) > 0 && BagManager.getBagGoodNums(3006) <= 0) {
this.node.getChildByName("bottomBtnNode").getChildByName("btn_startFiveTimes").getChildByName("jieSuoQiPao").active = true
}
}
}
guideView(nodeArray) {
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
})
}
//初始化
initContent(num) {
let isVideo = false;
let node: cc.Node = null;
if (num == 5) {
node = this.node.getChildByName('快递');
ProbabilityManager.gameClickLajiTimeAdd(true);
isVideo = true;
} else {
node = this.node.getChildByName('快递');
ProbabilityManager.gameClickLajiTimeAdd(false);
}
node.getComponent(sp.Skeleton).setAnimation(0, '快递', false);
node.getComponent(sp.Skeleton).setCompleteListener(() => {
node.getComponent(sp.Skeleton).setCompleteListener(null)
// node.getComponent(sp.Skeleton).setAnimation(0, '打开', true);
let goodArray = InterfaceManager.getMangheGoodsListByType('KuaiDiZhan', num, isVideo);
let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo();
if (taskInfo.Id == MainTaskIdEnum.MainTask_303) {
if (BagManager.getBagGoodNums(3004) <= 0) {
goodArray = [{ goodId: 3004, goodNum: 1 }]
} else if (BagManager.getBagGoodNums(3005) <= 0) {
goodArray = [{ goodId: 3005, goodNum: 1 }]
}
}
PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
prefabNode.getComponent(GetAward).initView(goodArray, () => {
node.getComponent(sp.Skeleton).setAnimation(0, '静止', true);
this.isAnim = false;
let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo();
if (taskInfo.Id == MainTaskIdEnum.MainTask_303) {
if (BagManager.getBagGoodNums(3004) > 0 && BagManager.getBagGoodNums(3005) > 0 && BagManager.getBagGoodNums(3006) <= 0) {
this.node.getChildByName("bottomBtnNode").getChildByName("btn_startFiveTimes").getChildByName("jieSuoQiPao").active = true
}
let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
for (const goodId of taskCaiGouDan) {
if (BagManager.getBagGoodNums(goodId) == 0) {
return;
}
}
this.node.getChildByName("bottomBtnNode").getChildByName("btn_startFiveTimes").getChildByName("jieSuoQiPao").active = false
User.setRoomBtnIndex(2)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_303);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_304);
EventMgr.emitEvent_custom(ryw_Event.refreshNeedLayer)
let node = this.node.getChildByName('exitRoom');
this.guideView([node]);
} else if (taskInfo.Id == MainTaskIdEnum.MainTask_1003) {
let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
for (const goodId of taskCaiGouDan) {
if (BagManager.getBagGoodNums(goodId) == 0) {
return;
}
}
User.setRoomBtnIndex(2)
EventMgr.emitEvent_custom(ryw_Event.refreshNeedLayer)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1003);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1004);
} else if (taskInfo.Id == MainTaskIdEnum.MainTask_1804) {
let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
for (const goodId of taskCaiGouDan) {
if (BagManager.getBagGoodNums(goodId) == 0) {
return;
}
}
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1804);
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1805);
}
EventMgr.emitEvent_custom(ryw_Event.refreshButton)
// else if (taskInfo.Id == MainTaskIdEnum.MainTask_305) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_305);
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_306);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_702) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_702);
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_703);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_713) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_713);
// User.setRoomBtnIndex(4)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_714);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_1404) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1404);
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1405);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_1601) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1601);
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1602);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_1707) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1707);
// JuQingManager.unLockNewJuQing('WX_1702');
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1708);
// } else if (taskInfo.Id == MainTaskIdEnum.MainTask_2006) {
// let taskCaiGouDan = TaskManager.getTaskConfigById(taskInfo.Id).taskCaiGouDan;
// for (const goodId of taskCaiGouDan) {
// if (BagManager.getBagGoodNums(goodId) == 0) {
// return;
// }
// }
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2006);
// JuQingManager.unLockNewJuQing('WX_2003');
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2007);
// }
});
})
})
}
//抓一次
YiCiClick() {
if (this.isAnim) {
return
}
// Common5.playEffectCustom('kuaidizhan', 'sound/快递划开')
Common5.playRemoteAudioEffect("action_effect/翻快递", false);
this.isAnim = true
this.initContent(1)
}
//抓五次
WuCiClick() {
if (this.isAnim) {
return
}
this.isAnim = true
let tab = {
onClose: (finish) => {
if (finish) {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-盲盒站开个够`);
// Common5.playEffectCustom('kuaidizhan', 'sound/小刀划开5个')
Common5.playRemoteAudioEffect("action_effect/翻快递", false);
this.initContent(5);
}
else {
this.isAnim = false
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
this.isAnim = false
}
}
AppPlatform.playVideo_custom(tab)
}
// refreshZhaoMuTime() {
// let localZhaoMuData = MeiNvZhaoMuManager.getMeiNvZhaoMuData()
// let maxTime = localZhaoMuData[ZhaoMuGameType.HaiYangQingjie].zhaoMuTime
// let zhaoMuBeiShu = localZhaoMuData[ZhaoMuGameType.HaiYangQingjie].zhaoMuBeiShu
// // let maxUnlockIndex = localZhaoMuData[ZhaoMuGameType.HaiYangQingjie].maxUnlockIndex
// if (maxTime > 0) {
// //按钮上人物显示第一个
// // let config = MeiNvZhaoMuManager.getConfigById(HaiYangQingjie.XiaShuiDao,0)
// // this.zhaoMuNode.getChildByName('tipSpr').active = false
// this.zhaoMuNode.getChildByName('renSpine').active = true
// // this.zhaoMuNode.getChildByName('renSpine').getComponent(sp.Skeleton).setAnimation(0,'半身呼吸',true)
// // this.zhaoMuNode.getChildByName('renSpine').getComponent(sp.Skeleton).setSkin(config.skinIndex)
// this.zhaoMuNode.getChildByName('timeStr').getComponent(cc.Label).string = `${DateUtils.formatTime_custom(maxTime)}`
// this.zhaoMuNode.getChildByName('tipSpr').getChildByName('shouYiStr').getComponent(cc.Label).string = `收益x${zhaoMuBeiShu}`
// } else {
// // this.zhaoMuNode.getChildByName('tipSpr').active = true
// this.zhaoMuNode.getChildByName('renSpine').active = false
// this.zhaoMuNode.getChildByName('timeStr').getComponent(cc.Label).string = ``
// // this.zhaoMuNode.getChildByName('shouYiStr').getComponent(cc.Label).string = `秘书招聘`
// this.zhaoMuNode.getChildByName('tipSpr').getChildByName('shouYiStr').getComponent(cc.Label).string = `收益 x N`
// }
// }
// zhaomuClickEvent() {
// Common5.playEffect("CommonRes/sound/按键点击")
// PrefabManage.loadPrefabByType(GameType.MeiNvZhaoMu, null, (prefabNode) => {
// prefabNode.getComponent(MeiNvZhaoMu).initView(ZhaoMuGameType.HaiYangQingjie)
// })
// }
// showShouYiNode() {
// let hetong = User.getUserHeTong()
// let xishuIndex= 1
// if(hetong.signMishuForever){
// xishuIndex = 2
// }
// let index = ZhaoMuGameType.HaiYangQingjie
// let localZhaoMuData = MeiNvZhaoMuManager.getMeiNvZhaoMuData()
// let zhaoMuBeiShu = localZhaoMuData[index].zhaoMuBeiShu
// let money = AutoShouYiConfig[index].money * zhaoMuBeiShu * xishuIndex
// this.node.getChildByName('shouYiNode').getChildByName('moneyStr').getComponent(cc.Label).string = `收益:${Common5.getNumberChangeHanzi(money, '1', 1)}/秒`
// }
// update (dt) {
// this._dt += dt
// if (this._dt >= 1.0) {
// this._dt = 0
// this.refreshZhaoMuTime()
// }
// }
}