import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import GameBaseScript from "../GameRoomRes/GameBaseScript"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import UserManager from "../Manager/UserManager"; import NewGuideScript from "../NewGuide/NewGuideScript"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import GetAward from "../SCommon/GetAward"; import DHBase from "./DHBase"; const { ccclass, property, disallowMultiple, menu } = cc._decorator; @ccclass @disallowMultiple() @menu('对话剧情/DH_8') export default class DH_8 extends DHBase { chatConfig = [ { effectUrl: 'DH/DH_8/sound/500万给你,拿着钱赶紧滚。', delayTime: 2.05, str: '500万给你,拿着钱赶紧滚。', posi: '-1' }, { effectUrl: 'DH/DH_8/sound/算你小子识相,这小妞还给你。', delayTime: 4.19, str: '算你小子识相,这小妞还给你。', posi: 'qipao1' }, ] @property(sp.Skeleton) spine: sp.Skeleton = null @property(cc.Node) m_bg: cc.Node = null @property(cc.Node) MoveNodes: cc.Node = null callfunc: any; start() { Common5.preLoadRemoteAudioByChatConfig(this.chatConfig); super.start(); this.spine.setAnimation(0, "女主被绑待机", true) this.continueStory(); // this.scheduleOnce(() => { // PrefabManage.preloadPrefabByType(GameType.DH_89) // }) } init(callfunc) { this.callfunc = callfunc } // 继续剧情 continueStory() { this.scheduleOnce(() => { PrefabManage.preloadPrefabByType(GameType.DH_9) }) const dialogEvents = [ (func) => { this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => { this.scheduleOnce(()=>{ Common5.playRemoteAudioEffect('sound/common/钱币入账') },0.1) this.spine.setAnimation(0, "男主丢钱2", false) this.spine.setCompleteListener(()=>{ this.spine.setCompleteListener(null) this.spine.setAnimation(0, "男主丢钱待机2", true) }) }); }, (func) => { this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => { this.spine.setAnimation(0, "女主被绑推给男主", false) this.spine.setCompleteListener(() => { this.spine.setCompleteListener(null) this.spine.setAnimation(0, "女主被绑推给男主待机", true) this.node.getChildByName("videoBtn").active = true }) }); }, ] const dialogCallFunc = (logEvents: any[]) => { logEvents.shift()(() => { if (logEvents.length > 0) { dialogCallFunc(logEvents); } else { // PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => { // let goods = [{ goodId: 1733, goodNum: 1 }]; // prefabNode.getComponent(GetAward).initView(goods, () => { // // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_530) // // User.setRoomGoodStatus("DH_89") // // UserManager.clearAndaddStructureFlash("cf_FengRenYuan") // }); // }); // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202) // TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203) // this.node.destroy() } }); } dialogCallFunc(dialogEvents); } guideView(nodeArray, opacity = -1) { PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (prefab) => { // prefab.zIndex = 199 let guideNodeArray = nodeArray let firstNode = guideNodeArray.shift() prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray) if (opacity != -1) { prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity) } }) } runBg(time, scale, endnode, callFunc) { cc.tween(this.m_bg) .to(time, { scale: scale }) .start() cc.tween(this.m_bg) .sequence( cc.tween().to(time, { position: cc.v2(-endnode.position.x * scale, -endnode.position.y * scale) }), cc.tween().call(() => { callFunc() }) ) .start() } onTouchButton() { this.node.removeFromParent() this.node.destroy() if (this.callfunc) { this.callfunc() } } }