咸鱼的反击
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.

263 lines
11 KiB

2 months ago
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 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_41')
export default class DH_41 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_41/sound/搞垮汉升餐饮公司策划书?', delayTime: 2.29, str: '搞垮汉升餐饮公司策划书?', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/这是柳鸿福担任副会长的受贿视频?', delayTime: 3.31, str: '这是柳鸿福担任副会长的受贿视频?', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/这是设计搞垮前典心楼的录音证据?', delayTime: 3.98, str: '这是设计搞垮前典心楼的录音证据?', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/竟然还有我的档案!', delayTime: 1.16, str: '竟然还有我的档案!', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/里面有柳家违法的记录?', delayTime: 1.63, str: '里面有柳家违法的记录?', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/本来打算放过你们的,可是你竟然还不罢休,那没办法只能送你们进去了。', delayTime: 6.08, str: '本来打算放过你们的,可是你竟然还不罢休,那没办法只能送你们进去了。', posi: '-1' },
{ effectUrl: 'DH/DH_41/sound/陈汉升你这个卑鄙小人,你不得好死。', delayTime: 4.77, str: '陈汉升你这个卑鄙小人,你不得好死。', posi: 'qipao2' },
]
@property(sp.Skeleton)
spine: sp.Skeleton = null
@property(sp.Skeleton)
jiangbei: sp.Skeleton = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
chuzi_position: cc.Vec3;
start() {
Common5.playRemoteAudioMusic('remotesound/effect/紧张氛围-10秒', true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
this.spine.node.active = false
// this.continueStory();
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_42)
})
let node = this.m_bg.getChildByName("抽屉").getChildByName("锤子1")
this.chuzi_position = node.position.clone()
node.on(cc.Node.EventType.TOUCH_START, this.touchStartNode, this)
node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoveNode, this)
node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEndNode, this)
node.on(cc.Node.EventType.TOUCH_END, this.touchEndNode, this)
}
touchStartNode(event) {
let target = event.target;
target.pauseAllActions();
Common5.playEffect("点击音效");
}
touchMoveNode(event) {
let target = event.target
let posi = event.getLocation()//世界坐标
posi = target.parent.convertToNodeSpaceAR(posi)
target.setPosition(posi)
let node = target.getChildByName("锤子")
node.active = true
}
touchEndNode(event) {
let target = event.target
let checkNode = this.m_bg.getChildByName("chadianClick").getChildByName("click5")
if (Common5.checkIntersectsBox(target, checkNode)) {
Common5.playRemoteAudioEffect("remotesound/effect/碎裂声")
// let chadianIconArray = this.node.getChildByName("chadianIconArray")
// chadianIconArray.children[4].getChildByName("icon").active = true
this.jiangbei.setAnimation(0, "打碎", false)
target.active = false
this.jiangbei.setCompleteListener(() => {
this.jiangbei.setCompleteListener(null)
this.jiangbei.node.active = false
this.showQiPao(this.chatConfig[4])
this.m_bg.getChildByName("账本").active = true
})
} else {
let node = target.getChildByName("锤子")
node.active = false
target.setPosition(this.chuzi_position.clone())
}
}
// // 继续剧情
// continueStory() {
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_4)
// })
// this.nanzhu.setAnimation(0, "待机", true)
// const dialogEvents = [
// (func) => {
// this.runBg(0, 3, this.MoveNodes.getChildByName("男主"), () => {
// func()
// })
// },
// (func) => {
// this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
// this.nanzhu.setAnimation(0, "说话", 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_419")
// // // 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()
}
onTouchBaoZhi() {
this.m_bg.getChildByName("放大报纸").active = false
}
onTouchZhaopian() {
this.m_bg.getChildByName("照片大").active = false
}
onTouchChaDian(event) {
let name = event.target.name
let chadianIconArray = this.node.getChildByName("chadianIconArray")
event.target.active = false
if (name == "click1") {
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
// chadianIconArray.children[0].getChildByName("icon").active = true
this.showQiPao(this.chatConfig[0])
this.m_bg.getChildByName("策划书").active = true
} else if (name == "click2") {
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
// chadianIconArray.children[1].getChildByName("icon").active = true
this.showQiPao(this.chatConfig[1])
this.m_bg.getChildByName("视频").active = true
} else if (name == "click3") {
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
// this.showQiPao(this.chatConfig[2])
// this.m_bg.getChildByName("录音笔").active = true
this.m_bg.getChildByName("抽屉").active = true
} else if (name == "click4") {
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
// chadianIconArray.children[3].getChildByName("icon").active = true
this.showQiPao(this.chatConfig[3])
this.m_bg.getChildByName("档案").active = true
} else if (name == "click5") {
// chadianIconArray.children[4].getChildByName("icon").active = true
// this.showQiPao(this.chatConfig[4])
// this.m_bg.getChildByName("牌匾 破旧").active = false
}
}
onTouchBig(event) {
let name = event.target.name
event.target.active = false
let chadianIconArray = this.node.getChildByName("chadianIconArray")
if (name == "策划书") {
chadianIconArray.children[0].getChildByName("icon").active = true
} else if (name == "视频") {
chadianIconArray.children[1].getChildByName("icon").active = true
} else if (name == "录音笔") {
chadianIconArray.children[2].getChildByName("icon").active = true
} else if (name == "档案") {
chadianIconArray.children[3].getChildByName("icon").active = true
} else if (name == "账本") {
chadianIconArray.children[4].getChildByName("icon").active = true
}
this.checkTask()
}
onTouchLuYinBi(event) {
this.scheduleOnce(() => {
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
}, 0.1)
event.target.active = false
this.showQiPao(this.chatConfig[2])
this.m_bg.getChildByName("录音笔").active = true
}
checkTask() {
let isFind = true
let chadianIconArray = this.node.getChildByName("chadianIconArray")
for (let i = 0; i < chadianIconArray.children.length; i++) {
if (!chadianIconArray.children[i].getChildByName("icon").active) {
isFind = false
}
}
if (isFind) {
this.spine.node.active = true
this.showQiPao(this.chatConfig[5], () => {
this.spine.setAnimation(0, "抓人", false)
this.spine.setCompleteListener(() => {
this.spine.setCompleteListener(null)
this.showQiPao(this.chatConfig[6], () => {
this.spine.setAnimation(0, "抓人持续", true)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_553)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_554_1)
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.DH_42)
this.node.removeFromParent()
this.node.destroy()
})
}, () => {
this.spine.setAnimation(0, "抓人柳说话", true)
});
})
}, () => {
this.spine.setAnimation(0, "男主说话", true)
});
}
}
}