import { ryw_Event } from "../../../FrameWork/Event/EventEnum"; import EventMgr from "../../../FrameWork/Event/EventMgr"; import User from "../../../FrameWork/User/User"; import Common5 from "../../../Platform/th/Common5"; import JuQingManager from "../../JuQingChat/JuQingManager"; import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager"; import BagManager from "../../Manager/BagManager"; import UserManager from "../../Manager/UserManager"; import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage"; import GetAward from "../../SCommon/GetAward"; const { ccclass, property } = cc._decorator; @ccclass export default class Result_success2 extends cc.Component { @property(cc.Node) level_1: cc.Node = null; @property(cc.Node) level_2: cc.Node = null; @property(cc.Node) naoliStr: cc.Node = null; exitCallFunc = null onLoad() { } protected start(): void { let level = User.getQieLevel(); Common5.ReportDY("inLevel", `企鹅过关${level}-AD-过关`); let callFunc = ()=>{ if (level < 30) { User.setQieLevel(level + 1); UserManager.addProperNaoLi(1); } } if (level == 1 && BagManager.getBagGoodNums(3094) == 0) { let goodArray = [{ goodId: 3094, goodNum: 1 }]; PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { prefabNode.getComponent(GetAward).initView(goodArray,()=>{ callFunc() }); }); } else if (level == 2 && BagManager.getBagGoodNums(3604) == 0) { let goodArray = [{ goodId: 3604, goodNum: 1 }]; PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { prefabNode.getComponent(GetAward).initView(goodArray,()=>{ callFunc() let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo(); if (taskInfo.Id == MainTaskIdEnum.MainTask_1202) { for (const goodId of [3094, 3604]) { if (BagManager.getBagGoodNums(goodId) == 0) { return; } } TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1202); TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1203); JuQingManager.unLockNewJuQing('WX_QL1201'); } }); }); }else{ callFunc() } } initView(level, exitCallFunc) { if (level == 1) { this.level_1.active = true; } else if (level == 2) { this.level_2.active = true; } this.exitCallFunc = exitCallFunc; // User.addUserNaoLiZhi(1) // PrefabManage.showTextTips('恭喜获得脑力值+1') // if (User.getNaoLiZhiShangXian() < GameDataManage2.MaxUpNaoLi) { // this.naoliStr.getComponent(cc.Label).string = "脑力上限+1"; // User.setNaoLiZhiShangXian(User.getNaoLiZhiShangXian() + 1); // } else { // this.naoliStr.getComponent(cc.Label).string = "脑力上限已到极限!"; // } } onBtnNext() { Common5.playEffectCustom("cainiaoxiaoxiao", "sound/UI按钮"); this.node.removeFromParent(); this.node.destroy(); // if (User.getQieLevel() < 30) { EventMgr.emitEvent_custom(ryw_Event.nextQie) // } // else { // PrefabManage.showTextTips("您已通关!"); // } // this.exitCallFunc && this.exitCallFunc(); } onBtnExit() { Common5.playEffectCustom("cainiaoxiaoxiao", "sound/UI按钮"); this.node.removeFromParent(); this.node.destroy(); this.exitCallFunc && this.exitCallFunc(); } }